diff options
author | nyamatongwe <unknown> | 2000-08-18 10:45:24 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2000-08-18 10:45:24 +0000 |
commit | 74537dd24ba7943e79652b06f4b752be2035bcea (patch) | |
tree | c5d0492dca4b04bf79e1ef367a7190df8472bc3f | |
parent | d15b65e7fba53354b9a044ba5d8232d256b58d5e (diff) | |
download | scintilla-mirror-74537dd24ba7943e79652b06f4b752be2035bcea.tar.gz |
Added in most of Ferdinand Prantl's changes except for regular expression
search.
Some bits not quite done as well.
-rw-r--r-- | doc/ScintillaDoc.html | 15 | ||||
-rw-r--r-- | include/PropSet.h | 56 | ||||
-rw-r--r-- | include/SciLexer.h | 1 | ||||
-rw-r--r-- | include/Scintilla.h | 5 | ||||
-rw-r--r-- | include/Scintilla.iface | 11 | ||||
-rw-r--r-- | src/AutoComplete.cxx | 11 | ||||
-rw-r--r-- | src/AutoComplete.h | 6 | ||||
-rw-r--r-- | src/Editor.cxx | 17 | ||||
-rw-r--r-- | src/Editor.h | 3 | ||||
-rw-r--r-- | src/LexOthers.cxx | 45 | ||||
-rw-r--r-- | src/PropSet.cxx | 33 | ||||
-rw-r--r-- | src/ScintillaBase.cxx | 50 | ||||
-rw-r--r-- | src/ScintillaBase.h | 2 | ||||
-rw-r--r-- | win32/ScintillaWin.cxx | 2 |
14 files changed, 221 insertions, 36 deletions
diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index 98a242f86..743838af0 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -103,6 +103,14 @@ SCI_GETSTYLEBITS the SCI_CLEARDOCUMENTSTYLE can be used to clear all styling information and reset the folding state. </p> +<pre> +SCI_SETOVERTYPE +SCI_GETOVERTYPE +</pre> + <p> + SCI_GETOVERTYPE returns TRUE if overtyping is active otherwise + FALSE will be returned. Use SCI_GETOVERTYPE to set the overtype node. + </p> <h3> Standard commands </h3> @@ -970,6 +978,13 @@ SCN_CHARADDED(int charadded) or auto completion list. </p> <pre> +SCN_POSCHANGED(int newPos) +</pre> + <p> + Fired when the user moves the cursor to a different position in the text. + Can be used by the container to cancel some time consuming thread. + </p> +<pre> SCN_SAVEPOINTREACHED(int issavepoint) SCI_SETSAVEPOINT </pre> diff --git a/include/PropSet.h b/include/PropSet.h index f3dbd4659..2aefcdbd8 100644 --- a/include/PropSet.h +++ b/include/PropSet.h @@ -60,6 +60,9 @@ public: return false; return strcmp(s, other.s) == 0; } + bool operator!=(const SString &other) const { + return !operator==(other); + } bool operator==(const char *sother) const { if ((s == 0) && (sother == 0)) return true; @@ -67,6 +70,9 @@ public: return false; return strcmp(s, sother) == 0; } + bool operator!=(const char *sother) const { + return !operator==(sother); + } const char *c_str() const { if (s) return s; @@ -99,26 +105,55 @@ public: } return *this; } + SString &operator +=(char ch) { + int len = length(); + char *sNew = new char[len + 1 + 1]; + if (sNew) { + if (s) + memcpy(sNew, s, len); + sNew[len] = ch; + sNew[len + 1] = '\0'; + delete []s; + s = sNew; + } + return *this; + } int value() const { if (s) return atoi(s); else return 0; } + void substitute(char find, char replace) { + char *t = s; + while (t) { + t = strchr(t, find); + if (t) + *t = replace; + } + } + // I don't think this really belongs here -- Neil + void correctPath() { +#ifdef unix + substitute('\\', '/'); +#else + substitute('/', '\\'); +#endif + } }; struct Property { - unsigned int hash; + unsigned int hash; char *key; - char *val; - Property *next; - Property() : hash(0), key(0), val(0), next(0) {} + char *val; + Property *next; + Property() : hash(0), key(0), val(0), next(0) {} }; class PropSet { private: - enum { hashRoots=31 }; - Property *props[hashRoots]; + enum { hashRoots=31 }; + Property *props[hashRoots]; public: PropSet *superPS; PropSet(); @@ -126,8 +161,8 @@ public: void Set(const char *key, const char *val); void Set(char *keyval); SString Get(const char *key); - SString GetExpanded(const char *key); - SString Expand(const char *withvars); + SString GetExpanded(const char *key); + SString Expand(const char *withvars); int GetInt(const char *key, int defaultValue=0); SString GetWild(const char *keybase, const char *filename); SString GetNewExpand(const char *keybase, const char *filename); @@ -143,11 +178,12 @@ public: char *list; int len; bool onlyLineEnds; // Delimited by any white space or only line ends + bool sorted; int starts[256]; WordList(bool onlyLineEnds_ = false) : - words(0), list(0), len(0), onlyLineEnds(onlyLineEnds_) {} + words(0), list(0), len(0), onlyLineEnds(onlyLineEnds_), sorted(false) {} ~WordList() { Clear(); } - operator bool() { return (list && list[0]) ? true : false; } + operator bool() { return words ? true : false; } const char *operator[](int ind) { return words[ind]; } void Clear(); void Set(const char *s); diff --git a/include/SciLexer.h b/include/SciLexer.h index a3a26b2d1..4671941f7 100644 --- a/include/SciLexer.h +++ b/include/SciLexer.h @@ -24,6 +24,7 @@ #define SCLEX_XCODE 13 #define SCLEX_LATEX 14 #define SCLEX_LUA 15 +#define SCLEX_DIFF 16 // Lexical states for SCLEX_PYTHON #define SCE_P_DEFAULT 0 diff --git a/include/Scintilla.h b/include/Scintilla.h index a1494b41a..855b186d7 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -211,6 +211,7 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara #define SCI_AUTOCSELECT SCI_START + 108 #define SCI_AUTOCSETCANCELATSTART SCI_START + 110 #define SCI_AUTOCGETCANCELATSTART SCI_START + 111 +#define SCI_AUTOCSETFILLUPS SCI_START + 112 #define SCI_GETTABWIDTH SCI_START + 121 #define SCI_SETINDENT SCI_START + 122 @@ -288,6 +289,9 @@ typedef long (*SciFnDirect)(long ptr, unsigned int iMessage, unsigned long wPara #define SCI_GETDIRECTFUNCTION SCI_START + 184 #define SCI_GETDIRECTPOINTER SCI_START + 185 +#define SCI_SETOVERTYPE SCI_START + 186 +#define SCI_GETOVERTYPE SCI_START + 187 + #define SCI_CALLTIPSHOW SCI_START + 200 #define SCI_CALLTIPCANCEL SCI_START + 201 #define SCI_CALLTIPACTIVE SCI_START + 202 @@ -458,6 +462,7 @@ typedef void (tMacroRecorder)(unsigned int iMessage, unsigned long wParam, #endif #define SCN_MARGINCLICK 2010 #define SCN_NEEDSHOWN 2011 +#define SCN_POSCHANGED 2012 // For compatibility, these go through the COMMAND notification rather than NOTIFY // and have exactly the same values as the EN_* constants. diff --git a/include/Scintilla.iface b/include/Scintilla.iface index d80dfcce5..f742f7804 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -435,6 +435,9 @@ set void AutoCSetCancelAtStart=2110(bool cancel,) # Retrieve whether auto-completion cancelled by backspacing before start. get bool AutoCGetCancelAtStart=2111(,) +# Define a set of character that when typed fills up the selected word. +set void AutoCSetFillUps=2112(, string characterSet) + # Set the number of spaces used for one level of indentation. set void SetIndent=2122(int indentSize,) @@ -645,6 +648,12 @@ get int GetDirectFunction=2184(,) # the function returned by GetDirectFunction. get int GetDirectPointer=2185(,) +# Set to overtype (true) or insert mode +set void SetOvertype=2186(bool overtype,) + +# Returns true if overtype mode is active otherwise false is returned. +get bool GetOvertype=2187(,) + # Show a call tip containing a definition near position pos. fun void CallTipShow=2200(position pos, string definition) @@ -989,6 +998,7 @@ val SCN_MODIFIED=2008 val SCN_MACRORECORD=2009 val SCN_MARGINCLICK=2010 val SCN_NEEDSHOWN=2011 +val SCN_POSCHANGED=2012 # For compatibility, these go through the COMMAND notification rather than NOTIFY # and have exactly the same values as the EN_* constants. @@ -1040,6 +1050,7 @@ val SCLEX_BATCH=12 val SCLEX_XCODE=13 val SCLEX_LATEX=14 val SCLEX_LUA=15 +val SCLEX_DIFF=16 val SCE_P_DEFAULT=0 val SCE_P_COMMENTLINE=1 val SCE_P_NUMBER=2 diff --git a/src/AutoComplete.cxx b/src/AutoComplete.cxx index f9dbd4d67..6866364c1 100644 --- a/src/AutoComplete.cxx +++ b/src/AutoComplete.cxx @@ -14,7 +14,9 @@ AutoComplete::AutoComplete() { active = false; posStart = 0; strcpy(stopChars, ""); + strcpy(fillUpChars, ""); separator = ' '; + ignoreCase = false; cancelAtStartPos = true; } @@ -45,6 +47,15 @@ bool AutoComplete::IsStopChar(char ch) { return ch && strchr(stopChars, ch); } +void AutoComplete::SetFillUpChars(const char *fillUpChars_) { + strncpy(fillUpChars, fillUpChars_, sizeof(fillUpChars)); + fillUpChars[sizeof(fillUpChars) - 1] = '\0'; +} + +bool AutoComplete::IsFillUpChar(char ch) { + return ch && strchr(fillUpChars, ch); +} + void AutoComplete::SetSeparator(char separator_) { separator = separator_; } diff --git a/src/AutoComplete.h b/src/AutoComplete.h index 37795fce6..434679f93 100644 --- a/src/AutoComplete.h +++ b/src/AutoComplete.h @@ -9,8 +9,10 @@ class AutoComplete { bool active; char stopChars[256]; + char fillUpChars[256]; char separator; public: + bool ignoreCase; ListBox lb; int posStart; int startLen; @@ -30,6 +32,10 @@ public: void SetStopChars(const char *stopChars_); bool IsStopChar(char ch); + // The fillup chars are characters which, when typed, fill up the selected word + void SetFillUpChars(const char *fillUpChars_); + bool IsFillUpChar(char ch); + // The separator character is used when interpreting the list in SetList void SetSeparator(char separator_); char GetSeparator(); diff --git a/src/Editor.cxx b/src/Editor.cxx index 44e28dbc2..6969458d3 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -988,7 +988,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis for (int indica = 0; indica <= INDIC_MAX; indica++) indStart[indica] = 0; - for (int indicPos = 0; indicPos <= ll.numCharsInLine; indicPos++) { + for (int indicPos = 0; indicPos < ll.numCharsInLine; indicPos++) { if (ll.indicators[indicPos] != ll.indicators[indicPos + 1]) { int mask = 1 << pdoc->stylingBits; for (int indicnum = 0; mask < 0x100; indicnum++) { @@ -1718,6 +1718,13 @@ void Editor::NotifyModifyAttempt(Document*, void *) { NotifyModifyAttempt(); } +void Editor::NotifyMove(int position) { + SCNotification scn; + scn.nmhdr.code = SCN_POSCHANGED; + scn.position = position; + NotifyParent(scn); +} + void Editor::NotifySavePoint(Document*, void *, bool atSavePoint) { //Platform::DebugPrintf("** Save Point %s\n", atSavePoint ? "On" : "Off"); NotifySavePoint(atSavePoint); @@ -2122,6 +2129,7 @@ int Editor::KeyCommand(unsigned int iMessage) { inOverstrike = !inOverstrike; DropCaret(); ShowCaretAtCurrentPosition(); + NotifyUpdateUI(); break; case SCI_CANCEL: // Cancel any modes - handled in subclass // Also unselect text @@ -4222,6 +4230,13 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) { case SCI_SELECTIONISRECTANGLE: return (selType == selRectangle) ? 1 : 0; + case SCI_SETOVERTYPE: + inOverstrike = wParam; + break; + + case SCI_GETOVERTYPE: + return inOverstrike ? TRUE : FALSE; + #ifdef MACRO_SUPPORT case SCI_STARTRECORD: recordingMacro = 1; diff --git a/src/Editor.h b/src/Editor.h index 5b79f2ede..83967cfd6 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -178,7 +178,7 @@ protected: // ScintillaBase subclass needs access to much of Editor void SetSelection(int currentPos_, int anchor_); void SetSelection(int currentPos_); void SetEmptySelection(int currentPos_); - int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true); + int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true); int MovePositionTo(int newPos, bool extend = false); int MovePositionSoVisible(int pos, int moveDir); void SetLastXChosen(); @@ -228,6 +228,7 @@ protected: // ScintillaBase subclass needs access to much of Editor virtual void NotifyParent(SCNotification scn) = 0; virtual void NotifyStyleToNeeded(int endStyleNeeded); void NotifyChar(char ch); + void NotifyMove(int position); void NotifySavePoint(bool isSavePoint); void NotifyModifyAttempt(); virtual void NotifyDoubleClick(Point pt, bool shift); diff --git a/src/LexOthers.cxx b/src/LexOthers.cxx index 90f41e3bf..edbf5d06f 100644 --- a/src/LexOthers.cxx +++ b/src/LexOthers.cxx @@ -49,6 +49,46 @@ static void ColouriseBatchDoc(unsigned int startPos, int length, int, WordList * ColouriseBatchLine(lineBuffer, startPos + length, styler); } +static void ColouriseDiffLine(char *lineBuffer, int endLine, Accessor &styler) { + // It is needed to remember the current state to recognize starting + // comment lines before the first "diff " or "--- ". If a real + // difference starts then each line starting with ' ' is a whitespace + // otherwise it is considered a comment (Only in..., Binary file...) + if (0 == strncmp(lineBuffer, "diff ", 3)) { + styler.ColourTo(endLine, 2); + } else if (0 == strncmp(lineBuffer, "--- ", 3)) { + styler.ColourTo(endLine, 3); + } else if (0 == strncmp(lineBuffer, "+++ ", 3)) { + styler.ColourTo(endLine, 3); + } else if (lineBuffer[0] == '@') { + styler.ColourTo(endLine, 4); + } else if (lineBuffer[0] == '-') { + styler.ColourTo(endLine, 5); + } else if (lineBuffer[0] == '+') { + styler.ColourTo(endLine, 6); + } else if (lineBuffer[0] != ' ') { + styler.ColourTo(endLine, 1); + } else { + styler.ColourTo(endLine, 0); + } +} + +static void ColouriseDiffDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) { + char lineBuffer[1024]; + styler.StartAt(startPos); + styler.StartSegment(startPos); + unsigned int linePos = 0; + for (unsigned int i = startPos; i < startPos + length; i++) { + lineBuffer[linePos++] = styler[i]; + if (styler[i] == '\r' || styler[i] == '\n' || (linePos >= sizeof(lineBuffer) - 1)) { + ColouriseDiffLine(lineBuffer, i, styler); + linePos = 0; + } + } + if (linePos > 0) + ColouriseDiffLine(lineBuffer, startPos + length, styler); +} + static void ColourisePropsLine(char *lineBuffer, int lengthLine, int startLine, int endPos, Accessor &styler) { int i = 0; while (isspace(lineBuffer[i]) && (i < lengthLine)) // Skip initial spaces @@ -297,8 +337,9 @@ static void ColouriseLatexDoc(unsigned int startPos, int length, int initStyle, styler.ColourTo(lengthDoc, state); } +LexerModule lmBatch(SCLEX_BATCH, ColouriseBatchDoc); +LexerModule lmDiff(SCLEX_DIFF, ColouriseDiffDoc); LexerModule lmProps(SCLEX_PROPERTIES, ColourisePropsDoc); -LexerModule lmErrorList(SCLEX_ERRORLIST, ColouriseErrorListDoc); LexerModule lmMake(SCLEX_MAKEFILE, ColouriseMakeDoc); -LexerModule lmBatch(SCLEX_BATCH, ColouriseBatchDoc); +LexerModule lmErrorList(SCLEX_ERRORLIST, ColouriseErrorListDoc); LexerModule lmLatex(SCLEX_LATEX, ColouriseLatexDoc); diff --git a/src/PropSet.cxx b/src/PropSet.cxx index c9aa71b5e..60e6922a6 100644 --- a/src/PropSet.cxx +++ b/src/PropSet.cxx @@ -333,7 +333,7 @@ static bool iswordsep(char ch, bool onlyLineEnds) { // Creates an array that points into each word in the string and puts \0 terminators // after each word. -static char **ArrayFromWordList(char *wordlist, bool onlyLineEnds = false) { +static char **ArrayFromWordList(char *wordlist, int *len, bool onlyLineEnds = false) { char prev = '\n'; int words = 0; for (int j = 0; wordlist[j]; j++) { @@ -345,8 +345,8 @@ static char **ArrayFromWordList(char *wordlist, bool onlyLineEnds = false) { if (keywords) { words = 0; prev = '\0'; - int len = strlen(wordlist); - for (int k = 0; k < len; k++) { + int slen = strlen(wordlist); + for (int k = 0; k < slen; k++) { if (!iswordsep(wordlist[k], onlyLineEnds)) { if (!prev) { keywords[words] = &wordlist[k]; @@ -357,7 +357,10 @@ static char **ArrayFromWordList(char *wordlist, bool onlyLineEnds = false) { } prev = wordlist[k]; } - keywords[words] = &wordlist[len]; + keywords[words] = &wordlist[slen]; + *len = words; + } else { + *len = 0; } return keywords; } @@ -370,12 +373,13 @@ void WordList::Clear() { words = 0; list = 0; len = 0; + sorted = false; } void WordList::Set(const char *s) { - len = 0; list = StringDup(s); - words = ArrayFromWordList(list, onlyLineEnds); + sorted = false; + words = ArrayFromWordList(list, &len, onlyLineEnds); } char *WordList::Allocate(int size) { @@ -385,10 +389,11 @@ char *WordList::Allocate(int size) { } void WordList::SetFromAllocated() { - len = 0; - words = ArrayFromWordList(list, onlyLineEnds); + sorted = false; + words = ArrayFromWordList(list, &len, onlyLineEnds); } +#ifdef __MINGW32__ // Shell sort based upon public domain C implementation by Raymond Gardner 1991 // Used here because of problems with mingw qsort. static void SortWordList(char **words, unsigned int len) { @@ -416,13 +421,19 @@ static void SortWordList(char **words, unsigned int len) { gap = gap / 2; } } +#else +// traditional qsort - hope it works elsewhere... +static void SortWordList(char **words, unsigned int len) { + qsort (reinterpret_cast<void*>(words), len, sizeof(*words), + reinterpret_cast<int (*)(const void*, const void*)>(strcmp)); +} +#endif bool WordList::InList(const char *s) { if (0 == words) return false; - if (len == 0) { - for (int i = 0; words[i][0]; i++) - len++; + if (!sorted) { + sorted = true; SortWordList(words, len); for (unsigned int k = 0; k < (sizeof(starts) / sizeof(starts[0])); k++) starts[k] = -1; diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index 8d42f0b7b..bf81887f2 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -11,9 +11,9 @@ #include "Platform.h" #include "Scintilla.h" +#include "PropSet.h" #ifdef SCI_LEXER #include "SciLexer.h" -#include "PropSet.h" #include "Accessor.h" #include "WindowAccessor.h" #include "DocumentAccessor.h" @@ -60,6 +60,8 @@ void ScintillaBase::RefreshColourPalette(Palette &pal, bool want) { void ScintillaBase::AddCharUTF(char *s, unsigned int len) { bool acActiveBeforeCharAdded = ac.Active(); + if (!acActiveBeforeCharAdded || !ac.IsFillUpChar(*s)) + Editor::AddCharUTF(s, len); Editor::AddCharUTF(s, len); if (acActiveBeforeCharAdded) AutoCompleteChanged(s[0]); @@ -136,6 +138,9 @@ int ScintillaBase::KeyCommand(unsigned int iMessage) { case SCI_TAB: AutoCompleteCompleted(); return 0; + case SCI_NEWLINE: + AutoCompleteCompleted(); + return 0; default: ac.Cancel(); @@ -238,7 +243,9 @@ void ScintillaBase::AutoCompleteMoveToCurrentWord() { } void ScintillaBase::AutoCompleteChanged(char ch) { - if (currentPos <= ac.posStart - ac.startLen) { + if (ac.IsFillUpChar(ch)) { + AutoCompleteCompleted(ch); + } else if (currentPos <= ac.posStart - ac.startLen) { ac.Cancel(); } else if (ac.cancelAtStartPos && currentPos <= ac.posStart) { ac.Cancel(); @@ -249,20 +256,39 @@ void ScintillaBase::AutoCompleteChanged(char ch) { } } -void ScintillaBase::AutoCompleteCompleted() { +void ScintillaBase::AutoCompleteCompleted(char fillUp/*='\0'*/) { int item = ac.lb.GetSelection(); char selected[1000]; if (item != -1) { ac.lb.GetValue(item, selected, sizeof(selected)); } ac.Cancel(); - if (currentPos != ac.posStart) { - pdoc->DeleteChars(ac.posStart, currentPos - ac.posStart); - } - SetEmptySelection(ac.posStart); - if (item != -1) { - pdoc->InsertString(currentPos, selected + ac.startLen); - SetEmptySelection(currentPos + strlen(selected + ac.startLen)); + + if (ac.ignoreCase) { + if (currentPos != ac.posStart) { + pdoc->DeleteChars(ac.posStart, currentPos - ac.posStart); + } + SetEmptySelection(ac.posStart - ac.startLen); + pdoc->DeleteChars(ac.posStart - ac.startLen, ac.startLen); + if (item != -1) { + SString piece = selected; + if (fillUp) + piece += fillUp; + pdoc->InsertString(currentPos, piece.c_str()); + SetEmptySelection(currentPos + piece.length()); + } + } else { + if (currentPos != ac.posStart) { + pdoc->DeleteChars(ac.posStart, currentPos - ac.posStart); + } + SetEmptySelection(ac.posStart); + if (item != -1) { + SString piece = selected + ac.startLen; + if (fillUp) + piece += fillUp; + pdoc->InsertString(currentPos, piece.c_str()); + SetEmptySelection(currentPos + piece.length()); + } } } @@ -366,6 +392,10 @@ long ScintillaBase::WndProc(unsigned int iMessage, unsigned long wParam, long lP case SCI_AUTOCGETCANCELATSTART: return ac.cancelAtStartPos; + case SCI_AUTOCSETFILLUPS: + ac.SetFillUpChars(reinterpret_cast<char *>(lParam)); + break; + case SCI_CALLTIPSHOW: { AutoCompleteCancel(); if (!ct.wCallTip.Created()) { diff --git a/src/ScintillaBase.h b/src/ScintillaBase.h index 80db7137e..e630ba1aa 100644 --- a/src/ScintillaBase.h +++ b/src/ScintillaBase.h @@ -54,7 +54,7 @@ protected: void AutoCompleteCancel(); void AutoCompleteMove(int delta); void AutoCompleteChanged(char ch=0); - void AutoCompleteCompleted(); + void AutoCompleteCompleted(char fillUp='\0'); void AutoCompleteMoveToCurrentWord(); virtual void CreateCallTipWindow(PRectangle rc) = 0; diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 02e626ee1..4b1d1863c 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -1397,6 +1397,8 @@ STDMETHODIMP ScintillaWin::Drop(LPDATAOBJECT pIDataSource, DWORD grfKeyState, // Free data if (medium.pUnkForRelease != NULL) medium.pUnkForRelease->Release(); + else + ::GlobalFree(medium.hGlobal); if (udata) delete []data; |