Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package scintilla for openSUSE:Factory checked in at 2022-11-01 13:43:37 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/scintilla (Old) and /work/SRC/openSUSE:Factory/.scintilla.new.2275 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "scintilla" Tue Nov 1 13:43:37 2022 rev:34 rq:1032648 version:5.3.1 Changes: -------- --- /work/SRC/openSUSE:Factory/scintilla/scintilla.changes 2022-09-10 20:17:21.528839380 +0200 +++ /work/SRC/openSUSE:Factory/.scintilla.new.2275/scintilla.changes 2022-11-01 13:43:45.900278079 +0100 @@ -1,0 +2,25 @@ +Mon Oct 31 10:33:57 UTC 2022 - Atri Bhattacharya <[email protected]> + +- Update to versoin 5.3.1: + * Added SCI_STYLESETINVISIBLEREPRESENTATION to make it easier to + edit around invisible text (Feature #1453). + * Removed NotifyLexerChanged notification from DocWatcher. This + is a private interface but could be used by independent + platform layers and was exposed by ScintillaDocument in the Qt + implementation of ScintillaEdit. + * Draw lines more consistently in SC_PHASES_TWO and + SC_PHASES_ONE modes by clipping drawing to just the line + rectangle. + * Draw SC_MARK_BAR markers underneath other markers as they + often cover multiple lines for change history and other + markers mark individual lines. + * Enlarge point and point top indicators and scale to be larger + with larger text. + * Suppress change history background line shading when printing. + Bug #2358. + * Make SCI_LINESCROLL more accurate when width of space not + integer (Bug #2357). + * On GTK, fix bug where there were too many or too few lines + when wrapping (Bug #2349). + +------------------------------------------------------------------- Old: ---- scintilla530.tgz New: ---- scintilla531.tgz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ scintilla.spec ++++++ --- /var/tmp/diff_new_pack.lnx5vG/_old 2022-11-01 13:43:47.028284080 +0100 +++ /var/tmp/diff_new_pack.lnx5vG/_new 2022-11-01 13:43:47.060284250 +0100 @@ -17,8 +17,8 @@ %define so_ver 5.3 -%define _ver %{so_ver}.0 -%define tar_ver 530 +%define _ver %{so_ver}.1 +%define tar_ver 531 %define libname libscintilla5 Name: scintilla Version: %{_ver} ++++++ scintilla530.tgz -> scintilla531.tgz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/call/ScintillaCall.cxx new/scintilla/call/ScintillaCall.cxx --- old/scintilla/call/ScintillaCall.cxx 2022-08-27 01:04:40.000000000 +0200 +++ new/scintilla/call/ScintillaCall.cxx 2022-10-12 03:48:45.000000000 +0200 @@ -647,6 +647,18 @@ return Call(Message::StyleGetCheckMonospaced, style); } +void ScintillaCall::StyleSetInvisibleRepresentation(int style, const char *representation) { + CallString(Message::StyleSetInvisibleRepresentation, style, representation); +} + +int ScintillaCall::StyleGetInvisibleRepresentation(int style, char *representation) { + return static_cast<int>(CallPointer(Message::StyleGetInvisibleRepresentation, style, representation)); +} + +std::string ScintillaCall::StyleGetInvisibleRepresentation(int style) { + return CallReturnString(Message::StyleGetInvisibleRepresentation, style); +} + void ScintillaCall::SetElementColour(Scintilla::Element element, ColourAlpha colourElement) { Call(Message::SetElementColour, static_cast<uintptr_t>(element), colourElement); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/cocoa/Scintilla/Info.plist new/scintilla/cocoa/Scintilla/Info.plist --- old/scintilla/cocoa/Scintilla/Info.plist 2022-08-27 01:04:40.000000000 +0200 +++ new/scintilla/cocoa/Scintilla/Info.plist 2022-10-12 03:48:45.000000000 +0200 @@ -15,7 +15,7 @@ <key>CFBundlePackageType</key> <string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string> <key>CFBundleShortVersionString</key> - <string>5.3.0</string> + <string>5.3.1</string> <key>CFBundleVersion</key> <string>$(CURRENT_PROJECT_VERSION)</string> <key>NSHumanReadableCopyright</key> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/cocoa/Scintilla/Scintilla.xcodeproj/project.pbxproj new/scintilla/cocoa/Scintilla/Scintilla.xcodeproj/project.pbxproj --- old/scintilla/cocoa/Scintilla/Scintilla.xcodeproj/project.pbxproj 2022-08-27 01:04:40.000000000 +0200 +++ new/scintilla/cocoa/Scintilla/Scintilla.xcodeproj/project.pbxproj 2022-10-12 03:48:45.000000000 +0200 @@ -573,7 +573,7 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 5.3.0; + CURRENT_PROJECT_VERSION = 5.3.1; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -635,7 +635,7 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 5.3.0; + CURRENT_PROJECT_VERSION = 5.3.1; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; @@ -665,7 +665,7 @@ CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 5.3.0; + CURRENT_PROJECT_VERSION = 5.3.1; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; @@ -699,7 +699,7 @@ CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 5.3.0; + CURRENT_PROJECT_VERSION = 5.3.1; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; DYLIB_COMPATIBILITY_VERSION = 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/cppcheck.suppress new/scintilla/cppcheck.suppress --- old/scintilla/cppcheck.suppress 2022-07-09 01:45:48.000000000 +0200 +++ new/scintilla/cppcheck.suppress 2022-10-12 03:48:45.000000000 +0200 @@ -16,9 +16,6 @@ // Some non-explicit constructors are used for conversions or are private to lexers noExplicitConstructor -// Document is checking for a change by called methods and cppcheck isn't considering escape -knownConditionTrueFalse:scintilla/src/Document.cxx - // MarginView access to all bits is safe and is better defined in later versions of C++ shiftTooManyBitsSigned:scintilla/src/MarginView.cxx @@ -32,8 +29,14 @@ knownConditionTrueFalse:scintilla/qt/ScintillaEditBase/ScintillaQt.cpp knownConditionTrueFalse:scintilla/win32/ScintillaWin.cxx -// This is a weird ABI hack and shouldn't be changed -unusedStructMember:scintilla/gtk/PlatGTK.cxx +// G_DEFINE_TYPE is too complex to pass to cppcheck +unknownMacro:scintilla/gtk/PlatGTK.cxx + +// maskSmooth set depending on preprocessor allowing Wayland definition +badBitmaskCheck:scintilla/gtk/ScintillaGTK.cxx + +// Difficult to test accessibility so don't change +constVariable:scintilla/gtk/ScintillaGTKAccessible.cxx // Have no way of testing ScintillaEdit so don't fix even simple warnings cstyleCast:scintilla/qt/ScintillaEdit/ScintillaEdit.cpp Binary files old/scintilla/doc/ChangeHistory.png and new/scintilla/doc/ChangeHistory.png differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/doc/ScintillaDoc.html new/scintilla/doc/ScintillaDoc.html --- old/scintilla/doc/ScintillaDoc.html 2022-08-27 01:04:40.000000000 +0200 +++ new/scintilla/doc/ScintillaDoc.html 2022-10-12 03:48:46.000000000 +0200 @@ -129,7 +129,7 @@ <h1>Scintilla Documentation</h1> - <p>Last edited 26 August 2022 NH</p> + <p>Last edited 1 October 2022 NH</p> <p style="background:#90F0C0">Scintilla 5 has moved the lexers from Scintilla into a new <a href="Lexilla.html">Lexilla</a> project.<br /> @@ -1338,11 +1338,17 @@ <p>Scintilla can display document changes (modified, saved, ...) in the margin or in the text.</p> + <p>The main states are original text that has not been modified, modified, and modified then saved. + As it is possible to undo to before the save point, there are additional states for reverted from save and + reverted back to original from save. + The reverted states are different to the saved document on disk so some applications may want to + display these states just like the main modified state.</p> + <p><img src="ChangeHistory.png" alt="Change history markers and indicators." /></p> <p>The image shows the default visuals which can be altered by the application. In the text, inserted characters appear with coloured underlines and points where characters were deleted are shown with small triangles. - The margin shows a block indicating the overall state of the line, prioritising the more consequential modified states. + The margin shows a block indicating the overall state of the line, prioritizing the more consequential modified states. The states are modified (<span style="color:#FF8000">orange</span>), saved (<span style="color:#00A000">green</span>), @@ -1353,6 +1359,9 @@ <p>This feature uses a moderate amount of memory proportional to the amount of modifications made. On huge documents, this could be significant so could be disabled when it would cause excessive memory use.</p> + <p>If the applications wants to display a simplified set of visuals without differentiating between modifications + that have been reverted then assign the same attributes to multiple markers and indicators.</p> + <code><a class="message" href="#SCI_SETCHANGEHISTORY">SCI_SETCHANGEHISTORY(int changeHistory)</a><br /> <a class="message" href="#SCI_GETCHANGEHISTORY">SCI_GETCHANGEHISTORY → int</a><br /> </code> @@ -1414,8 +1423,8 @@ <td>21</td> - <td>A change was made to this line and saved but then reverted to its original state. - This line is different to its state on disk.</td> + <td>A change was made to this line and saved but then reverted to its original state.</td> + <td>This line is different to its state on disk.</td> </tr> <tr> @@ -1423,7 +1432,8 @@ <td>22</td> - <td>This line was modified and saved. This line is the same as its state on disk.</td> + <td>This line was modified and saved.</td> + <td>This line is the same as its state on disk.</td> </tr> <tr> @@ -1431,7 +1441,8 @@ <td>23</td> - <td>This line was modified but not yet saved. This line is different to its state on disk.</td> + <td>This line was modified but not yet saved.</td> + <td>This line is different to its state on disk.</td> </tr> <tr> @@ -1439,8 +1450,8 @@ <td>24</td> - <td>A change was made to this line and saved but then reverted but not to its original state. - This line is different to its state on disk.</td> + <td>A change was made to this line and saved but then reverted but not to its original state.</td> + <td>This line is different to its state on disk.</td> </tr> </tbody> </table> @@ -1452,50 +1463,54 @@ <tr> <th align="left"><code>INDICATOR_HISTORY_REVERTED_TO_ORIGIN_INSERTION</code></th> <td>36</td> - <td>Text was deleted and saved but then reverted to its original state. - This text is not present on disk.</td> + <td>Text was deleted and saved but then reverted to its original state.</td> + <td>This text has not been saved to disk.</td> </tr> <tr> <th align="left"><code>INDICATOR_HISTORY_REVERTED_TO_ORIGIN_DELETION</code></th> <td>37</td> - <td>Text was inserted and saved but then reverted to its original state. - This range is different to its state on disk.</td> + <td>Text was inserted and saved but then reverted to its original state.</td> + <td>There is text on disk that is missing.</td> </tr> <tr> <th align="left"><code>INDICATOR_HISTORY_SAVED_INSERTION</code></th> <td>38</td> - <td>Text was inserted and saved. This text is the same as on disk.</td> + <td>Text was inserted and saved.</td> + <td>This text is the same as on disk.</td> </tr> <tr> <th align="left"><code>INDICATOR_HISTORY_SAVED_DELETION</code></th> <td>39</td> - <td>Text was deleted and saved. This range is the same as on disk.</td> + <td>Text was deleted and saved.</td> + <td>This range is the same as on disk.</td> </tr> <tr> <th align="left"><code>INDICATOR_HISTORY_MODIFIED_INSERTION</code></th> <td>40</td> - <td>Text was inserted but not yet saved. This text is not present on disk.</td> + <td>Text was inserted but not yet saved.</td> + <td>This text has not been saved to disk.</td> </tr> <tr> <th align="left"><code>INDICATOR_HISTORY_MODIFIED_DELETION</code></th> <td>41</td> - <td>Text was deleted but not yet saved. This range is different to its state on disk.</td> + <td>Text was deleted but not yet saved.</td> + <td>There is text on disk that is missing.</td> </tr> <tr> <th align="left"><code>INDICATOR_HISTORY_REVERTED_TO_MODIFIED_INSERTION</code></th> <td>42</td> - <td>Text was deleted and saved but then reverted but not to its original state. - This text is not present on disk.</td> + <td>Text was deleted and saved but then reverted but not to its original state.</td> + <td>This text has not been saved to disk.</td> </tr> <tr> <th align="left"><code>INDICATOR_HISTORY_REVERTED_TO_MODIFIED_DELETION</code></th> <td>43</td> - <td>Text was inserted and saved but then reverted but not to its original state. - This range is different to its state on disk.</td> + <td>Text was inserted and saved but then reverted but not to its original state.</td> + <td>There is text on disk that is missing.</td> </tr> </tbody> </table> @@ -3233,6 +3248,8 @@ <a class="message" href="#SCI_STYLESETCHECKMONOSPACED">SCI_STYLESETCHECKMONOSPACED(int style, bool checkMonospaced)</a><br /> <a class="message" href="#SCI_STYLEGETCHECKMONOSPACED">SCI_STYLEGETCHECKMONOSPACED(int style) → bool</a><br /> + <a class="message" href="#SCI_STYLESETINVISIBLEREPRESENTATION">SCI_STYLESETINVISIBLEREPRESENTATION(int style, const char *representation)</a><br /> + <a class="message" href="#SCI_STYLEGETINVISIBLEREPRESENTATION">SCI_STYLEGETINVISIBLEREPRESENTATION(int style, char *representation NUL-terminated) → int</a><br /> <a class="message" href="#SCI_SETFONTLOCALE">SCI_SETFONTLOCALE(<unused>, const char *localeName)</a><br /> <a class="message" href="#SCI_GETFONTLOCALE">SCI_GETFONTLOCALE(<unused>, char *localeName) → int</a><br /> </code> @@ -3499,6 +3516,15 @@ Applications may apply the 'check monospaced' attribute just to fonts known to be monospaced or on all fonts, leaving it to Scintilla to reject fonts that are proportional.</p> + <p><b id="SCI_STYLESETINVISIBLEREPRESENTATION">SCI_STYLESETINVISIBLEREPRESENTATION(int style, const char *representation)</b><br /> + <b id="SCI_STYLEGETINVISIBLEREPRESENTATION">SCI_STYLEGETINVISIBLEREPRESENTATION(int style, char *representation NUL-terminated) → int</b><br /> + When a style is made invisible with <a class="seealso" href="#SCI_STYLESETVISIBLE">SCI_STYLESETVISIBLE</a>, text is difficult to edit as + the cursor can be at both sides of the invisible text segment. With these messages invisible text segements can be made visible with a single + UTF8 characater giving the user an indication if the cursor is left or right of the invisible text. The character is displayed using the current style.</p> + + <p>The <code>representation</code> parameter is a zero terminated string holding the one character used to represent the invisible text segment. Only the first character + is used, the character is decoded as UTF-8.</p> + <p><b id="SCI_SETFONTLOCALE">SCI_SETFONTLOCALE(<unused>, const char *localeName)</b><br /> <b id="SCI_GETFONTLOCALE">SCI_GETFONTLOCALE(<unused>, char *localeName NUL-terminated) → int</b><br /> These messages set the locale used for font selection with language-dependent glyphs. @@ -5160,8 +5186,11 @@ (<code>SC_MARK_</code>*) or you can use characters. By default, all 32 markers are set to <code>SC_MARK_CIRCLE</code> with a black foreground and a white background.</p> - <p>The markers are drawn in the order of their numbers, so higher numbered markers appear on - top of lower numbered ones. Markers try to move with their text by tracking where the start of + <p>The markers are drawn in the order of their numbers (except for <code>SC_MARK_BAR</code>), so higher + numbered markers appear on top of lower numbered ones. + <code>SC_MARK_BAR</code> markers are drawn first so they are underneath as they often cover + multiple lines for change history and other markers mark individual lines. + Markers try to move with their text by tracking where the start of their line moves. When a line is deleted, its markers are combined, by an <code>OR</code> operation, with the markers of the next line.</p> <code><a class="message" href="#SCI_MARKERDEFINE">SCI_MARKERDEFINE(int markerNumber, int diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/doc/ScintillaDownload.html new/scintilla/doc/ScintillaDownload.html --- old/scintilla/doc/ScintillaDownload.html 2022-08-27 01:04:40.000000000 +0200 +++ new/scintilla/doc/ScintillaDownload.html 2022-10-12 03:48:46.000000000 +0200 @@ -26,9 +26,9 @@ <table bgcolor="#CCCCCC" width="100%" cellspacing="0" cellpadding="8" border="0"> <tr> <td> - <font size="4"> <a href="https://www.scintilla.org/scintilla530.zip"> + <font size="4"> <a href="https://www.scintilla.org/scintilla531.zip"> Windows</a> - <a href="https://www.scintilla.org/scintilla530.tgz"> + <a href="https://www.scintilla.org/scintilla531.tgz"> GTK/Linux</a> </font> </td> @@ -42,7 +42,7 @@ containing very few restrictions. </p> <h3> - Release 5.3.0 + Release 5.3.1 </h3> <h4> Source Code @@ -50,8 +50,8 @@ The source code package contains all of the source code for Scintilla but no binary executable code and is available in <ul> - <li><a href="https://www.scintilla.org/scintilla530.zip">zip format</a> (1.3M) commonly used on Windows</li> - <li><a href="https://www.scintilla.org/scintilla530.tgz">tgz format</a> (1.2M) commonly used on Linux and compatible operating systems</li> + <li><a href="https://www.scintilla.org/scintilla531.zip">zip format</a> (1.4M) commonly used on Windows</li> + <li><a href="https://www.scintilla.org/scintilla531.tgz">tgz format</a> (1.2M) commonly used on Linux and compatible operating systems</li> </ul> Instructions for building on both Windows and Linux are included in the readme file. <h4> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/doc/ScintillaHistory.html new/scintilla/doc/ScintillaHistory.html --- old/scintilla/doc/ScintillaHistory.html 2022-08-27 01:04:40.000000000 +0200 +++ new/scintilla/doc/ScintillaHistory.html 2022-10-12 03:48:46.000000000 +0200 @@ -571,10 +571,68 @@ <td>Christian Schmitz</td> <td>Michael Berlenz</td> <td>Jacky Yang</td> + </tr><tr> + <td>Reinhard Ni??l</td> + <td>Ferdinand Oeinck</td> </tr> </table> <h2>Releases</h2> <h3> + <a href="https://www.scintilla.org/scintilla531.zip">Release 5.3.1</a> + </h3> + <ul> + <li> + Released 12 October 2022. + </li> + <li> + Added SCI_STYLESETINVISIBLEREPRESENTATION to make it easier to edit around invisible text. + This also allows representing long lexemes with a single character to provide a summarized view. + <a href="https://sourceforge.net/p/scintilla/feature-requests/1453/">Feature #1453</a>. + </li> + <li> + Removed NotifyLexerChanged notification from DocWatcher. + This is a private interface but could be used by independent platform layers + and was exposed by ScintillaDocument in the Qt implementation of ScintillaEdit. + </li> + <li> + Draw lines more consistently in SC_PHASES_TWO and SC_PHASES_ONE modes by + clipping drawing to just the line rectangle. + This stops drawing some extreme ascenders, descenders and portions of indicators which + may appear and then disappear depending on which lines were drawn. + </li> + <li> + Draw SC_MARK_BAR markers underneath other markers + as they often cover multiple lines for change history and other markers mark individual lines. + </li> + <li> + Enlarge point and point top indicators and scale to be larger with larger text. + </li> + <li> + Suppress change history background line shading when printing. + <a href="https://sourceforge.net/p/scintilla/bugs/2358/">Bug #2358</a>. + </li> + <li> + Make SCI_LINESCROLL more accurate when width of space not integer. + <a href="https://sourceforge.net/p/scintilla/bugs/2357/">Bug #2357</a>. + </li> + <li> + On Win32 implement horizontal scrolling mouse wheel. + <a href="https://sourceforge.net/p/scintilla/feature-requests/1450/">Feature #1450</a>. + </li> + <li> + On Win32 implement horizontal scrolling with Shift + mouse wheel. + <a href="https://sourceforge.net/p/scintilla/feature-requests/749/">Feature #749</a>, + <a href="https://sourceforge.net/p/scintilla/feature-requests/1451/">Feature #1451</a>. + </li> + <li> + On Win32 ensure page and step clicks on horizontal scroll bar do not overshoot document width. + </li> + <li> + On GTK, fix bug where there were too many or too few lines when wrapping. + <a href="https://sourceforge.net/p/scintilla/bugs/2349/">Bug #2349</a>. + </li> + </ul> + <h3> <a href="https://www.scintilla.org/scintilla530.zip">Release 5.3.0</a> </h3> <ul> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/doc/index.html new/scintilla/doc/index.html --- old/scintilla/doc/index.html 2022-08-27 01:04:40.000000000 +0200 +++ new/scintilla/doc/index.html 2022-10-12 03:48:46.000000000 +0200 @@ -9,7 +9,7 @@ <meta name="keywords" content="Scintilla, SciTE, Editing Component, Text Editor" /> <meta name="Description" content="www.scintilla.org is the home of the Scintilla editing component and SciTE text editor application." /> - <meta name="Date.Modified" content="20220827" /> + <meta name="Date.Modified" content="20221012" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <style type="text/css"> #versionlist { @@ -56,8 +56,8 @@ GTK, and macOS</font> </td> <td width="40%" align="right"> - <font color="#FFCC99" size="3"> Release version 5.3.0<br /> - Site last modified August 27 2022</font> + <font color="#FFCC99" size="3"> Release version 5.3.1<br /> + Site last modified October 12 2022</font> </td> <td width="20%"> @@ -72,12 +72,11 @@ </tr> </table> <ul id="versionlist"> + <li>Version 5.3.1 can represent invisible text with a character to simplify editing and provide summarized views.</li> <li>Version 5.3.0 adds change history.</li> <li>Version 5.2.4 fixes failures on GTK with multi-threaded layout.</li> <li>Version 5.2.3 adds 64-bit safe APIs and fixes scrollbar on GTK with Xorg.</li> <li>Version 5.2.2 on GTK, scroll horizontally with Shift + Scroll Wheel.</li> - <li>Version 5.2.1 fixes leaks on GTK.</li> - <li>Version 5.2.0 adds multithreaded layout to significantly improve performance for very wide lines.</li> </ul> <ul id="menu"> <li id="remote1"><a href="https://www.scintilla.org/SciTEImage.html">Screenshot</a></li> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/gtk/ScintillaGTK.cxx new/scintilla/gtk/ScintillaGTK.cxx --- old/scintilla/gtk/ScintillaGTK.cxx 2022-07-09 01:45:48.000000000 +0200 +++ new/scintilla/gtk/ScintillaGTK.cxx 2022-10-12 03:48:46.000000000 +0200 @@ -1786,6 +1786,12 @@ } if (IS_WIDGET_MAPPED(PWidget(wMain))) { ChangeSize(); + } else { + const PRectangle rcTextArea = GetTextRectangle(); + if (wrapWidth != rcTextArea.Width()) { + wrapWidth = rcTextArea.Width(); + NeedWrapping(); + } } alloc.x = 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/include/Scintilla.h new/scintilla/include/Scintilla.h --- old/scintilla/include/Scintilla.h 2022-08-27 01:04:40.000000000 +0200 +++ new/scintilla/include/Scintilla.h 2022-10-12 03:48:46.000000000 +0200 @@ -280,6 +280,8 @@ #define SCI_STYLESETHOTSPOT 2409 #define SCI_STYLESETCHECKMONOSPACED 2254 #define SCI_STYLEGETCHECKMONOSPACED 2255 +#define SCI_STYLESETINVISIBLEREPRESENTATION 2256 +#define SCI_STYLEGETINVISIBLEREPRESENTATION 2257 #define SC_ELEMENT_LIST 0 #define SC_ELEMENT_LIST_BACK 1 #define SC_ELEMENT_LIST_SELECTED 2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/include/Scintilla.iface new/scintilla/include/Scintilla.iface --- old/scintilla/include/Scintilla.iface 2022-08-27 01:04:40.000000000 +0200 +++ new/scintilla/include/Scintilla.iface 2022-10-12 03:48:46.000000000 +0200 @@ -694,6 +694,12 @@ # Get whether a style may be monospaced. get bool StyleGetCheckMonospaced=2255(int style,) +# Set the invisible representation for a style. +set void StyleSetInvisibleRepresentation=2256(int style, string representation) + +# Get the invisible representation for a style. +get int StyleGetInvisibleRepresentation=2257(int style, stringresult representation) + enu Element=SC_ELEMENT_ val SC_ELEMENT_LIST=0 val SC_ELEMENT_LIST_BACK=1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/include/ScintillaCall.h new/scintilla/include/ScintillaCall.h --- old/scintilla/include/ScintillaCall.h 2022-08-27 01:04:40.000000000 +0200 +++ new/scintilla/include/ScintillaCall.h 2022-10-12 03:48:46.000000000 +0200 @@ -200,6 +200,9 @@ void StyleSetHotSpot(int style, bool hotspot); void StyleSetCheckMonospaced(int style, bool checkMonospaced); bool StyleGetCheckMonospaced(int style); + void StyleSetInvisibleRepresentation(int style, const char *representation); + int StyleGetInvisibleRepresentation(int style, char *representation); + std::string StyleGetInvisibleRepresentation(int style); void SetElementColour(Scintilla::Element element, ColourAlpha colourElement); ColourAlpha ElementColour(Scintilla::Element element); void ResetElementColour(Scintilla::Element element); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/include/ScintillaMessages.h new/scintilla/include/ScintillaMessages.h --- old/scintilla/include/ScintillaMessages.h 2022-08-27 01:04:40.000000000 +0200 +++ new/scintilla/include/ScintillaMessages.h 2022-10-12 03:48:46.000000000 +0200 @@ -136,6 +136,8 @@ StyleSetHotSpot = 2409, StyleSetCheckMonospaced = 2254, StyleGetCheckMonospaced = 2255, + StyleSetInvisibleRepresentation = 2256, + StyleGetInvisibleRepresentation = 2257, SetElementColour = 2753, GetElementColour = 2754, ResetElementColour = 2755, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/qt/ScintillaEdit/ScintillaDocument.cpp new/scintilla/qt/ScintillaEdit/ScintillaDocument.cpp --- old/scintilla/qt/ScintillaEdit/ScintillaDocument.cpp 2022-03-31 02:47:19.000000000 +0200 +++ new/scintilla/qt/ScintillaEdit/ScintillaDocument.cpp 2022-10-12 03:48:46.000000000 +0200 @@ -54,7 +54,6 @@ void NotifyModified(Document *doc, DocModification mh, void *userData) override; void NotifyDeleted(Document *doc, void *userData) noexcept override; void NotifyStyleNeeded(Document *doc, void *userData, Sci::Position endPos) override; - void NotifyLexerChanged(Document *doc, void *userData) override; void NotifyErrorOccurred(Document *doc, void *userData, Status status) override; }; @@ -85,10 +84,6 @@ emit owner->style_needed(endPos); } -void WatcherHelper::NotifyLexerChanged(Document *, void *) { - emit owner->lexer_changed(); -} - void WatcherHelper::NotifyErrorOccurred(Document *, void *, Status status) { emit owner->error_occurred(static_cast<int>(status)); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/qt/ScintillaEdit/ScintillaDocument.h new/scintilla/qt/ScintillaEdit/ScintillaDocument.h --- old/scintilla/qt/ScintillaEdit/ScintillaDocument.h 2022-03-31 02:47:19.000000000 +0200 +++ new/scintilla/qt/ScintillaEdit/ScintillaDocument.h 2022-10-12 03:48:46.000000000 +0200 @@ -82,7 +82,6 @@ void modified(int position, int modification_type, const QByteArray &text, int length, int linesAdded, int line, int foldLevelNow, int foldLevelPrev); void style_needed(int pos); - void lexer_changed(); void error_occurred(int status); friend class ::WatcherHelper; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/qt/ScintillaEdit/ScintillaEdit.pro new/scintilla/qt/ScintillaEdit/ScintillaEdit.pro --- old/scintilla/qt/ScintillaEdit/ScintillaEdit.pro 2022-08-27 01:04:40.000000000 +0200 +++ new/scintilla/qt/ScintillaEdit/ScintillaEdit.pro 2022-10-12 03:48:46.000000000 +0200 @@ -13,7 +13,7 @@ CONFIG += lib_bundle CONFIG += c++1z -VERSION = 5.3.0 +VERSION = 5.3.1 SOURCES += \ ScintillaEdit.cpp \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/qt/ScintillaEditBase/ScintillaEditBase.pro new/scintilla/qt/ScintillaEditBase/ScintillaEditBase.pro --- old/scintilla/qt/ScintillaEditBase/ScintillaEditBase.pro 2022-08-27 01:04:40.000000000 +0200 +++ new/scintilla/qt/ScintillaEditBase/ScintillaEditBase.pro 2022-10-12 03:48:46.000000000 +0200 @@ -12,7 +12,7 @@ CONFIG += lib_bundle CONFIG += c++1z -VERSION = 5.3.0 +VERSION = 5.3.1 SOURCES += \ PlatQt.cpp \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/scripts/FileGenerator.py new/scintilla/scripts/FileGenerator.py --- old/scintilla/scripts/FileGenerator.py 2022-03-31 02:47:19.000000000 +0200 +++ new/scintilla/scripts/FileGenerator.py 2022-10-12 03:48:46.000000000 +0200 @@ -32,7 +32,7 @@ newOrChanged = "New" with codecs.open(filename, "w", "utf-8") as outfile: outfile.write(updated) - print("%s %s" % (newOrChanged, filename)) + print("%s:0: %s" % (filename, newOrChanged)) # Automatically generated sections contain start and end comments, # a definition line and the results. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/src/CellBuffer.cxx new/scintilla/src/CellBuffer.cxx --- old/scintilla/src/CellBuffer.cxx 2022-08-27 01:04:40.000000000 +0200 +++ new/scintilla/src/CellBuffer.cxx 2022-10-12 03:48:46.000000000 +0200 @@ -1397,7 +1397,7 @@ void CellBuffer::ChangeHistorySet(bool set) { if (set) { - if (!changeHistory) { + if (!changeHistory && !uh.CanUndo()) { changeHistory = std::make_unique<ChangeHistory>(Length()); } } else { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/src/ChangeHistory.cxx new/scintilla/src/ChangeHistory.cxx --- old/scintilla/src/ChangeHistory.cxx 2022-08-27 01:04:40.000000000 +0200 +++ new/scintilla/src/ChangeHistory.cxx 2022-10-12 03:48:46.000000000 +0200 @@ -45,7 +45,7 @@ void ChangeStack::PushInsertion(Sci::Position positionInsertion, Sci::Position length, int edition) { steps.back()++; insertions.push_back({ positionInsertion, length, edition, InsertionSpan::Direction::insertion }); -}; +} size_t ChangeStack::PopStep() noexcept { const size_t spans = steps.back(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/src/Document.cxx new/scintilla/src/Document.cxx --- old/scintilla/src/Document.cxx 2022-08-27 01:04:41.000000000 +0200 +++ new/scintilla/src/Document.cxx 2022-10-12 03:48:46.000000000 +0200 @@ -58,7 +58,6 @@ void LexInterface::SetInstance(ILexer5 *instance_) { instance.reset(instance_); - pdoc->LexerChanged(); } void LexInterface::Colourise(Sci::Position start, Sci::Position end) { @@ -2432,13 +2431,6 @@ durationStyleOneByte.AddSample(pos - stylingStart, epStyling.Duration()); } -void Document::LexerChanged() { - // Tell the watchers the lexer has changed. - for (const WatcherWithUserData &watcher : watchers) { - watcher.watcher->NotifyLexerChanged(this, watcher.userData); - } -} - LexInterface *Document::GetLexInterface() const noexcept { return pli.get(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/src/Document.h new/scintilla/src/Document.h --- old/scintilla/src/Document.h 2022-08-27 01:04:41.000000000 +0200 +++ new/scintilla/src/Document.h 2022-10-12 03:48:46.000000000 +0200 @@ -484,7 +484,6 @@ Sci::Position GetEndStyled() const noexcept { return endStyled; } void EnsureStyledTo(Sci::Position pos); void StyleToAdjustingLineDuration(Sci::Position pos); - void LexerChanged(); int GetStyleClock() const noexcept { return styleClock; } void IncrementStyleClock() noexcept; void SCI_METHOD DecorationSetCurrentIndicator(int indicator) override; @@ -621,7 +620,6 @@ virtual void NotifyModified(Document *doc, DocModification mh, void *userData) = 0; virtual void NotifyDeleted(Document *doc, void *userData) noexcept = 0; virtual void NotifyStyleNeeded(Document *doc, void *userData, Sci::Position endPos) = 0; - virtual void NotifyLexerChanged(Document *doc, void *userData) = 0; virtual void NotifyErrorOccurred(Document *doc, void *userData, Scintilla::Status status) = 0; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/src/EditView.cxx new/scintilla/src/EditView.cxx --- old/scintilla/src/EditView.cxx 2022-08-27 01:04:41.000000000 +0200 +++ new/scintilla/src/EditView.cxx 2022-10-12 03:48:46.000000000 +0200 @@ -435,6 +435,21 @@ std::string_view(&ll->chars[ts.start], ts.length), &ll->positions[ts.start + 1], multiThreaded); } } + } else if (vstyle.styles[ll->styles[ts.start]].invisibleRepresentation[0]) { + const int styleInvisible = ll->styles[ts.start]; + const std::string_view text = vstyle.styles[styleInvisible].invisibleRepresentation; + XYPOSITION positionsRepr[Representation::maxLength + 1]; + // invisibleRepresentation is UTF-8 which only matches cache if document is UTF-8 + // or it only contains ASCII which is a subset of all currently supported encodings. + if (textUnicode || ViewIsASCII(text)) { + pCache->MeasureWidths(surface, vstyle, styleInvisible, text, positionsRepr, multiThreaded); + } else { + surface->MeasureWidthsUTF8(vstyle.styles[styleInvisible].font.get(), text, positionsRepr); + } + const XYPOSITION representationWidth = positionsRepr[text.length() - 1]; + for (int ii = 0; ii < ts.length; ii++) { + ll->positions[ts.start + 1 + ii] = representationWidth; + } } } } @@ -1244,7 +1259,8 @@ const XYPOSITION left = ll->XInLine(startPos) + horizontalOffset; const XYPOSITION right = ll->XInLine(endPos) + horizontalOffset; - const PRectangle rcIndic(left, rcLine.top + vsDraw.maxAscent, right, rcLine.top + vsDraw.maxAscent + 3); + const PRectangle rcIndic(left, rcLine.top + vsDraw.maxAscent, right, + std::max(rcLine.top + vsDraw.maxAscent + 3, rcLine.bottom)); if (bidiEnabled) { ScreenLine screenLine(ll, subLine, vsDraw, rcLine.right - xStart, tabWidthMinimumPixels); @@ -1638,6 +1654,11 @@ surface->FillRectangle(Side(rcBorder, Edge::bottom, 1), colourBorder); } } + } else { + // No annotation to draw so show bug with bugColour + if (FlagSet(phase, DrawPhase::back)) { + surface->FillRectangle(rcSegment, bugColour.Opaque()); + } } } @@ -2224,6 +2245,15 @@ surface->DrawTextNoClip(rcSegment, textFont, rcSegment.top + vsDraw.maxAscent, text, textFore, textBack); } + } else if (vsDraw.styles[styleMain].invisibleRepresentation[0]) { + const std::string_view text = vsDraw.styles[styleMain].invisibleRepresentation; + if (phasesDraw != PhasesDraw::One) { + surface->DrawTextTransparentUTF8(rcSegment, textFont, + rcSegment.top + vsDraw.maxAscent, text, textFore); + } else { + surface->DrawTextNoClipUTF8(rcSegment, textFont, + rcSegment.top + vsDraw.maxAscent, text, textFore, textBack); + } } if (vsDraw.viewWhitespace != WhiteSpace::Invisible || (inIndentation && vsDraw.viewIndentationGuides != IndentView::None)) { @@ -2349,6 +2379,11 @@ return; // No further drawing } + const bool clipLine = !bufferedDraw && !LinesOverlap(); + if (clipLine) { + surface->SetClip(rcLine); + } + // See if something overrides the line background colour. const std::optional<ColourRGBA> background = vsDraw.Background(model.GetMark(line), model.caret.active, ll->containsCaret); @@ -2424,6 +2459,10 @@ if (FlagSet(phase, DrawPhase::lineTranslucent)) { DrawTranslucentLineState(surface, model, vsDraw, ll, line, rcLine, subLine, Layer::OverText); } + + if (clipLine) { + surface->PopClip(); + } } static void DrawFoldLines(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, @@ -2769,6 +2808,14 @@ vsPrint.Refresh(*surfaceMeasure, model.pdoc->tabInChars); // Recalculate fixedColumnWidth } + // Turn off change history marker backgrounds + constexpr unsigned int changeMarkers = + 1u << static_cast<unsigned int>(MarkerOutline::HistoryRevertedToOrigin) | + 1u << static_cast<unsigned int>(MarkerOutline::HistorySaved) | + 1u << static_cast<unsigned int>(MarkerOutline::HistoryModified) | + 1u << static_cast<unsigned int>(MarkerOutline::HistoryRevertedToModified); + vsPrint.maskInLine &= ~changeMarkers; + const Sci::Line linePrintStart = model.pdoc->SciLineFromPosition(chrg.cpMin); Sci::Line linePrintLast = linePrintStart + (rc.bottom - rc.top) / vsPrint.lineHeight - 1; if (linePrintLast < linePrintStart) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/src/Editor.cxx new/scintilla/src/Editor.cxx --- old/scintilla/src/Editor.cxx 2022-08-27 01:04:41.000000000 +0200 +++ new/scintilla/src/Editor.cxx 2022-10-12 03:48:46.000000000 +0200 @@ -2379,9 +2379,6 @@ NotifyStyleToNeeded(endStyleNeeded); } -void Editor::NotifyLexerChanged(Document *, void *) { -} - void Editor::NotifyErrorOccurred(Document *, void *, Status status) { errorStatus = status; } @@ -5835,6 +5832,19 @@ case Message::StyleSetVisible: vs.styles[wParam].visible = lParam != 0; break; + case Message::StyleSetInvisibleRepresentation: { + const char *utf8 = ConstCharPtrFromSPtr(lParam); + char *rep = vs.styles[wParam].invisibleRepresentation; + const int classified = UTF8Classify(utf8); + if (!(classified & UTF8MaskInvalid)) { + // valid UTF-8 + int len = classified & UTF8MaskWidth; + while (len--) + *rep++ = *utf8++; + } + *rep = 0; + break; + } case Message::StyleSetChangeable: vs.styles[wParam].changeable = lParam != 0; break; @@ -5881,6 +5891,8 @@ return vs.styles[wParam].visible ? 1 : 0; case Message::StyleGetChangeable: return vs.styles[wParam].changeable ? 1 : 0; + case Message::StyleGetInvisibleRepresentation: + return StringResult(lParam, vs.styles[wParam].invisibleRepresentation); case Message::StyleGetHotSpot: return vs.styles[wParam].hotspot ? 1 : 0; case Message::StyleGetCheckMonospaced: @@ -6245,7 +6257,7 @@ case Message::LineScroll: ScrollTo(topLine + lParam); - HorizontalScrollTo(xOffset + static_cast<int>(wParam) * static_cast<int>(vs.spaceWidth)); + HorizontalScrollTo(xOffset + static_cast<int>(static_cast<int>(wParam) * vs.spaceWidth)); return 1; case Message::SetXOffset: @@ -7331,6 +7343,7 @@ case Message::StyleSetChangeable: case Message::StyleSetHotSpot: case Message::StyleSetCheckMonospaced: + case Message::StyleSetInvisibleRepresentation: StyleSetMessage(iMessage, wParam, lParam); break; @@ -7350,6 +7363,7 @@ case Message::StyleGetChangeable: case Message::StyleGetHotSpot: case Message::StyleGetCheckMonospaced: + case Message::StyleGetInvisibleRepresentation: return StyleGetMessage(iMessage, wParam, lParam); case Message::StyleResetDefault: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/src/Editor.h new/scintilla/src/Editor.h --- old/scintilla/src/Editor.h 2022-08-27 01:04:41.000000000 +0200 +++ new/scintilla/src/Editor.h 2022-10-12 03:48:46.000000000 +0200 @@ -471,7 +471,6 @@ void NotifyModified(Document *document, DocModification mh, void *userData) override; void NotifyDeleted(Document *document, void *userData) noexcept override; void NotifyStyleNeeded(Document *doc, void *userData, Sci::Position endStyleNeeded) override; - void NotifyLexerChanged(Document *doc, void *userData) override; void NotifyErrorOccurred(Document *doc, void *userData, Scintilla::Status status) override; void NotifyMacroRecord(Scintilla::Message iMessage, Scintilla::uptr_t wParam, Scintilla::sptr_t lParam); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/src/Geometry.cxx new/scintilla/src/Geometry.cxx --- old/scintilla/src/Geometry.cxx 2022-03-31 02:47:19.000000000 +0200 +++ new/scintilla/src/Geometry.cxx 2022-10-12 03:48:46.000000000 +0200 @@ -75,10 +75,14 @@ return std::floor(xy * pixelDivisions) / pixelDivisions; } +XYPOSITION PixelAlignCeil(XYPOSITION xy, int pixelDivisions) noexcept { + return std::ceil(xy * pixelDivisions) / pixelDivisions; +} + Point PixelAlign(const Point &pt, int pixelDivisions) noexcept { return Point( - std::round(pt.x * pixelDivisions) / pixelDivisions, - std::round(pt.y * pixelDivisions) / pixelDivisions); + PixelAlign(pt.x, pixelDivisions), + PixelAlign(pt.y, pixelDivisions)); } PRectangle PixelAlign(const PRectangle &rc, int pixelDivisions) noexcept { @@ -88,19 +92,19 @@ // On retina displays, the positions should be moved to the nearest device // pixel which is the nearest half logical pixel. return PRectangle( - std::round(rc.left * pixelDivisions) / pixelDivisions, + PixelAlign(rc.left, pixelDivisions), PixelAlignFloor(rc.top, pixelDivisions), - std::round(rc.right * pixelDivisions) / pixelDivisions, + PixelAlign(rc.right, pixelDivisions), PixelAlignFloor(rc.bottom, pixelDivisions)); } PRectangle PixelAlignOutside(const PRectangle &rc, int pixelDivisions) noexcept { // Move left and right side to extremes (floor(left) ceil(right)) to avoid blurry visuals. return PRectangle( - std::floor(rc.left * pixelDivisions) / pixelDivisions, - std::floor(rc.top * pixelDivisions) / pixelDivisions, - std::ceil(rc.right * pixelDivisions) / pixelDivisions, - std::floor(rc.bottom * pixelDivisions) / pixelDivisions); + PixelAlignFloor(rc.left, pixelDivisions), + PixelAlignFloor(rc.top, pixelDivisions), + PixelAlignCeil(rc.right, pixelDivisions), + PixelAlignFloor(rc.bottom, pixelDivisions)); } ColourRGBA ColourRGBA::MixedWith(ColourRGBA other) const noexcept { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/src/Geometry.h new/scintilla/src/Geometry.h --- old/scintilla/src/Geometry.h 2022-03-31 02:47:19.000000000 +0200 +++ new/scintilla/src/Geometry.h 2022-10-12 03:48:46.000000000 +0200 @@ -149,6 +149,7 @@ XYPOSITION PixelAlign(XYPOSITION xy, int pixelDivisions) noexcept; XYPOSITION PixelAlignFloor(XYPOSITION xy, int pixelDivisions) noexcept; +XYPOSITION PixelAlignCeil(XYPOSITION xy, int pixelDivisions) noexcept; Point PixelAlign(const Point &pt, int pixelDivisions) noexcept; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/src/Indicator.cxx new/scintilla/src/Indicator.cxx --- old/scintilla/src/Indicator.cxx 2022-08-27 01:04:41.000000000 +0200 +++ new/scintilla/src/Indicator.cxx 2022-10-12 03:48:46.000000000 +0200 @@ -265,15 +265,15 @@ case IndicatorStyle::Point: case IndicatorStyle::PointCharacter: if (rcCharacter.Width() >= 0.1) { - const XYPOSITION pixelHeight = std::floor(rc.Height() - 1.0f); // 1 pixel onto next line if multiphase + const XYPOSITION pixelHeight = std::floor(rc.Height()); // 1 pixel onto next line if multiphase const XYPOSITION x = (sacDraw.style == IndicatorStyle::Point) ? (rcCharacter.left) : ((rcCharacter.right + rcCharacter.left) / 2); // 0.5f is to hit midpoint of pixels: const XYPOSITION ix = std::round(x) + 0.5f; - const XYPOSITION iy = std::floor(rc.top) + 0.5f; + const XYPOSITION iy = std::ceil(rc.bottom) + 0.5f; const Point pts[] = { - Point(ix - pixelHeight, iy + pixelHeight), // Left - Point(ix + pixelHeight, iy + pixelHeight), // Right - Point(ix, iy) // Top + Point(ix - pixelHeight, iy), // Left + Point(ix + pixelHeight, iy), // Right + Point(ix, iy - pixelHeight) // Top }; surface->Polygon(pts, std::size(pts), FillStroke(sacDraw.fore)); } @@ -281,11 +281,11 @@ case IndicatorStyle::PointTop: if (rcCharacter.Width() >= 0.1) { - const XYPOSITION pixelHeight = std::floor(rc.Height() - 1.0f); // 1 pixel onto previous line if multiphase + const XYPOSITION pixelHeight = std::floor(rc.Height()); // 1 pixel onto previous line if multiphase const XYPOSITION x = rcCharacter.left; // 0.5f is to hit midpoint of pixels: const XYPOSITION ix = std::round(x) + 0.5f; - const XYPOSITION iy = std::floor(rcLine.top) + 0.5f; + const XYPOSITION iy = std::floor(rcLine.top) - 0.5f; const Point pts[] = { Point(ix - pixelHeight, iy), // Left Point(ix + pixelHeight, iy), // Right diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/src/MarginView.cxx new/scintilla/src/MarginView.cxx --- old/scintilla/src/MarginView.cxx 2022-08-27 01:04:41.000000000 +0200 +++ new/scintilla/src/MarginView.cxx 2022-10-12 03:48:46.000000000 +0200 @@ -239,10 +239,42 @@ return 0; } +LineMarker::FoldPart PartForFoldHighlight(const HighlightDelimiter &highlightDelimiter, Sci::Line lineDoc, bool firstSubLine, bool headWithTail, bool isExpanded) noexcept { + if (highlightDelimiter.IsFoldBlockHighlighted(lineDoc)) { + if (highlightDelimiter.IsBodyOfFoldBlock(lineDoc)) { + return LineMarker::FoldPart::body; + } + if (highlightDelimiter.IsHeadOfFoldBlock(lineDoc)) { + if (firstSubLine) { + return headWithTail ? LineMarker::FoldPart::headWithTail : LineMarker::FoldPart::head; + } + if (isExpanded || headWithTail) { + return LineMarker::FoldPart::body; + } + } else if (highlightDelimiter.IsTailOfFoldBlock(lineDoc)) { + return LineMarker::FoldPart::tail; + } + } + return LineMarker::FoldPart::undefined; +} + +constexpr LineMarker::FoldPart PartForBar(bool markBefore, bool markAfter) { + if (markBefore) { + if (markAfter) { + return LineMarker::FoldPart::body; + } + return LineMarker::FoldPart::tail; + } + if (markAfter) { + return LineMarker::FoldPart::head; + } + return LineMarker::FoldPart::headWithTail; +} + } void MarginView::PaintOneMargin(Surface *surface, PRectangle rc, PRectangle rcOneMargin, const MarginStyle &marginStyle, - const EditModel &model, const ViewStyle &vs) { + const EditModel &model, const ViewStyle &vs) const { const Point ptOrigin = model.GetVisibleOriginInMain(); const Sci::Line lineStartPaint = static_cast<Sci::Line>(rcOneMargin.top + ptOrigin.y) / vs.lineHeight; Sci::Line visibleLine = model.TopLineOfMain() + lineStartPaint; @@ -290,25 +322,27 @@ } bool headWithTail = false; + bool isExpanded = false; if (marginStyle.ShowsFolding()) { // Decide which fold indicator should be displayed const FoldLevel level = model.pdoc->GetFoldLevel(lineDoc); const FoldLevel levelNext = model.pdoc->GetFoldLevel(lineDoc + 1); - const FoldLevel levelNum = LevelNumberPart(level); - const FoldLevel levelNextNum = LevelNumberPart(levelNext); - const bool isExpanded = model.pcs->GetExpanded(lineDoc); + isExpanded = model.pcs->GetExpanded(lineDoc); marks |= FoldingMark(level, levelNext, firstSubLine, lastSubLine, isExpanded, needWhiteClosure, folderOpenMid, folderEnd); + const FoldLevel levelNum = LevelNumberPart(level); + const FoldLevel levelNextNum = LevelNumberPart(levelNext); + // Change needWhiteClosure and headWithTail if needed if (LevelIsHeader(level)) { needWhiteClosure = false; - const Sci::Line firstFollowupLine = model.pcs->DocFromDisplay(model.pcs->DisplayFromDoc(lineDoc + 1)); - const FoldLevel firstFollowupLineLevel = model.pdoc->GetFoldLevel(firstFollowupLine); - const FoldLevel secondFollowupLineLevelNum = LevelNumberPart(model.pdoc->GetFoldLevel(firstFollowupLine + 1)); if (!isExpanded) { + const Sci::Line firstFollowupLine = model.pcs->DocFromDisplay(model.pcs->DisplayFromDoc(lineDoc + 1)); + const FoldLevel firstFollowupLineLevel = model.pdoc->GetFoldLevel(firstFollowupLine); + const FoldLevel secondFollowupLineLevelNum = LevelNumberPart(model.pdoc->GetFoldLevel(firstFollowupLine + 1)); if (LevelIsWhitespace(firstFollowupLineLevel) && (levelNum > secondFollowupLineLevelNum)) needWhiteClosure = true; @@ -397,44 +431,25 @@ marks &= marginStyle.mask; if (marks) { - for (int markBit = 0; (markBit < 32) && marks; markBit++) { - if (marks & 1) { - LineMarker::FoldPart part = LineMarker::FoldPart::undefined; - if (marginStyle.ShowsFolding() && highlightDelimiter.IsFoldBlockHighlighted(lineDoc)) { - if (highlightDelimiter.IsBodyOfFoldBlock(lineDoc)) { - part = LineMarker::FoldPart::body; - } else if (highlightDelimiter.IsHeadOfFoldBlock(lineDoc)) { - if (firstSubLine) { - part = headWithTail ? LineMarker::FoldPart::headWithTail : LineMarker::FoldPart::head; - } else { - if (model.pcs->GetExpanded(lineDoc) || headWithTail) { - part = LineMarker::FoldPart::body; - } else { - part = LineMarker::FoldPart::undefined; - } - } - } else if (highlightDelimiter.IsTailOfFoldBlock(lineDoc)) { - part = LineMarker::FoldPart::tail; - } - } - if (vs.markers[markBit].markType == MarkerSymbol::Bar) { - const int mask = 1 << markBit; - const bool markBefore = firstSubLine ? (model.GetMark(lineDoc-1) & mask) : true; - const bool markAfter = lastSubLine ? (model.GetMark(lineDoc+1) & mask) : true; - if (markBefore) { - if (markAfter) { - part = LineMarker::FoldPart::body; - } else { - part = LineMarker::FoldPart::tail; - } - } else { - if (markAfter) { - part = LineMarker::FoldPart::head; - } else { - part = LineMarker::FoldPart::headWithTail; - } - } - } + // Draw all the bar markers first so they are underneath as they often cover + // multiple lines for change history and other markers mark individual lines. + int marksBar = marks; + for (int markBit = 0; (markBit <= MarkerMax) && marksBar; markBit++) { + if ((marksBar & 1) && (vs.markers[markBit].markType == MarkerSymbol::Bar)) { + const int mask = 1 << markBit; + const bool markBefore = firstSubLine ? (model.GetMark(lineDoc - 1) & mask) : true; + const bool markAfter = lastSubLine ? (model.GetMark(lineDoc + 1) & mask) : true; + vs.markers[markBit].Draw(surface, rcMarker, vs.styles[StyleLineNumber].font.get(), + PartForBar(markBefore, markAfter), marginStyle.style); + } + marksBar >>= 1; + } + // Draw all the other markers over the bar markers + for (int markBit = 0; (markBit <= MarkerMax) && marks; markBit++) { + if ((marks & 1) && (vs.markers[markBit].markType != MarkerSymbol::Bar)) { + const LineMarker::FoldPart part = marginStyle.ShowsFolding() ? + PartForFoldHighlight(highlightDelimiter, lineDoc, firstSubLine, headWithTail, isExpanded) : + LineMarker::FoldPart::undefined; vs.markers[markBit].Draw(surface, rcMarker, vs.styles[StyleLineNumber].font.get(), part, marginStyle.style); } marks >>= 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/src/MarginView.h new/scintilla/src/MarginView.h --- old/scintilla/src/MarginView.h 2022-03-31 02:47:19.000000000 +0200 +++ new/scintilla/src/MarginView.h 2022-10-12 03:48:46.000000000 +0200 @@ -37,7 +37,7 @@ void DropGraphics() noexcept; void RefreshPixMaps(Surface *surfaceWindow, const ViewStyle &vsDraw); void PaintOneMargin(Surface *surface, PRectangle rc, PRectangle rcOneMargin, const MarginStyle &marginStyle, - const EditModel &model, const ViewStyle &vs); + const EditModel &model, const ViewStyle &vs) const; void PaintMargin(Surface *surface, Sci::Line topLine, PRectangle rc, PRectangle rcMargin, const EditModel &model, const ViewStyle &vs); }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/src/ScintillaBase.cxx new/scintilla/src/ScintillaBase.cxx --- old/scintilla/src/ScintillaBase.cxx 2022-03-31 02:47:19.000000000 +0200 +++ new/scintilla/src/ScintillaBase.cxx 2022-10-12 03:48:46.000000000 +0200 @@ -809,10 +809,6 @@ Editor::NotifyStyleToNeeded(endStyleNeeded); } -void ScintillaBase::NotifyLexerChanged(Document *, void *) { - vs.EnsureStyle(0xff); -} - sptr_t ScintillaBase::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) { switch (iMessage) { case Message::AutoCShow: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/src/ScintillaBase.h new/scintilla/src/ScintillaBase.h --- old/scintilla/src/ScintillaBase.h 2022-03-31 02:47:19.000000000 +0200 +++ new/scintilla/src/ScintillaBase.h 2022-10-12 03:48:46.000000000 +0200 @@ -82,7 +82,6 @@ void RightButtonDownWithModifiers(Point pt, unsigned int curTime, Scintilla::KeyMod modifiers) override; void NotifyStyleToNeeded(Sci::Position endStyleNeeded) override; - void NotifyLexerChanged(Document *doc, void *userData) override; public: ~ScintillaBase() override; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/src/Style.cxx new/scintilla/src/Style.cxx --- old/scintilla/src/Style.cxx 2022-03-31 02:47:19.000000000 +0200 +++ new/scintilla/src/Style.cxx 2022-10-12 03:48:46.000000000 +0200 @@ -72,7 +72,8 @@ caseForce(CaseForce::mixed), visible(true), changeable(true), - hotspot(false) { + hotspot(false), + invisibleRepresentation{} { } void Style::Copy(std::shared_ptr<Font> font_, const FontMeasurements &fm_) noexcept { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/src/Style.h new/scintilla/src/Style.h --- old/scintilla/src/Style.h 2022-03-31 02:47:19.000000000 +0200 +++ new/scintilla/src/Style.h 2022-10-12 03:48:46.000000000 +0200 @@ -51,6 +51,7 @@ bool visible; bool changeable; bool hotspot; + char invisibleRepresentation[5]; std::shared_ptr<Font> font; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/test/XiteWin.py new/scintilla/test/XiteWin.py --- old/scintilla/test/XiteWin.py 2022-03-31 02:47:19.000000000 +0200 +++ new/scintilla/test/XiteWin.py 2022-10-12 03:48:46.000000000 +0200 @@ -168,6 +168,17 @@ self.face.features.update(faceLex.features) except FileNotFoundError: print("Can't find " + "LexicalStyles.iface") + if scintillaIncludesLexers: + sciName = "SciLexer.DLL" + else: + sciName = "Scintilla.DLL" + try: + scintillaDLLPath = os.path.join(scintillaBinDirectory, sciName) + ctypes.cdll.LoadLibrary(scintillaDLLPath) + except OSError: + print("Can't find " + sciName) + print("Python is built for " + " ".join(platform.architecture())) + sys.exit() self.titleDirty = True self.fullPath = "" @@ -208,17 +219,6 @@ def OnCreate(self, hwnd): self.win = hwnd - if scintillaIncludesLexers: - sciName = "SciLexer.DLL" - else: - sciName = "Scintilla.DLL" - try: - scintillaDLLPath = os.path.join(scintillaBinDirectory, sciName) - ctypes.cdll.LoadLibrary(scintillaDLLPath) - except OSError: - print("Can't find " + sciName) - print("Python is built for " + " ".join(platform.architecture())) - sys.exit() self.sciHwnd = user32.CreateWindowExW(0, "Scintilla", "Source", WS_CHILD | WS_VSCROLL | WS_HSCROLL | WS_CLIPCHILDREN, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/test/simpleTests.py new/scintilla/test/simpleTests.py --- old/scintilla/test/simpleTests.py 2022-08-27 01:04:41.000000000 +0200 +++ new/scintilla/test/simpleTests.py 2022-10-12 03:48:46.000000000 +0200 @@ -708,6 +708,32 @@ self.assertEquals(self.ed.IsRangeWord(6, 7), 0) self.assertEquals(self.ed.IsRangeWord(6, 8), 1) +class TestChangeHistory(unittest.TestCase): + + def setUp(self): + self.xite = Xite.xiteFrame + self.ed = self.xite.ed + self.ed.ClearAll() + self.ed.EmptyUndoBuffer() + self.data = b"xy" + + def testChangeHistory(self): + self.assertEquals(self.ed.ChangeHistory, 0) + self.assertEquals(self.ed.UndoCollection, 1) + self.ed.UndoCollection = 0 + self.assertEquals(self.ed.UndoCollection, 0) + self.ed.InsertText(0, self.data) + self.ed.UndoCollection = 1 + self.ed.ChangeHistory = 1 + self.assertEquals(self.ed.ChangeHistory, 1) + self.ed.InsertText(0, self.data) + self.ed.DeleteRange(0, 2) + self.ed.ChangeHistory = 0 + self.assertEquals(self.ed.ChangeHistory, 0) + self.ed.ChangeHistory = 1 + self.assertEquals(self.ed.ChangeHistory, 1) + self.ed.Undo() + MODI = 1 UNDO = 2 REDO = 4 @@ -1930,6 +1956,7 @@ self.ed.EmptyUndoBuffer() self.testColour = 0x171615 self.testFont = b"Georgia" + self.testRepresentation = "\N{BULLET}".encode("utf-8") def tearDown(self): self.ed.StyleResetDefault() @@ -1945,6 +1972,13 @@ self.ed.StyleSetSizeFractional(self.ed.STYLE_DEFAULT, 1234) self.assertEquals(self.ed.StyleGetSizeFractional(self.ed.STYLE_DEFAULT), 1234) + def testInvisibleRepresentation(self): + self.assertEquals(self.ed.StyleGetInvisibleRepresentation(self.ed.STYLE_DEFAULT), b"") + self.ed.StyleSetInvisibleRepresentation(self.ed.STYLE_DEFAULT, self.testRepresentation) + self.assertEquals(self.ed.StyleGetInvisibleRepresentation(self.ed.STYLE_DEFAULT), self.testRepresentation) + self.ed.StyleSetInvisibleRepresentation(self.ed.STYLE_DEFAULT, b"\000") + self.assertEquals(self.ed.StyleGetInvisibleRepresentation(self.ed.STYLE_DEFAULT), b"") + def testBold(self): self.ed.StyleSetBold(self.ed.STYLE_DEFAULT, 1) self.assertEquals(self.ed.StyleGetBold(self.ed.STYLE_DEFAULT), 1) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/test/unit/testGeometry.cxx new/scintilla/test/unit/testGeometry.cxx --- old/scintilla/test/unit/testGeometry.cxx 2022-03-31 02:47:19.000000000 +0200 +++ new/scintilla/test/unit/testGeometry.cxx 2022-10-12 03:48:46.000000000 +0200 @@ -148,36 +148,49 @@ // Whole pixels REQUIRE(PixelAlign(1.0, 1) == 1.0); REQUIRE(PixelAlignFloor(1.0, 1) == 1.0); + REQUIRE(PixelAlignCeil(1.0, 1) == 1.0); REQUIRE(PixelAlign(1.25, 1) == 1.0); REQUIRE(PixelAlignFloor(1.25, 1) == 1.0); + REQUIRE(PixelAlignCeil(1.25, 1) == 2.0); REQUIRE(PixelAlign(1.5, 1) == 2.0); REQUIRE(PixelAlignFloor(1.5, 1) == 1.0); + REQUIRE(PixelAlignCeil(1.5, 1) == 2.0); REQUIRE(PixelAlign(1.75, 1) == 2.0); REQUIRE(PixelAlignFloor(1.75, 1) == 1.0); + REQUIRE(PixelAlignCeil(1.75, 1) == 2.0); + + REQUIRE(PixelAlign(Point(1.75, 1.25), 1) == Point(2.0, 1.0)); + REQUIRE(PixelAlign(Point(1.5, 1.0), 1) == Point(2.0, 1.0)); // Half pixels REQUIRE(PixelAlign(1.0, 2) == 1.0); REQUIRE(PixelAlignFloor(1.0, 2) == 1.0); + REQUIRE(PixelAlignCeil(1.0, 2) == 1.0); REQUIRE(PixelAlign(1.25, 2) == 1.5); REQUIRE(PixelAlignFloor(1.25, 2) == 1.0); + REQUIRE(PixelAlignCeil(1.25, 2) == 1.5); REQUIRE(PixelAlign(1.5, 2) == 1.5); REQUIRE(PixelAlignFloor(1.5, 2) == 1.5); + REQUIRE(PixelAlignCeil(1.5, 2) == 1.5); REQUIRE(PixelAlign(1.75, 2) == 2.0); REQUIRE(PixelAlignFloor(1.75, 2) == 1.5); + REQUIRE(PixelAlignCeil(1.75, 2) == 2.0); REQUIRE(PixelAlign(Point(1.75, 1.25), 2) == Point(2.0, 1.5)); REQUIRE(PixelAlign(Point(1.5, 1.0), 2) == Point(1.5, 1.0)); // x->round, y->floored + REQUIRE(PixelAlign(PRectangle(1.0, 1.25, 1.5, 1.75), 1) == PRectangle(1.0, 1.0, 2.0, 1.0)); REQUIRE(PixelAlign(PRectangle(1.0, 1.25, 1.5, 1.75), 2) == PRectangle(1.0, 1.0, 1.5, 1.5)); // x->outside(floor left, ceil right), y->floored + REQUIRE(PixelAlignOutside(PRectangle(1.1, 1.25, 1.6, 1.75), 1) == PRectangle(1.0, 1.0, 2.0, 1.0)); REQUIRE(PixelAlignOutside(PRectangle(1.1, 1.25, 1.6, 1.75), 2) == PRectangle(1.0, 1.0, 2.0, 1.5)); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/version.txt new/scintilla/version.txt --- old/scintilla/version.txt 2022-08-27 01:04:41.000000000 +0200 +++ new/scintilla/version.txt 2022-10-12 03:48:46.000000000 +0200 @@ -1 +1 @@ -530 +531 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/win32/PlatWin.cxx new/scintilla/win32/PlatWin.cxx --- old/scintilla/win32/PlatWin.cxx 2022-08-27 01:04:41.000000000 +0200 +++ new/scintilla/win32/PlatWin.cxx 2022-10-12 03:48:46.000000000 +0200 @@ -3203,15 +3203,17 @@ ID2D1DCRenderTarget *pDCRT = nullptr; HRESULT hr = pD2DFactory->CreateDCRenderTarget(&props, &pDCRT); if (SUCCEEDED(hr) && pDCRT) { - RECT rcWindow; - GetClientRect(pDrawItem->hwndItem, &rcWindow); - hr = pDCRT->BindDC(pDrawItem->hDC, &rcWindow); + const long left = pDrawItem->rcItem.left + static_cast<long>(ItemInset.x + ImageInset.x); + + RECT rcItem = pDrawItem->rcItem; + rcItem.left = left; + rcItem.right = rcItem.left + images.GetWidth(); + + hr = pDCRT->BindDC(pDrawItem->hDC, &rcItem); if (SUCCEEDED(hr)) { surfaceItem->Init(pDCRT, pDrawItem->hwndItem); pDCRT->BeginDraw(); - const long left = pDrawItem->rcItem.left + static_cast<long>(ItemInset.x + ImageInset.x); - const PRectangle rcImage = PRectangle::FromInts(left, pDrawItem->rcItem.top, - left + images.GetWidth(), pDrawItem->rcItem.bottom); + const PRectangle rcImage = PRectangle::FromInts(0, 0, images.GetWidth(), rcItem.bottom - rcItem.top); surfaceItem->DrawRGBAImage(rcImage, pimage->GetWidth(), pimage->GetHeight(), pimage->Pixels()); pDCRT->EndDraw(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/win32/ScintRes.rc new/scintilla/win32/ScintRes.rc --- old/scintilla/win32/ScintRes.rc 2022-08-27 01:04:41.000000000 +0200 +++ new/scintilla/win32/ScintRes.rc 2022-10-12 03:48:46.000000000 +0200 @@ -4,8 +4,8 @@ #include <windows.h> -#define VERSION_SCINTILLA "5.3.0" -#define VERSION_WORDS 5, 3, 0, 0 +#define VERSION_SCINTILLA "5.3.1" +#define VERSION_WORDS 5, 3, 1, 0 VS_VERSION_INFO VERSIONINFO FILEVERSION VERSION_WORDS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/win32/ScintillaWin.cxx new/scintilla/win32/ScintillaWin.cxx --- old/scintilla/win32/ScintillaWin.cxx 2022-08-27 01:04:41.000000000 +0200 +++ new/scintilla/win32/ScintillaWin.cxx 2022-10-12 03:48:46.000000000 +0200 @@ -276,6 +276,25 @@ } }; +class MouseWheelDelta { + int wheelDelta = 0; +public: + bool Accumulate(WPARAM wParam) noexcept { + wheelDelta -= GET_WHEEL_DELTA_WPARAM(wParam); + return std::abs(wheelDelta) >= WHEEL_DELTA; + } + int Actions() noexcept { + const int actions = wheelDelta / WHEEL_DELTA; + wheelDelta = wheelDelta % WHEEL_DELTA; + return actions; + } +}; + +struct HorizontalScrollRange { + int pageWidth; + int documentWidth; +}; + } namespace Scintilla::Internal { @@ -293,7 +312,9 @@ SetCoalescableTimerSig SetCoalescableTimerFn; unsigned int linesPerScroll; ///< Intellimouse support - int wheelDelta; ///< Wheel delta from roll + unsigned int charsPerScroll; ///< Intellimouse support + MouseWheelDelta verticalWheelDelta; + MouseWheelDelta horizontalWheelDelta; UINT dpi = USER_DEFAULT_SCREEN_DPI; ReverseArrowCursor reverseArrowCursor; @@ -404,6 +425,8 @@ void UpdateSystemCaret() override; void SetVerticalScrollPos() override; void SetHorizontalScrollPos() override; + void HorizontalScrollToClamped(int xPos); + HorizontalScrollRange GetHorizontalScrollRange() const; bool ModifyScrollBars(Sci::Line nMax, Sci::Line nPage) override; void NotifyChange() override; void NotifyFocus(bool focus) override; @@ -504,7 +527,7 @@ SetCoalescableTimerFn = nullptr; linesPerScroll = 0; - wheelDelta = 0; // Wheel delta from roll + charsPerScroll = 0; dpi = DpiForWindow(hwnd); @@ -1533,6 +1556,7 @@ return ::DefWindowProc(MainHWND(), iMessage, wParam, lParam); case WM_MOUSEWHEEL: + case WM_MOUSEHWHEEL: if (!mouseWheelCaptures) { // if the mouse wheel is not captured, test if the mouse // pointer is over the editor window and if not, don't @@ -1550,27 +1574,30 @@ break; } - // Don't handle datazoom. - // (A good idea for datazoom would be to "fold" or "unfold" details. - // i.e. if datazoomed out only class structures are visible, when datazooming in the control - // structures appear, then eventually the individual statements...) - if (wParam & MK_SHIFT) { - return ::DefWindowProc(MainHWND(), iMessage, wParam, lParam); + // Treat Shift+WM_MOUSEWHEEL as horizontal scrolling, not data-zoom. + if (iMessage == WM_MOUSEHWHEEL || (wParam & MK_SHIFT)) { + if (vs.wrap.state != Wrap::None || charsPerScroll == 0) { + return ::DefWindowProc(MainHWND(), iMessage, wParam, lParam); + } + + MouseWheelDelta &wheelDelta = (iMessage == WM_MOUSEHWHEEL) ? horizontalWheelDelta : verticalWheelDelta; + if (wheelDelta.Accumulate(wParam)) { + const int charsToScroll = charsPerScroll * wheelDelta.Actions(); + const int widthToScroll = static_cast<int>(std::lround(charsToScroll * vs.aveCharWidth)); + HorizontalScrollToClamped(xOffset + widthToScroll); + } + return 0; } - // Either SCROLL or ZOOM. We handle the wheel steppings calculation - wheelDelta -= GET_WHEEL_DELTA_WPARAM(wParam); - if (std::abs(wheelDelta) >= WHEEL_DELTA && linesPerScroll > 0) { + + // Either SCROLL vertically or ZOOM. We handle the wheel steppings calculation + if (linesPerScroll != 0 && verticalWheelDelta.Accumulate(wParam)) { Sci::Line linesToScroll = linesPerScroll; if (linesPerScroll == WHEEL_PAGESCROLL) linesToScroll = LinesOnScreen() - 1; if (linesToScroll == 0) { linesToScroll = 1; } - linesToScroll *= (wheelDelta / WHEEL_DELTA); - if (wheelDelta >= 0) - wheelDelta = wheelDelta % WHEEL_DELTA; - else - wheelDelta = -(-wheelDelta % WHEEL_DELTA); + linesToScroll *= verticalWheelDelta.Actions(); if (wParam & MK_CONTROL) { // Zoom! We play with the font sizes in the styles. @@ -1987,6 +2014,7 @@ case WM_MOUSEMOVE: case WM_MOUSELEAVE: case WM_MOUSEWHEEL: + case WM_MOUSEHWHEEL: return MouseMessage(msg, wParam, lParam); case WM_SETCURSOR: @@ -2257,7 +2285,7 @@ void ScintillaWin::UpdateBaseElements() { struct ElementToIndex { Element element; int nIndex; }; - ElementToIndex eti[] = { + const ElementToIndex eti[] = { { Element::List, COLOR_WINDOWTEXT }, { Element::ListBack, COLOR_WINDOW }, { Element::ListSelected, COLOR_HIGHLIGHTTEXT }, @@ -2359,6 +2387,20 @@ return false; } +void ScintillaWin::HorizontalScrollToClamped(int xPos) { + const HorizontalScrollRange range = GetHorizontalScrollRange(); + HorizontalScrollTo(std::clamp(xPos, 0, range.documentWidth - range.pageWidth + 1)); +} + +HorizontalScrollRange ScintillaWin::GetHorizontalScrollRange() const { + const PRectangle rcText = GetTextRectangle(); + int pageWidth = static_cast<int>(rcText.Width()); + const int horizEndPreferred = std::max({ scrollWidth, pageWidth - 1, 0 }); + if (!horizontalScrollBarVisible || Wrapping()) + pageWidth = horizEndPreferred + 1; + return { pageWidth, horizEndPreferred }; +} + bool ScintillaWin::ModifyScrollBars(Sci::Line nMax, Sci::Line nPage) { if (!IsVisible()) { return false; @@ -2371,15 +2413,10 @@ if (ChangeScrollRange(SB_VERT, 0, static_cast<int>(vertEndPreferred), static_cast<unsigned int>(nPage))) { modified = true; } - - const PRectangle rcText = GetTextRectangle(); - int pageWidth = static_cast<int>(rcText.Width()); - const int horizEndPreferred = std::max({scrollWidth, pageWidth - 1, 0}); - if (!horizontalScrollBarVisible || Wrapping()) - pageWidth = horizEndPreferred + 1; - if (ChangeScrollRange(SB_HORZ, 0, horizEndPreferred, pageWidth)) { + const HorizontalScrollRange range = GetHorizontalScrollRange(); + if (ChangeScrollRange(SB_HORZ, 0, range.documentWidth, range.pageWidth)) { modified = true; - if (scrollWidth < pageWidth) { + if (scrollWidth < range.pageWidth) { HorizontalScrollTo(0); } } @@ -3119,6 +3156,10 @@ void ScintillaWin::GetIntelliMouseParameters() noexcept { // This retrieves the number of lines per scroll as configured in the Mouse Properties sheet in Control Panel ::SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &linesPerScroll, 0); + if (!::SystemParametersInfo(SPI_GETWHEELSCROLLCHARS, 0, &charsPerScroll, 0)) { + // no horizontal scrolling configuration on Windows XP + charsPerScroll = (linesPerScroll == WHEEL_PAGESCROLL) ? 3 : linesPerScroll; + } } void ScintillaWin::CopyToGlobal(GlobalMemory &gmUnicode, const SelectionText &selectedText) { @@ -3222,9 +3263,6 @@ break; case SB_PAGEDOWN: xPos += pageWidth; - if (xPos > scrollWidth - rcText.Width()) { // Hit the end exactly - xPos = scrollWidth - static_cast<int>(rcText.Width()); - } break; case SB_TOP: xPos = 0; @@ -3244,7 +3282,7 @@ } break; } - HorizontalScrollTo(xPos); + HorizontalScrollToClamped(xPos); } /** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/scintilla/win32/makefile new/scintilla/win32/makefile --- old/scintilla/win32/makefile 2022-08-27 01:04:41.000000000 +0200 +++ new/scintilla/win32/makefile 2022-10-12 03:48:46.000000000 +0200 @@ -15,7 +15,7 @@ COMPONENT = $(DIR_BIN)/Scintilla.dll LIBSCI = $(DIR_BIN)/libscintilla.a -WARNINGS = -Wpedantic -Wall +WARNINGS = -Wpedantic -Wall -Wextra ifdef CLANG CXX = clang++
