diff options
-rw-r--r-- | lexlib/WordList.cxx | 2 | ||||
-rw-r--r-- | src/Editor.cxx | 9 | ||||
-rw-r--r-- | src/Editor.h | 2 | ||||
-rw-r--r-- | src/ScintillaBase.cxx | 2 | ||||
-rw-r--r-- | win32/PlatWin.cxx | 21 | ||||
-rw-r--r-- | win32/ScintillaWin.cxx | 2 |
6 files changed, 24 insertions, 14 deletions
diff --git a/lexlib/WordList.cxx b/lexlib/WordList.cxx index 982d520d6..51d68a659 100644 --- a/lexlib/WordList.cxx +++ b/lexlib/WordList.cxx @@ -103,7 +103,7 @@ void WordList::Clear() { #ifdef _MSC_VER static bool cmpWords(const char *a, const char *b) { - return strcmp(a, b) == -1; + return strcmp(a, b) < 0; } #else diff --git a/src/Editor.cxx b/src/Editor.cxx index 859ae180c..c13a5fd9d 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -200,6 +200,8 @@ Editor::Editor() { theEdge = 0; paintState = notPainting; + paintAbandonedByStyling = false; + paintingAllText = false; willRedrawAll = false; modEventMask = SC_MODEVENTMASKALL; @@ -2500,11 +2502,9 @@ void Editor::DrawWrapMarker(Surface *surface, PRectangle rcPlace, int w = rcPlace.right - rcPlace.left - xa - 1; bool xStraight = isEndMarker; // x-mirrored symbol for start marker - bool yStraight = true; - //bool yStraight= isEndMarker; // comment in for start marker y-mirrowed int x0 = xStraight ? rcPlace.left : rcPlace.right - 1; - int y0 = yStraight ? rcPlace.top : rcPlace.bottom - 1; + int y0 = rcPlace.top; int dy = (rcPlace.bottom - rcPlace.top) / 5; int y = (rcPlace.bottom - rcPlace.top) / 2 + dy; @@ -2522,7 +2522,7 @@ void Editor::DrawWrapMarker(Surface *surface, PRectangle rcPlace, surface->LineTo(xBase + xDir * xRelative, yBase + yDir * yRelative); } }; - Relative rel = {surface, x0, xStraight ? 1 : -1, y0, yStraight ? 1 : -1}; + Relative rel = {surface, x0, xStraight ? 1 : -1, y0, 1}; // arrow head rel.MoveTo(xa, y); @@ -9151,6 +9151,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { sel.selType = Selection::selStream; } InvalidateSelection(sel.RangeMain(), true); + break; } case SCI_GETSELECTIONMODE: switch (sel.selType) { diff --git a/src/Editor.h b/src/Editor.h index d1879d6ec..52d38afc4 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -525,7 +525,7 @@ protected: // ScintillaBase subclass needs access to much of Editor void ContainerNeedsUpdate(int flags); void PageMove(int direction, Selection::selTypes sel=Selection::noSel, bool stuttered = false); - enum { cmSame, cmUpper, cmLower } caseMap; + enum { cmSame, cmUpper, cmLower }; virtual std::string CaseMapString(const std::string &s, int caseMapping); void ChangeCaseOfSelection(int caseMapping); void LineTranspose(); diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index 05768799d..814eac726 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -262,7 +262,7 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) { ac.lb->SetAverageCharWidth(aveCharWidth); ac.lb->SetDoubleClickAction(AutoCompleteDoubleClick, this); - ac.SetList(list); + ac.SetList(list ? list : ""); // Fiddle the position of the list so it is right next to the target and wide enough for all its strings PRectangle rcList = ac.lb->GetDesiredRect(); diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 16854f254..97d7eddb5 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -285,6 +285,7 @@ static void SetLogFont(LOGFONTA &lf, const char *faceName, int characterSet, flo lf.lfCharSet = static_cast<BYTE>(characterSet); lf.lfQuality = Win32MapFontQuality(extraFontFlag); strncpy(lf.lfFaceName, faceName, sizeof(lf.lfFaceName)); + lf.lfFaceName[sizeof(lf.lfFaceName)-1] = '\0'; } /** @@ -2270,12 +2271,15 @@ PRectangle ListBoxX::GetDesiredRect() { HDC hdc = ::GetDC(lb); HFONT oldFont = SelectFont(hdc, fontCopy); SIZE textSize = {0, 0}; - int len = static_cast<int>(widestItem ? strlen(widestItem) : 0); - if (unicodeMode) { - const TextWide tbuf(widestItem, len, unicodeMode); - ::GetTextExtentPoint32W(hdc, tbuf.buffer, tbuf.tlen, &textSize); - } else { - ::GetTextExtentPoint32A(hdc, widestItem, len, &textSize); + int len = 0; + if (widestItem) { + len = static_cast<int>(strlen(widestItem)); + if (unicodeMode) { + const TextWide tbuf(widestItem, len, unicodeMode); + ::GetTextExtentPoint32W(hdc, tbuf.buffer, tbuf.tlen, &textSize); + } else { + ::GetTextExtentPoint32A(hdc, widestItem, len, &textSize); + } } TEXTMETRIC tm; ::GetTextMetrics(hdc, &tm); @@ -2439,7 +2443,11 @@ void ListBoxX::Draw(DRAWITEMSTRUCT *pDrawItem) { delete surfaceItem; pDCRT->EndDraw(); pDCRT->Release(); + } else { + delete surfaceItem; } + } else { + delete surfaceItem; } #endif } @@ -2991,6 +2999,7 @@ ElapsedTime::ElapsedTime() { littleBit = timeVal.LowPart; } else { bigBit = clock(); + littleBit = 0; } } diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 2386f1c48..8d7be0629 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -2132,7 +2132,7 @@ void ScintillaWin::ImeStartComposition() { lf.lfItalic = static_cast<BYTE>(vs.styles[styleHere].italic ? 1 : 0); lf.lfCharSet = DEFAULT_CHARSET; lf.lfFaceName[0] = '\0'; - if (vs.styles[styleHere].fontName) + if (vs.styles[styleHere].fontName && (strlen(vs.styles[styleHere].fontName) < sizeof(lf.lfFaceName))) strcpy(lf.lfFaceName, vs.styles[styleHere].fontName); ::ImmSetCompositionFontA(hIMC, &lf); |