diff options
Diffstat (limited to 'src/scintilla_backports/6311_7030530a9a0f.patch')
-rw-r--r-- | src/scintilla_backports/6311_7030530a9a0f.patch | 1480 |
1 files changed, 1480 insertions, 0 deletions
diff --git a/src/scintilla_backports/6311_7030530a9a0f.patch b/src/scintilla_backports/6311_7030530a9a0f.patch new file mode 100644 index 00000000..dc85a84d --- /dev/null +++ b/src/scintilla_backports/6311_7030530a9a0f.patch @@ -0,0 +1,1480 @@ +# HG changeset patch +# User Neil <nyamatongwe@gmail.com> +# Date 1497232196 -36000 +# Node ID 7030530a9a0f4fc1203a04378e83d82f0c35e7a0 +# Parent 7e28cdba6d61e090ac6f6627c855ffd2603508e4 +Removed unused functions and methods from Platform.h. +Replaced Platform::Clamp with Sci::clamp but will later change this to +std::clamp once on full C++17 compilers. +Drop MouseButtonBounce workaround for very early GTK+/Linux. + +diff -r 7e28cdba6d61 -r 7030530a9a0f cocoa/PlatCocoa.mm +--- a/cocoa/PlatCocoa.mm Sun Jun 11 14:08:43 2017 +1000 ++++ b/cocoa/PlatCocoa.mm Mon Jun 12 11:49:56 2017 +1000 +@@ -83,18 +83,6 @@ + return rc; + } + +-//----------------- Point -------------------------------------------------------------------------- +- +-/** +- * Converts a point given as a long into a native Point structure. +- */ +-Scintilla::Point Scintilla::Point::FromLong(long lpoint) { +- return Scintilla::Point( +- Platform::LowShortFromLong(lpoint), +- Platform::HighShortFromLong(lpoint) +- ); +-} +- + //----------------- Font --------------------------------------------------------------------------- + + Font::Font(): fid(0) { +@@ -921,7 +909,7 @@ + } else if (codePage) { + int ui = 0; + for (int i=0; i<len;) { +- size_t lenChar = Platform::IsDBCSLeadByte(codePage, s[i]) ? 2 : 1; ++ size_t lenChar = DBCSIsLeadByte(codePage, s[i]) ? 2 : 1; + CGFloat xPosition = CTLineGetOffsetForStringIndex(mLine, ui+1, NULL); + for (unsigned int bytePos=0; (bytePos<lenChar) && (i<len); bytePos++) { + positions[i++] = static_cast<XYPOSITION>(xPosition); +@@ -984,15 +972,6 @@ + return 0; + } + +-XYPOSITION SurfaceImpl::ExternalLeading(Font &font_) { +- if (!font_.GetID()) +- return 1; +- +- float leading = static_cast<QuartzTextStyle *>(font_.GetID())->getLeading(); +- return leading + 0.5f; +- +-} +- + XYPOSITION SurfaceImpl::Height(Font &font_) { + + return Ascent(font_) + Descent(font_); +@@ -1043,13 +1022,6 @@ + + //-------------------------------------------------------------------------------------------------- + +-bool Window::HasFocus() { +- NSView *container = (__bridge NSView *)(wid); +- return container.window.firstResponder == container; +-} +- +-//-------------------------------------------------------------------------------------------------- +- + static CGFloat ScreenMax() { + return NSMaxY([NSScreen mainScreen].frame); + } +@@ -1205,19 +1177,6 @@ + + //-------------------------------------------------------------------------------------------------- + +-void Window::SetTitle(const char *s) { +- if (wid) { +- id idWin = (__bridge id)(wid); +- if ([idWin isKindOfClass: [NSWindow class]]) { +- NSWindow *win = idWin; +- NSString *sTitle = @(s); +- win.title = sTitle; +- } +- } +-} +- +-//-------------------------------------------------------------------------------------------------- +- + PRectangle Window::GetMonitorRect(Point) { + if (wid) { + id idWin = (__bridge id)(wid); +@@ -1897,85 +1856,6 @@ + + //-------------------------------------------------------------------------------------------------- + +-bool Platform::MouseButtonBounce() { +- return false; +-} +- +-//-------------------------------------------------------------------------------------------------- +- +-/** +- * Helper method for the backend to reach through to the scintilla window. +- */ +-long Platform::SendScintilla(WindowID w, unsigned int msg, unsigned long wParam, long lParam) { +- return scintilla_send_message(w, msg, wParam, lParam); +-} +- +-//-------------------------------------------------------------------------------------------------- +- +-/** +- * Helper method for the backend to reach through to the scintilla window. +- */ +-long Platform::SendScintillaPointer(WindowID w, unsigned int msg, unsigned long wParam, void *lParam) { +- return scintilla_send_message(w, msg, wParam, (long) lParam); +-} +- +-//-------------------------------------------------------------------------------------------------- +- +-bool Platform::IsDBCSLeadByte(int codePage, char ch) { +- // Byte ranges found in Wikipedia articles with relevant search strings in each case +- unsigned char uch = static_cast<unsigned char>(ch); +- switch (codePage) { +- case 932: +- // Shift_jis +- return ((uch >= 0x81) && (uch <= 0x9F)) || +- ((uch >= 0xE0) && (uch <= 0xFC)); +- // Lead bytes F0 to FC may be a Microsoft addition. +- case 936: +- // GBK +- return (uch >= 0x81) && (uch <= 0xFE); +- case 949: +- // Korean Wansung KS C-5601-1987 +- return (uch >= 0x81) && (uch <= 0xFE); +- case 950: +- // Big5 +- return (uch >= 0x81) && (uch <= 0xFE); +- case 1361: +- // Korean Johab KS C-5601-1992 +- return +- ((uch >= 0x84) && (uch <= 0xD3)) || +- ((uch >= 0xD8) && (uch <= 0xDE)) || +- ((uch >= 0xE0) && (uch <= 0xF9)); +- } +- return false; +-} +- +-//-------------------------------------------------------------------------------------------------- +- +-int Platform::DBCSCharLength(int /* codePage */, const char * /* s */) { +- // DBCS no longer uses this. +- return 1; +-} +- +-//-------------------------------------------------------------------------------------------------- +- +-int Platform::DBCSCharMaxLength() { +- return 2; +-} +- +-//-------------------------------------------------------------------------------------------------- +- +-int Platform::Minimum(int a, int b) { +- return (a < b) ? a : b; +-} +- +-//-------------------------------------------------------------------------------------------------- +- +-int Platform::Maximum(int a, int b) { +- return (a > b) ? a : b; +-} +- +-//-------------------------------------------------------------------------------------------------- +- + //#define TRACE + #ifdef TRACE + +@@ -2026,16 +1906,6 @@ + #endif + } + +-//-------------------------------------------------------------------------------------------------- +- +-int Platform::Clamp(int val, int minVal, int maxVal) { +- if (val > maxVal) +- val = maxVal; +- if (val < minVal) +- val = minVal; +- return val; +-} +- + //----------------- DynamicLibrary ----------------------------------------------------------------- + + /** +diff -r 7e28cdba6d61 -r 7030530a9a0f cocoa/ScintillaCocoa.h +--- a/cocoa/ScintillaCocoa.h Sun Jun 11 14:08:43 2017 +1000 ++++ b/cocoa/ScintillaCocoa.h Mon Jun 12 11:49:56 2017 +1000 +@@ -52,6 +52,7 @@ + #include "Document.h" + #include "CaseConvert.h" + #include "UniConversion.h" ++#include "DBCS.h" + #include "Selection.h" + #include "PositionCache.h" + #include "EditModel.h" +diff -r 7e28cdba6d61 -r 7030530a9a0f cocoa/ScintillaFramework/ScintillaFramework.xcodeproj/project.pbxproj +--- a/cocoa/ScintillaFramework/ScintillaFramework.xcodeproj/project.pbxproj Sun Jun 11 14:08:43 2017 +1000 ++++ b/cocoa/ScintillaFramework/ScintillaFramework.xcodeproj/project.pbxproj Mon Jun 12 11:49:56 2017 +1000 +@@ -199,6 +199,7 @@ + 280056FC188DDD2C00F200AE /* StringCopy.h in Headers */ = {isa = PBXBuildFile; fileRef = 280056F9188DDD2C00F200AE /* StringCopy.h */; }; + 280056FD188DDD2C00F200AE /* SubStyles.h in Headers */ = {isa = PBXBuildFile; fileRef = 280056FA188DDD2C00F200AE /* SubStyles.h */; }; + 28064A05190F12E100E6E47F /* LexDMIS.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28064A04190F12E100E6E47F /* LexDMIS.cxx */; }; ++ 28804B2C1EEE232E00C0D154 /* DBCS.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28804B2B1EEE232E00C0D154 /* DBCS.cxx */; }; + 28A067111A36B42600B4966A /* LexHex.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28A067101A36B42600B4966A /* LexHex.cxx */; }; + 28A1DD51196BE0CA006EFCDD /* EditModel.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28A1DD4E196BE0CA006EFCDD /* EditModel.cxx */; }; + 28A1DD52196BE0CA006EFCDD /* EditView.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28A1DD4F196BE0CA006EFCDD /* EditView.cxx */; }; +@@ -423,6 +424,7 @@ + 280056FA188DDD2C00F200AE /* SubStyles.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SubStyles.h; path = ../../lexlib/SubStyles.h; sourceTree = "<group>"; }; + 28064A04190F12E100E6E47F /* LexDMIS.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexDMIS.cxx; path = ../../lexers/LexDMIS.cxx; sourceTree = "<group>"; }; + 282E41F3B9E2BFEDD6A05BE7 /* LexIndent.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexIndent.cxx; path = ../../lexers/LexIndent.cxx; sourceTree = SOURCE_ROOT; }; ++ 28804B2B1EEE232E00C0D154 /* DBCS.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DBCS.cxx; path = ../../src/DBCS.cxx; sourceTree = "<group>"; }; + 28A067101A36B42600B4966A /* LexHex.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexHex.cxx; path = ../../lexers/LexHex.cxx; sourceTree = "<group>"; }; + 28A1DD4E196BE0CA006EFCDD /* EditModel.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = EditModel.cxx; path = ../../src/EditModel.cxx; sourceTree = "<group>"; }; + 28A1DD4F196BE0CA006EFCDD /* EditView.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = EditView.cxx; path = ../../src/EditView.cxx; sourceTree = "<group>"; }; +@@ -724,6 +726,7 @@ + 114B6F8F11FA75BE004FB6AB /* CharacterSet.cxx */, + 114B6F6411FA7597004FB6AB /* CharClassify.cxx */, + 114B6F6511FA7597004FB6AB /* ContractionState.cxx */, ++ 28804B2B1EEE232E00C0D154 /* DBCS.cxx */, + 114B6F6611FA7597004FB6AB /* Decoration.cxx */, + 114B6F6711FA7597004FB6AB /* Document.cxx */, + 28A1DD4E196BE0CA006EFCDD /* EditModel.cxx */, +@@ -1010,6 +1013,7 @@ + 114B6F3911FA7526004FB6AB /* LexMySQL.cxx in Sources */, + 114B6F3A11FA7526004FB6AB /* LexNimrod.cxx in Sources */, + 114B6F3B11FA7526004FB6AB /* LexNsis.cxx in Sources */, ++ 28804B2C1EEE232E00C0D154 /* DBCS.cxx in Sources */, + 114B6F3C11FA7526004FB6AB /* LexOpal.cxx in Sources */, + 114B6F3E11FA7526004FB6AB /* LexPascal.cxx in Sources */, + 28B6470D1B54C0720009DC49 /* LexDiff.cxx in Sources */, +diff -r 7e28cdba6d61 -r 7030530a9a0f gtk/PlatGTK.cxx +--- a/gtk/PlatGTK.cxx Sun Jun 11 14:08:43 2017 +1000 ++++ b/gtk/PlatGTK.cxx Mon Jun 12 11:49:56 2017 +1000 +@@ -107,12 +107,6 @@ + return static_cast<GtkWidget *>(wid); + } + +-Point Point::FromLong(long lpoint) { +- return Point( +- Platform::LowShortFromLong(lpoint), +- Platform::HighShortFromLong(lpoint)); +-} +- + Font::Font() : fid(0) {} + + Font::~Font() {} +@@ -184,7 +178,6 @@ + XYPOSITION Ascent(Font &font_); + XYPOSITION Descent(Font &font_); + XYPOSITION InternalLeading(Font &font_); +- XYPOSITION ExternalLeading(Font &font_); + XYPOSITION Height(Font &font_); + XYPOSITION AverageCharWidth(Font &font_); + +@@ -925,10 +918,6 @@ + return 0; + } + +-XYPOSITION SurfaceImpl::ExternalLeading(Font &) { +- return 0; +-} +- + XYPOSITION SurfaceImpl::Height(Font &font_) { + return Ascent(font_) + Descent(font_); + } +@@ -978,10 +967,6 @@ + } + } + +-bool Window::HasFocus() { +- return gtk_widget_has_focus(GTK_WIDGET(wid)); +-} +- + PRectangle Window::GetPosition() { + // Before any size allocated pretend its 1000 wide so not scrolled + PRectangle rc(0, 0, 1000, 1000); +@@ -1125,10 +1110,6 @@ + #endif + } + +-void Window::SetTitle(const char *s) { +- gtk_window_set_title(GTK_WINDOW(wid), s); +-} +- + /* Returns rectangle of monitor pt is on, both rect and pt are in Window's + gdk window coordinates */ + PRectangle Window::GetMonitorRect(Point pt) { +@@ -2025,83 +2006,10 @@ + return 500; // Half a second + } + +-bool Platform::MouseButtonBounce() { +- return true; +-} +- + void Platform::DebugDisplay(const char *s) { + fprintf(stderr, "%s", s); + } + +-bool Platform::IsKeyDown(int) { +- // TODO: discover state of keys in GTK+/X +- return false; +-} +- +-long Platform::SendScintilla( +- WindowID w, unsigned int msg, unsigned long wParam, long lParam) { +- return scintilla_send_message(SCINTILLA(w), msg, wParam, lParam); +-} +- +-long Platform::SendScintillaPointer( +- WindowID w, unsigned int msg, unsigned long wParam, void *lParam) { +- return scintilla_send_message(SCINTILLA(w), msg, wParam, +- reinterpret_cast<sptr_t>(lParam)); +-} +- +-bool Platform::IsDBCSLeadByte(int codePage, char ch) { +- // Byte ranges found in Wikipedia articles with relevant search strings in each case +- unsigned char uch = static_cast<unsigned char>(ch); +- switch (codePage) { +- case 932: +- // Shift_jis +- return ((uch >= 0x81) && (uch <= 0x9F)) || +- ((uch >= 0xE0) && (uch <= 0xFC)); +- // Lead bytes F0 to FC may be a Microsoft addition. +- case 936: +- // GBK +- return (uch >= 0x81) && (uch <= 0xFE); +- case 950: +- // Big5 +- return (uch >= 0x81) && (uch <= 0xFE); +- // Korean EUC-KR may be code page 949. +- } +- return false; +-} +- +-int Platform::DBCSCharLength(int codePage, const char *s) { +- if (codePage == 932 || codePage == 936 || codePage == 950) { +- return IsDBCSLeadByte(codePage, s[0]) ? 2 : 1; +- } else { +- int bytes = mblen(s, MB_CUR_MAX); +- if (bytes >= 1) +- return bytes; +- else +- return 1; +- } +-} +- +-int Platform::DBCSCharMaxLength() { +- return MB_CUR_MAX; +- //return 2; +-} +- +-// These are utility functions not really tied to a platform +- +-int Platform::Minimum(int a, int b) { +- if (a < b) +- return a; +- else +- return b; +-} +- +-int Platform::Maximum(int a, int b) { +- if (a > b) +- return a; +- else +- return b; +-} +- + //#define TRACE + + #ifdef TRACE +@@ -2134,14 +2042,6 @@ + abort(); + } + +-int Platform::Clamp(int val, int minVal, int maxVal) { +- if (val > maxVal) +- val = maxVal; +- if (val < minVal) +- val = minVal; +- return val; +-} +- + void Platform_Initialise() { + } + +diff -r 7e28cdba6d61 -r 7030530a9a0f gtk/makefile +--- a/gtk/makefile Sun Jun 11 14:08:43 2017 +1000 ++++ b/gtk/makefile Mon Jun 12 11:49:56 2017 +1000 +@@ -78,7 +78,7 @@ + CTFLAGS=-DNDEBUG -Os $(CXXBASEFLAGS) $(THREADFLAGS) + endif + +-CXXTFLAGS:=--std=gnu++0x $(CTFLAGS) $(REFLAGS) ++CXXTFLAGS:=--std=gnu++17 $(CTFLAGS) $(REFLAGS) + + CONFIGFLAGS:=$(shell pkg-config --cflags $(GTKVERSION)) + MARSHALLER=scintilla-marshal.o +diff -r 7e28cdba6d61 -r 7030530a9a0f include/Platform.h +--- a/include/Platform.h Sun Jun 11 14:08:43 2017 +1000 ++++ b/include/Platform.h Mon Jun 12 11:49:56 2017 +1000 +@@ -109,8 +109,6 @@ + } + + // Other automatically defined methods (assignment, copy constructor, destructor) are fine +- +- static Point FromLong(long lpoint); + }; + + /** +@@ -332,7 +330,6 @@ + virtual XYPOSITION Ascent(Font &font_)=0; + virtual XYPOSITION Descent(Font &font_)=0; + virtual XYPOSITION InternalLeading(Font &font_)=0; +- virtual XYPOSITION ExternalLeading(Font &font_)=0; + virtual XYPOSITION Height(Font &font_)=0; + virtual XYPOSITION AverageCharWidth(Font &font_)=0; + +@@ -376,7 +373,6 @@ + WindowID GetID() const { return wid; } + bool Created() const { return wid != 0; } + void Destroy(); +- bool HasFocus(); + PRectangle GetPosition(); + void SetPosition(PRectangle rc); + void SetPositionRelative(PRectangle rc, Window relativeTo); +@@ -387,7 +383,6 @@ + virtual void SetFont(Font &font); + enum Cursor { cursorInvalid, cursorText, cursorArrow, cursorUp, cursorWait, cursorHoriz, cursorVert, cursorReverseArrow, cursorHand }; + void SetCursor(Cursor curs); +- void SetTitle(const char *s); + PRectangle GetMonitorRect(Point pt); + private: + Cursor cursorLast; +@@ -503,34 +498,14 @@ + static const char *DefaultFont(); + static int DefaultFontSize(); + static unsigned int DoubleClickTime(); +- static bool MouseButtonBounce(); + static void DebugDisplay(const char *s); +- static bool IsKeyDown(int key); +- static long SendScintilla( +- WindowID w, unsigned int msg, unsigned long wParam=0, long lParam=0); +- static long SendScintillaPointer( +- WindowID w, unsigned int msg, unsigned long wParam=0, void *lParam=0); +- static bool IsDBCSLeadByte(int codePage, char ch); +- static int DBCSCharLength(int codePage, const char *s); +- static int DBCSCharMaxLength(); +- +- // These are utility functions not really tied to a platform +- static int Minimum(int a, int b); +- static int Maximum(int a, int b); +- // Next three assume 16 bit shorts and 32 bit longs + static long LongFromTwoShorts(short a,short b) { + return (a) | ((b) << 16); + } +- static short HighShortFromLong(long x) { +- return static_cast<short>(x >> 16); +- } +- static short LowShortFromLong(long x) { +- return static_cast<short>(x & 0xffff); +- } ++ + static void DebugPrintf(const char *format, ...); + static bool ShowAssertionPopUps(bool assertionPopUps_); + static void Assert(const char *c, const char *file, int line) CLANG_ANALYZER_NORETURN; +- static int Clamp(int val, int minVal, int maxVal); + }; + + #ifdef NDEBUG +diff -r 7e28cdba6d61 -r 7030530a9a0f qt/ScintillaEdit/ScintillaEdit.pro +--- a/qt/ScintillaEdit/ScintillaEdit.pro Sun Jun 11 14:08:43 2017 +1000 ++++ b/qt/ScintillaEdit/ScintillaEdit.pro Mon Jun 12 11:49:56 2017 +1000 +@@ -10,18 +10,14 @@ + TARGET = ScintillaEdit + TEMPLATE = lib + CONFIG += lib_bundle +- +-unix { +- # <regex> requires C++11 support +- greaterThan(QT_MAJOR_VERSION, 4){ +- CONFIG += c++11 +- } else { +- QMAKE_CXXFLAGS += -std=c++0x +- } +-} ++CONFIG += c++14 + + VERSION = 3.7.5 + ++win32 { ++ QMAKE_CXXFLAGS += -std:c++latest ++} ++ + SOURCES += \ + ScintillaEdit.cpp \ + ScintillaDocument.cpp \ +@@ -48,6 +44,7 @@ + ../../src/EditModel.cxx \ + ../../src/Document.cxx \ + ../../src/Decoration.cxx \ ++ ../../src/DBCS.cxx \ + ../../src/ContractionState.cxx \ + ../../src/CharClassify.cxx \ + ../../src/CellBuffer.cxx \ +diff -r 7e28cdba6d61 -r 7030530a9a0f qt/ScintillaEditBase/PlatQt.cpp +--- a/qt/ScintillaEditBase/PlatQt.cpp Sun Jun 11 14:08:43 2017 +1000 ++++ b/qt/ScintillaEditBase/PlatQt.cpp Mon Jun 12 11:49:56 2017 +1000 +@@ -10,6 +10,7 @@ + + #include "PlatQt.h" + #include "Scintilla.h" ++#include "DBCS.h" + #include "FontQuality.h" + + #include <QApplication> +@@ -489,7 +490,7 @@ + // DBCS + int ui = 0; + for (int i=0; i<len;) { +- size_t lenChar = Platform::IsDBCSLeadByte(codePage, s[i]) ? 2 : 1; ++ size_t lenChar = DBCSIsLeadByte(codePage, s[i]) ? 2 : 1; + qreal xPosition = tl.cursorToX(ui+1); + for (unsigned int bytePos=0; (bytePos<lenChar) && (i<len); bytePos++) { + positions[i++] = xPosition; +@@ -539,12 +540,6 @@ + return 0; + } + +-XYPOSITION SurfaceImpl::ExternalLeading(Font &font) +-{ +- QFontMetricsF metrics(*FontPointer(font), device); +- return metrics.leading(); +-} +- + XYPOSITION SurfaceImpl::Height(Font &font) + { + QFontMetricsF metrics(*FontPointer(font), device); +@@ -625,11 +620,6 @@ + wid = 0; + } + +-bool Window::HasFocus() +-{ +- return wid ? window(wid)->hasFocus() : false; +-} +- + PRectangle Window::GetPosition() + { + // Before any size allocated pretend its 1000 wide so not scrolled +@@ -725,12 +715,6 @@ + } + } + +-void Window::SetTitle(const char *s) +-{ +- if (wid) +- window(wid)->setWindowTitle(s); +-} +- + /* Returns rectangle of monitor pt is on, both rect and pt are in Window's + window coordinates */ + PRectangle Window::GetMonitorRect(Point pt) +@@ -1201,47 +1185,6 @@ + return QApplication::doubleClickInterval(); + } + +-bool Platform::MouseButtonBounce() +-{ +- return false; +-} +- +-bool Platform::IsKeyDown(int /*key*/) +-{ +- return false; +-} +- +-long Platform::SendScintilla(WindowID /*w*/, +- unsigned int /*msg*/, +- unsigned long /*wParam*/, +- long /*lParam*/) +-{ +- return 0; +-} +- +-long Platform::SendScintillaPointer(WindowID /*w*/, +- unsigned int /*msg*/, +- unsigned long /*wParam*/, +- void * /*lParam*/) +-{ +- return 0; +-} +- +-int Platform::Minimum(int a, int b) +-{ +- return qMin(a, b); +-} +- +-int Platform::Maximum(int a, int b) +-{ +- return qMax(a, b); +-} +- +-int Platform::Clamp(int val, int minVal, int maxVal) +-{ +- return qBound(minVal, val, maxVal); +-} +- + void Platform::DebugDisplay(const char *s) + { + qWarning("Scintilla: %s", s); +@@ -1276,51 +1219,6 @@ + } + } + +- +-bool Platform::IsDBCSLeadByte(int codePage, char ch) +-{ +- // Byte ranges found in Wikipedia articles with relevant search strings in each case +- unsigned char uch = static_cast<unsigned char>(ch); +- switch (codePage) { +- case 932: +- // Shift_jis +- return ((uch >= 0x81) && (uch <= 0x9F)) || +- ((uch >= 0xE0) && (uch <= 0xEF)); +- case 936: +- // GBK +- return (uch >= 0x81) && (uch <= 0xFE); +- case 949: +- // Korean Wansung KS C-5601-1987 +- return (uch >= 0x81) && (uch <= 0xFE); +- case 950: +- // Big5 +- return (uch >= 0x81) && (uch <= 0xFE); +- case 1361: +- // Korean Johab KS C-5601-1992 +- return +- ((uch >= 0x84) && (uch <= 0xD3)) || +- ((uch >= 0xD8) && (uch <= 0xDE)) || +- ((uch >= 0xE0) && (uch <= 0xF9)); +- } +- return false; +-} +- +-int Platform::DBCSCharLength(int codePage, const char *s) +-{ +- if (codePage == 932 || codePage == 936 || codePage == 949 || +- codePage == 950 || codePage == 1361) { +- return IsDBCSLeadByte(codePage, s[0]) ? 2 : 1; +- } else { +- return 1; +- } +-} +- +-int Platform::DBCSCharMaxLength() +-{ +- return 2; +-} +- +- + //---------------------------------------------------------------------- + + static QElapsedTimer timer; +diff -r 7e28cdba6d61 -r 7030530a9a0f qt/ScintillaEditBase/PlatQt.h +--- a/qt/ScintillaEditBase/PlatQt.h Sun Jun 11 14:08:43 2017 +1000 ++++ b/qt/ScintillaEditBase/PlatQt.h Mon Jun 12 11:49:56 2017 +1000 +@@ -106,7 +106,6 @@ + XYPOSITION Ascent(Font &font) override; + XYPOSITION Descent(Font &font) override; + XYPOSITION InternalLeading(Font &font) override; +- XYPOSITION ExternalLeading(Font &font) override; + XYPOSITION Height(Font &font) override; + XYPOSITION AverageCharWidth(Font &font) override; + +diff -r 7e28cdba6d61 -r 7030530a9a0f qt/ScintillaEditBase/ScintillaEditBase.pro +--- a/qt/ScintillaEditBase/ScintillaEditBase.pro Sun Jun 11 14:08:43 2017 +1000 ++++ b/qt/ScintillaEditBase/ScintillaEditBase.pro Mon Jun 12 11:49:56 2017 +1000 +@@ -10,18 +10,14 @@ + TARGET = ScintillaEditBase + TEMPLATE = lib + CONFIG += lib_bundle +- +-unix { +- # <regex> requires C++11 support +- greaterThan(QT_MAJOR_VERSION, 4){ +- CONFIG += c++11 +- } else { +- QMAKE_CXXFLAGS += -std=c++0x +- } +-} ++CONFIG += c++14 + + VERSION = 3.7.5 + ++win32 { ++ QMAKE_CXXFLAGS += -std:c++latest ++} ++ + SOURCES += \ + PlatQt.cpp \ + ScintillaQt.cpp \ +@@ -46,6 +42,7 @@ + ../../src/EditModel.cxx \ + ../../src/Document.cxx \ + ../../src/Decoration.cxx \ ++ ../../src/DBCS.cxx \ + ../../src/ContractionState.cxx \ + ../../src/CharClassify.cxx \ + ../../src/CellBuffer.cxx \ +diff -r 7e28cdba6d61 -r 7030530a9a0f qt/ScintillaEditPy/ScintillaEditPy.pro +--- a/qt/ScintillaEditPy/ScintillaEditPy.pro Sun Jun 11 14:08:43 2017 +1000 ++++ b/qt/ScintillaEditPy/ScintillaEditPy.pro Mon Jun 12 11:49:56 2017 +1000 +@@ -6,21 +6,14 @@ + + # Clear debug & release so that sepbuild.pri can set one or the other + CONFIG -= debug release ++CONFIG += c++14 + + include(sepbuild.pri) + + VERSION = $$SCINTILLA_VERSION + +-unix { +- # <regex> requires C++11 support +- greaterThan(QT_MAJOR_VERSION, 4){ +- CONFIG += c++11 +- } else { +- QMAKE_CXXFLAGS += -std=c++0x -Wno-deprecated-declarations +- } +-} +- + win32 { ++ QMAKE_CXXFLAGS += -std:c++latest + DebugBuild { + TARGET_EXT = _d.pyd + } +diff -r 7e28cdba6d61 -r 7030530a9a0f scripts/HeaderOrder.txt +--- a/scripts/HeaderOrder.txt Sun Jun 11 14:08:43 2017 +1000 ++++ b/scripts/HeaderOrder.txt Mon Jun 12 11:49:56 2017 +1000 +@@ -129,6 +129,7 @@ + #include "CaseConvert.h" + #include "UniConversion.h" + #include "UnicodeFromUTF8.h" ++#include "DBCS.h" + #include "Selection.h" + #include "PositionCache.h" + #include "FontQuality.h" +diff -r 7e28cdba6d61 -r 7030530a9a0f src/DBCS.cxx +--- /dev/null Thu Jan 01 00:00:00 1970 +0000 ++++ b/src/DBCS.cxx Mon Jun 12 11:49:56 2017 +1000 +@@ -0,0 +1,48 @@ ++// Scintilla source code edit control ++/** @file DBCS.cxx ++ ** Functions to handle DBCS double byte encodings like Shift-JIS. ++ **/ ++// Copyright 2017 by Neil Hodgson <neilh@scintilla.org> ++// The License.txt file describes the conditions under which this software may be distributed. ++ ++#include "DBCS.h" ++ ++#ifdef SCI_NAMESPACE ++using namespace Scintilla; ++#endif ++ ++#ifdef SCI_NAMESPACE ++namespace Scintilla { ++#endif ++ ++bool DBCSIsLeadByte(int codePage, char ch) { ++ // Byte ranges found in Wikipedia articles with relevant search strings in each case ++ const unsigned char uch = static_cast<unsigned char>(ch); ++ switch (codePage) { ++ case 932: ++ // Shift_jis ++ return ((uch >= 0x81) && (uch <= 0x9F)) || ++ ((uch >= 0xE0) && (uch <= 0xFC)); ++ // Lead bytes F0 to FC may be a Microsoft addition. ++ case 936: ++ // GBK ++ return (uch >= 0x81) && (uch <= 0xFE); ++ case 949: ++ // Korean Wansung KS C-5601-1987 ++ return (uch >= 0x81) && (uch <= 0xFE); ++ case 950: ++ // Big5 ++ return (uch >= 0x81) && (uch <= 0xFE); ++ case 1361: ++ // Korean Johab KS C-5601-1992 ++ return ++ ((uch >= 0x84) && (uch <= 0xD3)) || ++ ((uch >= 0xD8) && (uch <= 0xDE)) || ++ ((uch >= 0xE0) && (uch <= 0xF9)); ++ } ++ return false; ++} ++ ++#ifdef SCI_NAMESPACE ++} ++#endif +diff -r 7e28cdba6d61 -r 7030530a9a0f src/DBCS.h +--- /dev/null Thu Jan 01 00:00:00 1970 +0000 ++++ b/src/DBCS.h Mon Jun 12 11:49:56 2017 +1000 +@@ -0,0 +1,21 @@ ++// Scintilla source code edit control ++/** @file DBCS.h ++ ** Functions to handle DBCS double byte encodings like Shift-JIS. ++ **/ ++// Copyright 2017 by Neil Hodgson <neilh@scintilla.org> ++// The License.txt file describes the conditions under which this software may be distributed. ++ ++#ifndef DBCS_H ++#define DBCS_H ++ ++#ifdef SCI_NAMESPACE ++namespace Scintilla { ++#endif ++ ++bool DBCSIsLeadByte(int codePage, char ch); ++ ++#ifdef SCI_NAMESPACE ++} ++#endif ++ ++#endif +diff -r 7e28cdba6d61 -r 7030530a9a0f src/Document.cxx +--- a/src/Document.cxx Sun Jun 11 14:08:43 2017 +1000 ++++ b/src/Document.cxx Mon Jun 12 11:49:56 2017 +1000 +@@ -564,7 +564,7 @@ + } + + Sci::Position Document::ClampPositionIntoDocument(Sci::Position pos) const { +- return Platform::Clamp(pos, 0, Length()); ++ return Sci::clamp(pos, 0, Length()); + } + + bool Document::IsCrLf(Sci::Position pos) const { +diff -r 7e28cdba6d61 -r 7030530a9a0f src/Editor.cxx +--- a/src/Editor.cxx Sun Jun 11 14:08:43 2017 +1000 ++++ b/src/Editor.cxx Mon Jun 12 11:49:56 2017 +1000 +@@ -888,10 +888,10 @@ + Sci::Line lineDisplay = cs.DisplayFromDoc(lineDoc); + if (moveDir > 0) { + // lineDisplay is already line before fold as lines in fold use display line of line after fold +- lineDisplay = Platform::Clamp(lineDisplay, 0, cs.LinesDisplayed()); ++ lineDisplay = Sci::clamp(lineDisplay, 0, cs.LinesDisplayed()); + return SelectionPosition(pdoc->LineStart(cs.DocFromDisplay(lineDisplay))); + } else { +- lineDisplay = Platform::Clamp(lineDisplay - 1, 0, cs.LinesDisplayed()); ++ lineDisplay = Sci::clamp(lineDisplay - 1, 0, cs.LinesDisplayed()); + return SelectionPosition(pdoc->LineEnd(cs.DocFromDisplay(lineDisplay))); + } + } +@@ -915,7 +915,7 @@ + } + + void Editor::ScrollTo(Sci::Line line, bool moveThumb) { +- const Sci::Line topLineNew = Platform::Clamp(line, 0, MaxScrollPos()); ++ const Sci::Line topLineNew = Sci::clamp(line, 0, MaxScrollPos()); + if (topLineNew != topLine) { + // Try to optimise small scrolls + #ifndef UNDER_CE +@@ -1154,7 +1154,7 @@ + } else { + // yMarginT must equal to caretYSlop, with a minimum of 1 and + // a maximum of slightly less than half the heigth of the text area. +- yMarginT = Platform::Clamp(caretYSlop, 1, halfScreen); ++ yMarginT = Sci::clamp(caretYSlop, 1, halfScreen); + if (bEven) { + yMarginB = yMarginT; + } else { +@@ -1164,7 +1164,7 @@ + yMoveT = yMarginT; + if (bEven) { + if (bJump) { +- yMoveT = Platform::Clamp(caretYSlop * 3, 1, halfScreen); ++ yMoveT = Sci::clamp(caretYSlop * 3, 1, halfScreen); + } + yMoveB = yMoveT; + } else { +@@ -1179,7 +1179,7 @@ + } + } else { // Not strict + yMoveT = bJump ? caretYSlop * 3 : caretYSlop; +- yMoveT = Platform::Clamp(yMoveT, 1, halfScreen); ++ yMoveT = Sci::clamp(yMoveT, 1, halfScreen); + if (bEven) { + yMoveB = yMoveT; + } else { +@@ -1229,7 +1229,7 @@ + newXY.topLine = std::min(newXY.topLine, lineCaret); + } + } +- newXY.topLine = Platform::Clamp(newXY.topLine, 0, MaxScrollPos()); ++ newXY.topLine = Sci::clamp(newXY.topLine, 0, MaxScrollPos()); + } + + // Horizontal positioning +@@ -1251,7 +1251,7 @@ + } else { + // xMargin must equal to caretXSlop, with a minimum of 2 and + // a maximum of slightly less than half the width of the text area. +- xMarginR = Platform::Clamp(caretXSlop, 2, halfScreen); ++ xMarginR = Sci::clamp(caretXSlop, 2, halfScreen); + if (bEven) { + xMarginL = xMarginR; + } else { +@@ -1260,7 +1260,7 @@ + } + if (bJump && bEven) { + // Jump is used only in even mode +- xMoveL = xMoveR = Platform::Clamp(caretXSlop * 3, 1, halfScreen); ++ xMoveL = xMoveR = Sci::clamp(caretXSlop * 3, 1, halfScreen); + } else { + xMoveL = xMoveR = 0; // Not used, avoid a warning + } +@@ -1283,7 +1283,7 @@ + } + } else { // Not strict + xMoveR = bJump ? caretXSlop * 3 : caretXSlop; +- xMoveR = Platform::Clamp(xMoveR, 1, halfScreen); ++ xMoveR = Sci::clamp(xMoveR, 1, halfScreen); + if (bEven) { + xMoveL = xMoveR; + } else { +@@ -1505,7 +1505,7 @@ + const Sci::Line lineDocTop = cs.DocFromDisplay(topLine); + const int subLineTop = topLine - cs.DisplayFromDoc(lineDocTop); + if (ws == wsVisible) { +- lineToWrap = Platform::Clamp(lineDocTop-5, wrapPending.start, pdoc->LinesTotal()); ++ lineToWrap = Sci::clamp(lineDocTop-5, wrapPending.start, pdoc->LinesTotal()); + // Priority wrap to just after visible area. + // Since wrapping could reduce display lines, treat each + // as taking only one display line. +@@ -1561,7 +1561,7 @@ + + if (wrapOccurred) { + SetScrollBars(); +- SetTopLine(Platform::Clamp(goodTopLine, 0, MaxScrollPos())); ++ SetTopLine(Sci::clamp(goodTopLine, 0, MaxScrollPos())); + SetVerticalScrollPos(); + } + +@@ -1816,7 +1816,7 @@ + // TODO: ensure always showing as many lines as possible + // May not be, if, for example, window made larger + if (topLine > MaxScrollPos()) { +- SetTopLine(Platform::Clamp(topLine, 0, MaxScrollPos())); ++ SetTopLine(Sci::clamp(topLine, 0, MaxScrollPos())); + SetVerticalScrollPos(); + Redraw(); + } +@@ -2641,7 +2641,7 @@ + if (mh.linesAdded != 0) { + // Avoid scrolling of display if change before current display + if (mh.position < posTopLine && !CanDeferToLastStep(mh)) { +- Sci::Line newTop = Platform::Clamp(topLine + mh.linesAdded, 0, MaxScrollPos()); ++ Sci::Line newTop = Sci::clamp(topLine + mh.linesAdded, 0, MaxScrollPos()); + if (newTop != topLine) { + SetTopLine(newTop); + SetVerticalScrollPos(); +@@ -2877,7 +2877,7 @@ + } else { + Point pt = LocationFromPosition(sel.MainCaret()); + +- topLineNew = Platform::Clamp( ++ topLineNew = Sci::clamp( + topLine + direction * LinesToScroll(), 0, MaxScrollPos()); + newPos = SPositionFromLocation( + Point::FromInts(lastXChosen - xOffset, static_cast<int>(pt.y) + direction * (vs.lineHeight * LinesToScroll())), +@@ -3209,6 +3209,14 @@ + + namespace { + ++short HighShortFromLong(long x) { ++ return static_cast<short>(x >> 16); ++} ++ ++short LowShortFromLong(long x) { ++ return static_cast<short>(x & 0xffff); ++} ++ + unsigned int WithExtends(unsigned int iMessage) { + switch (iMessage) { + case SCI_CHARLEFT: return SCI_CHARLEFTEXTEND; +@@ -4470,30 +4478,27 @@ + if (!ctrl || !multipleSelection || (selectionType != selChar && selectionType != selWord)) + SetEmptySelection(newPos.Position()); + bool doubleClick = false; +- // Stop mouse button bounce changing selection type +- if (!Platform::MouseButtonBounce() || curTime != lastClickTime) { +- if (inSelMargin) { +- // Inside margin selection type should be either selSubLine or selWholeLine. +- if (selectionType == selSubLine) { +- // If it is selSubLine, we're inside a *double* click and word wrap is enabled, +- // so we switch to selWholeLine in order to select whole line. +- selectionType = selWholeLine; +- } else if (selectionType != selSubLine && selectionType != selWholeLine) { +- // If it is neither, reset selection type to line selection. +- selectionType = (Wrapping() && (marginOptions & SC_MARGINOPTION_SUBLINESELECT)) ? selSubLine : selWholeLine; +- } ++ if (inSelMargin) { ++ // Inside margin selection type should be either selSubLine or selWholeLine. ++ if (selectionType == selSubLine) { ++ // If it is selSubLine, we're inside a *double* click and word wrap is enabled, ++ // so we switch to selWholeLine in order to select whole line. ++ selectionType = selWholeLine; ++ } else if (selectionType != selSubLine && selectionType != selWholeLine) { ++ // If it is neither, reset selection type to line selection. ++ selectionType = (Wrapping() && (marginOptions & SC_MARGINOPTION_SUBLINESELECT)) ? selSubLine : selWholeLine; ++ } ++ } else { ++ if (selectionType == selChar) { ++ selectionType = selWord; ++ doubleClick = true; ++ } else if (selectionType == selWord) { ++ // Since we ended up here, we're inside a *triple* click, which should always select ++ // whole line regardless of word wrap being enabled or not. ++ selectionType = selWholeLine; + } else { +- if (selectionType == selChar) { +- selectionType = selWord; +- doubleClick = true; +- } else if (selectionType == selWord) { +- // Since we ended up here, we're inside a *triple* click, which should always select +- // whole line regardless of word wrap being enabled or not. +- selectionType = selWholeLine; +- } else { +- selectionType = selChar; +- originalAnchorPos = sel.MainCaret(); +- } ++ selectionType = selChar; ++ originalAnchorPos = sel.MainCaret(); + } + } + +@@ -5082,7 +5087,7 @@ + // When scrolling, allow less time to ensure responsive + const double secondsAllowed = scrolling ? 0.005 : 0.02; + +- const Sci::Line linesToStyle = Platform::Clamp(static_cast<int>(secondsAllowed / pdoc->durationStyleOneLine), ++ const Sci::Line linesToStyle = Sci::clamp(static_cast<int>(secondsAllowed / pdoc->durationStyleOneLine), + 10, 0x10000); + const Sci::Line stylingMaxLine = std::min( + static_cast<Sci::Line>(pdoc->LineFromPosition(pdoc->GetEndStyled()) + linesToStyle), +@@ -5426,18 +5431,18 @@ + const Sci::Line lineDisplay = cs.DisplayFromDoc(lineDoc); + if (visiblePolicy & VISIBLE_SLOP) { + if ((topLine > lineDisplay) || ((visiblePolicy & VISIBLE_STRICT) && (topLine + visibleSlop > lineDisplay))) { +- SetTopLine(Platform::Clamp(lineDisplay - visibleSlop, 0, MaxScrollPos())); ++ SetTopLine(Sci::clamp(lineDisplay - visibleSlop, 0, MaxScrollPos())); + SetVerticalScrollPos(); + Redraw(); + } else if ((lineDisplay > topLine + LinesOnScreen() - 1) || + ((visiblePolicy & VISIBLE_STRICT) && (lineDisplay > topLine + LinesOnScreen() - 1 - visibleSlop))) { +- SetTopLine(Platform::Clamp(lineDisplay - LinesOnScreen() + 1 + visibleSlop, 0, MaxScrollPos())); ++ SetTopLine(Sci::clamp(lineDisplay - LinesOnScreen() + 1 + visibleSlop, 0, MaxScrollPos())); + SetVerticalScrollPos(); + Redraw(); + } + } else { + if ((topLine > lineDisplay) || (lineDisplay > topLine + LinesOnScreen() - 1) || (visiblePolicy & VISIBLE_STRICT)) { +- SetTopLine(Platform::Clamp(lineDisplay - LinesOnScreen() / 2 + 1, 0, MaxScrollPos())); ++ SetTopLine(Sci::clamp(lineDisplay - LinesOnScreen() / 2 + 1, 0, MaxScrollPos())); + SetVerticalScrollPos(); + Redraw(); + } +@@ -6040,7 +6045,7 @@ + return pdoc->MovePositionOutsideChar(static_cast<int>(wParam) + 1, 1, true); + + case SCI_POSITIONRELATIVE: +- return Platform::Clamp(pdoc->GetRelativePosition(static_cast<int>(wParam), static_cast<int>(lParam)), 0, pdoc->Length()); ++ return Sci::clamp(pdoc->GetRelativePosition(static_cast<int>(wParam), static_cast<int>(lParam)), 0, pdoc->Length()); + + case SCI_LINESCROLL: + ScrollTo(topLine + static_cast<Sci::Line>(lParam)); +@@ -7290,13 +7295,13 @@ + return vs.caretWidth; + + case SCI_ASSIGNCMDKEY: +- kmap.AssignCmdKey(Platform::LowShortFromLong(static_cast<long>(wParam)), +- Platform::HighShortFromLong(static_cast<long>(wParam)), static_cast<unsigned int>(lParam)); ++ kmap.AssignCmdKey(LowShortFromLong(static_cast<long>(wParam)), ++ HighShortFromLong(static_cast<long>(wParam)), static_cast<unsigned int>(lParam)); + break; + + case SCI_CLEARCMDKEY: +- kmap.AssignCmdKey(Platform::LowShortFromLong(static_cast<long>(wParam)), +- Platform::HighShortFromLong(static_cast<long>(wParam)), SCI_NULL); ++ kmap.AssignCmdKey(LowShortFromLong(static_cast<long>(wParam)), ++ HighShortFromLong(static_cast<long>(wParam)), SCI_NULL); + break; + + case SCI_CLEARALLCMDKEYS: +diff -r 7e28cdba6d61 -r 7030530a9a0f src/Position.h +--- a/src/Position.h Sun Jun 11 14:08:43 2017 +1000 ++++ b/src/Position.h Mon Jun 12 11:49:56 2017 +1000 +@@ -25,6 +25,14 @@ + + const Position invalidPosition = -1; + ++inline int clamp(int val, int minVal, int maxVal) { ++ if (val > maxVal) ++ val = maxVal; ++ if (val < minVal) ++ val = minVal; ++ return val; ++} ++ + } + + #endif +diff -r 7e28cdba6d61 -r 7030530a9a0f src/ViewStyle.cxx +--- a/src/ViewStyle.cxx Sun Jun 11 14:08:43 2017 +1000 ++++ b/src/ViewStyle.cxx Mon Jun 12 11:49:56 2017 +1000 +@@ -460,7 +460,7 @@ + } + + int ViewStyle::GetFrameWidth() const { +- return Platform::Clamp(caretLineFrame, 1, lineHeight / 3); ++ return Sci::clamp(caretLineFrame, 1, lineHeight / 3); + } + + bool ViewStyle::IsLineFrameOpaque(bool caretActive, bool lineContainsCaret) const { +diff -r 7e28cdba6d61 -r 7030530a9a0f win32/PlatWin.cxx +--- a/win32/PlatWin.cxx Sun Jun 11 14:08:43 2017 +1000 ++++ b/win32/PlatWin.cxx Mon Jun 12 11:49:56 2017 +1000 +@@ -46,6 +46,7 @@ + #include "StringCopy.h" + #include "XPM.h" + #include "UniConversion.h" ++#include "DBCS.h" + #include "FontQuality.h" + + #ifndef SPI_GETFONTSMOOTHINGCONTRAST +@@ -75,10 +76,6 @@ + namespace Scintilla { + #endif + +-Point Point::FromLong(long lpoint) { +- return Point(static_cast<short>(LOWORD(lpoint)), static_cast<short>(HIWORD(lpoint))); +-} +- + static RECT RectFromPRectangle(PRectangle prc) { + RECT rc = {static_cast<LONG>(prc.left), static_cast<LONG>(prc.top), + static_cast<LONG>(prc.right), static_cast<LONG>(prc.bottom)}; +@@ -558,7 +555,6 @@ + XYPOSITION Ascent(Font &font_) override; + XYPOSITION Descent(Font &font_) override; + XYPOSITION InternalLeading(Font &font_) override; +- XYPOSITION ExternalLeading(Font &font_) override; + XYPOSITION Height(Font &font_) override; + XYPOSITION AverageCharWidth(Font &font_) override; + +@@ -1010,13 +1006,6 @@ + return static_cast<XYPOSITION>(tm.tmInternalLeading); + } + +-XYPOSITION SurfaceGDI::ExternalLeading(Font &font_) { +- SetFont(font_); +- TEXTMETRIC tm; +- ::GetTextMetrics(hdc, &tm); +- return static_cast<XYPOSITION>(tm.tmExternalLeading); +-} +- + XYPOSITION SurfaceGDI::Height(Font &font_) { + SetFont(font_); + TEXTMETRIC tm; +@@ -1121,7 +1110,6 @@ + XYPOSITION Ascent(Font &font_) override; + XYPOSITION Descent(Font &font_) override; + XYPOSITION InternalLeading(Font &font_) override; +- XYPOSITION ExternalLeading(Font &font_) override; + XYPOSITION Height(Font &font_) override; + XYPOSITION AverageCharWidth(Font &font_) override; + +@@ -1671,7 +1659,7 @@ + int ui = 0; + for (int i=0; i<len && ui<tbuf.tlen;) { + positions[i] = poses.buffer[ui]; +- if (Platform::IsDBCSLeadByte(codePageText, s[i])) { ++ if (DBCSIsLeadByte(codePageText, s[i])) { + positions[i+1] = poses.buffer[ui]; + i += 2; + } else { +@@ -1716,11 +1704,6 @@ + return floor(yInternalLeading); + } + +-XYPOSITION SurfaceD2D::ExternalLeading(Font &) { +- // Not implemented, always return one +- return 1; +-} +- + XYPOSITION SurfaceD2D::Height(Font &font_) { + return Ascent(font_) + Descent(font_); + } +@@ -1786,10 +1769,6 @@ + wid = 0; + } + +-bool Window::HasFocus() { +- return ::GetFocus() == wid; +-} +- + PRectangle Window::GetPosition() { + RECT rc; + ::GetWindowRect(static_cast<HWND>(wid), &rc); +@@ -1952,10 +1931,6 @@ + } + } + +-void Window::SetTitle(const char *s) { +- ::SetWindowTextA(static_cast<HWND>(wid), s); +-} +- + /* Returns rectangle of monitor pt is on, both rect and pt are in Window's + coordinates */ + PRectangle Window::GetMonitorRect(Point pt) { +@@ -3024,85 +2999,10 @@ + return ::GetDoubleClickTime(); + } + +-bool Platform::MouseButtonBounce() { +- return false; +-} +- + void Platform::DebugDisplay(const char *s) { + ::OutputDebugStringA(s); + } + +-bool Platform::IsKeyDown(int key) { +- return (::GetKeyState(key) & 0x80000000) != 0; +-} +- +-long Platform::SendScintilla(WindowID w, unsigned int msg, unsigned long wParam, long lParam) { +- // This should never be called - its here to satisfy an old interface +- return static_cast<long>(::SendMessage(static_cast<HWND>(w), msg, wParam, lParam)); +-} +- +-long Platform::SendScintillaPointer(WindowID w, unsigned int msg, unsigned long wParam, void *lParam) { +- // This should never be called - its here to satisfy an old interface +- return static_cast<long>(::SendMessage(static_cast<HWND>(w), msg, wParam, +- reinterpret_cast<LPARAM>(lParam))); +-} +- +-bool Platform::IsDBCSLeadByte(int codePage, char ch) { +- // Byte ranges found in Wikipedia articles with relevant search strings in each case +- const unsigned char uch = static_cast<unsigned char>(ch); +- switch (codePage) { +- case 932: +- // Shift_jis +- return ((uch >= 0x81) && (uch <= 0x9F)) || +- ((uch >= 0xE0) && (uch <= 0xEF)); +- case 936: +- // GBK +- return (uch >= 0x81) && (uch <= 0xFE); +- case 949: +- // Korean Wansung KS C-5601-1987 +- return (uch >= 0x81) && (uch <= 0xFE); +- case 950: +- // Big5 +- return (uch >= 0x81) && (uch <= 0xFE); +- case 1361: +- // Korean Johab KS C-5601-1992 +- return +- ((uch >= 0x84) && (uch <= 0xD3)) || +- ((uch >= 0xD8) && (uch <= 0xDE)) || +- ((uch >= 0xE0) && (uch <= 0xF9)); +- } +- return false; +-} +- +-int Platform::DBCSCharLength(int codePage, const char *s) { +- if (codePage == 932 || codePage == 936 || codePage == 949 || +- codePage == 950 || codePage == 1361) { +- return Platform::IsDBCSLeadByte(codePage, s[0]) ? 2 : 1; +- } else { +- return 1; +- } +-} +- +-int Platform::DBCSCharMaxLength() { +- return 2; +-} +- +-// These are utility functions not really tied to a platform +- +-int Platform::Minimum(int a, int b) { +- if (a < b) +- return a; +- else +- return b; +-} +- +-int Platform::Maximum(int a, int b) { +- if (a > b) +- return a; +- else +- return b; +-} +- + //#define TRACE + + #ifdef TRACE +@@ -3147,14 +3047,6 @@ + } + } + +-int Platform::Clamp(int val, int minVal, int maxVal) { +- if (val > maxVal) +- val = maxVal; +- if (val < minVal) +- val = minVal; +- return val; +-} +- + void Platform_Initialise(void *hInstance) { + ::InitializeCriticalSection(&crPlatformLock); + hinstPlatformRes = static_cast<HINSTANCE>(hInstance); +diff -r 7e28cdba6d61 -r 7030530a9a0f win32/ScintillaWin.cxx +--- a/win32/ScintillaWin.cxx Sun Jun 11 14:08:43 2017 +1000 ++++ b/win32/ScintillaWin.cxx Mon Jun 12 11:49:56 2017 +1000 +@@ -156,6 +156,14 @@ + return Point::FromInts(pt.x, pt.y); + } + ++static Point PointFromLong(long lpoint) { ++ return Point(static_cast<short>(LOWORD(lpoint)), static_cast<short>(HIWORD(lpoint))); ++} ++ ++static bool KeyboardIsKeyDown(int key) { ++ return (::GetKeyState(key) & 0x80000000) != 0; ++} ++ + class ScintillaWin; // Forward declaration for COM interface subobjects + + typedef void VFunction(void); +@@ -1376,19 +1384,19 @@ + ::ImmNotifyIME(imc.hIMC, NI_COMPOSITIONSTR, CPS_COMPLETE, 0); + // + //Platform::DebugPrintf("Buttdown %d %x %x %x %x %x\n",iMessage, wParam, lParam, +- // Platform::IsKeyDown(VK_SHIFT), +- // Platform::IsKeyDown(VK_CONTROL), +- // Platform::IsKeyDown(VK_MENU)); ++ // KeyboardIsKeyDown(VK_SHIFT), ++ // KeyboardIsKeyDown(VK_CONTROL), ++ // KeyboardIsKeyDown(VK_MENU)); + ::SetFocus(MainHWND()); +- ButtonDown(Point::FromLong(static_cast<long>(lParam)), ::GetMessageTime(), ++ ButtonDown(PointFromLong(static_cast<long>(lParam)), ::GetMessageTime(), + (wParam & MK_SHIFT) != 0, + (wParam & MK_CONTROL) != 0, +- Platform::IsKeyDown(VK_MENU)); ++ KeyboardIsKeyDown(VK_MENU)); + } + break; + + case WM_MOUSEMOVE: { +- const Point pt = Point::FromLong(static_cast<long>(lParam)); ++ const Point pt = PointFromLong(static_cast<long>(lParam)); + + // Windows might send WM_MOUSEMOVE even though the mouse has not been moved: + // http://blogs.msdn.com/b/oldnewthing/archive/2003/10/01/55108.aspx +@@ -1397,7 +1405,7 @@ + ButtonMoveWithModifiers(pt, + ((wParam & MK_SHIFT) != 0 ? SCI_SHIFT : 0) | + ((wParam & MK_CONTROL) != 0 ? SCI_CTRL : 0) | +- (Platform::IsKeyDown(VK_MENU) ? SCI_ALT : 0)); ++ (KeyboardIsKeyDown(VK_MENU) ? SCI_ALT : 0)); + } + } + break; +@@ -1408,22 +1416,22 @@ + return ::DefWindowProc(MainHWND(), iMessage, wParam, lParam); + + case WM_LBUTTONUP: +- ButtonUp(Point::FromLong(static_cast<long>(lParam)), ++ ButtonUp(PointFromLong(static_cast<long>(lParam)), + ::GetMessageTime(), + (wParam & MK_CONTROL) != 0); + break; + + case WM_RBUTTONDOWN: { + ::SetFocus(MainHWND()); +- Point pt = Point::FromLong(static_cast<long>(lParam)); ++ Point pt = PointFromLong(static_cast<long>(lParam)); + if (!PointInSelection(pt)) { + CancelModes(); +- SetEmptySelection(PositionFromLocation(Point::FromLong(static_cast<long>(lParam)))); ++ SetEmptySelection(PositionFromLocation(PointFromLong(static_cast<long>(lParam)))); + } + + RightButtonDownWithModifiers(pt, ::GetMessageTime(), ModifierFlags((wParam & MK_SHIFT) != 0, + (wParam & MK_CONTROL) != 0, +- Platform::IsKeyDown(VK_MENU))); ++ KeyboardIsKeyDown(VK_MENU))); + } + break; + +@@ -1487,9 +1495,9 @@ + //Platform::DebugPrintf("S keydown %d %x %x %x %x\n",iMessage, wParam, lParam, ::IsKeyDown(VK_SHIFT), ::IsKeyDown(VK_CONTROL)); + lastKeyDownConsumed = false; + const int ret = KeyDown(KeyTranslate(static_cast<int>(wParam)), +- Platform::IsKeyDown(VK_SHIFT), +- Platform::IsKeyDown(VK_CONTROL), +- Platform::IsKeyDown(VK_MENU), ++ KeyboardIsKeyDown(VK_SHIFT), ++ KeyboardIsKeyDown(VK_CONTROL), ++ KeyboardIsKeyDown(VK_MENU), + &lastKeyDownConsumed); + if (!ret && !lastKeyDownConsumed) { + return ::DefWindowProc(MainHWND(), iMessage, wParam, lParam); +@@ -1573,7 +1581,7 @@ + } + + case WM_CONTEXTMENU: { +- Point pt = Point::FromLong(static_cast<long>(lParam)); ++ Point pt = PointFromLong(static_cast<long>(lParam)); + POINT rpt = {static_cast<int>(pt.x), static_cast<int>(pt.y)}; + ::ScreenToClient(MainHWND(), &rpt); + const Point ptClient = PointFromPOINT(rpt); +@@ -3350,7 +3358,7 @@ + return 0; + } else if (iMessage == WM_LBUTTONDOWN) { + // This does not fire due to the hit test code +- sciThis->ct.MouseClick(Point::FromLong(static_cast<long>(lParam))); ++ sciThis->ct.MouseClick(PointFromLong(static_cast<long>(lParam))); + sciThis->CallTipClick(); + return 0; + } else if (iMessage == WM_SETCURSOR) { +diff -r 7e28cdba6d61 -r 7030530a9a0f win32/makefile +--- a/win32/makefile Sun Jun 11 14:08:43 2017 +1000 ++++ b/win32/makefile Mon Jun 12 11:49:56 2017 +1000 +@@ -13,7 +13,7 @@ + LDMINGW = -Wl,--enable-runtime-pseudo-reloc-v2 -Wl,--add-stdcall-alias + LIBSMINGW = -lstdc++ + STRIPOPTION = -s +-CXXSTD = gnu++0x ++CXXSTD = gnu++17 + endif + + .SUFFIXES: .cxx +@@ -83,6 +83,7 @@ + CharacterSet.o \ + CharClassify.o \ + ContractionState.o \ ++ DBCS.o \ + Decoration.o \ + Document.o \ + EditModel.o \ +diff -r 7e28cdba6d61 -r 7030530a9a0f win32/scintilla.mak +--- a/win32/scintilla.mak Sun Jun 11 14:08:43 2017 +1000 ++++ b/win32/scintilla.mak Mon Jun 12 11:49:56 2017 +1000 +@@ -25,7 +25,7 @@ + !ENDIF + + CRTFLAGS=-D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1 -D_CRT_SECURE_NO_DEPRECATE=1 -D_SCL_SECURE_NO_WARNINGS=1 $(XP_DEFINE) +-CXXFLAGS=-Zi -TP -MP -W4 -EHsc $(CRTFLAGS) ++CXXFLAGS=-Zi -TP -MP -W4 -EHsc -std:c++latest $(CRTFLAGS) + CXXDEBUG=-Od -MTd -DDEBUG + CXXNDEBUG=-O1 -MT -DNDEBUG -GL + NAME=-Fo +@@ -75,6 +75,7 @@ + $(DIR_O)\CharacterSet.obj \ + $(DIR_O)\CharClassify.obj \ + $(DIR_O)\ContractionState.obj \ ++ $(DIR_O)\DBCS.obj \ + $(DIR_O)\Decoration.obj \ + $(DIR_O)\Document.obj \ + $(DIR_O)\EditModel.obj \ |