docs: Add 22 upgrade patches for Scintilla 5.5.8 transition

Created patches comparing NP3 implementation vs official 5.5.8:
- include/: 2 patches (Scintilla.h, ScintillaTypes.h)
- src/: 16 patches (Editor.cxx largest at 247 lines)
- win32/: 4 patches (ScintillaWin.cxx largest at 380 lines)

All 21 files with NON STD SCI PATCH markers now documented.
Upgrade procedure: copy 5.5.8, apply patches, preserve oniguruma.
This commit is contained in:
Derick Payne 2026-01-18 01:11:37 +02:00
parent d26d327762
commit f8a2fa22a8
30 changed files with 929 additions and 1795 deletions

View File

@ -1,16 +0,0 @@
diff --git a/_upgrade_staging/scintilla557/scintilla/include/Sci_Position.h b/scintilla/include/Sci_Position.h
index abd0f3408..0ebdf5983 100644
--- a/_upgrade_staging/scintilla557/scintilla/include/Sci_Position.h
+++ b/scintilla/include/Sci_Position.h
@@ -9,7 +9,11 @@
#ifndef SCI_POSITION_H
#define SCI_POSITION_H
+#if defined(__cplusplus)
+#include <cstddef>
+#else
#include <stddef.h>
+#endif
// Basic signed type used throughout interface
typedef ptrdiff_t Sci_Position;

View File

@ -1,13 +0,0 @@
diff --git a/_upgrade_staging/scintilla557/scintilla/include/ILoader.h b/scintilla/include/ILoader.h
index 5d2eb2571..9d49c75e8 100644
--- a/_upgrade_staging/scintilla557/scintilla/include/ILoader.h
+++ b/scintilla/include/ILoader.h
@@ -18,7 +18,7 @@ public:
virtual int SCI_METHOD Release() = 0;
// Returns a status code from SC_STATUS_*
virtual int SCI_METHOD AddData(const char *data, Sci_Position length) = 0;
- virtual void * SCI_METHOD ConvertToDocument() = 0;
+ virtual void * SCI_METHOD ConvertToDocument() noexcept = 0;
};
static constexpr int deRelease0 = 0;

View File

@ -1,27 +0,0 @@
diff --git a/_upgrade_staging/scintilla557/scintilla/win32/PlatWin.h b/scintilla/win32/PlatWin.h
index 1edad6044..8ebf5bd7a 100644
--- a/_upgrade_staging/scintilla557/scintilla/win32/PlatWin.h
+++ b/scintilla/win32/PlatWin.h
@@ -18,6 +18,8 @@ constexpr FLOAT dpiDefault = USER_DEFAULT_SCREEN_DPI;
// Used for defining font size with LOGFONT
constexpr int pointsPerInch = 72;
+constexpr UINT codePageWindowsLatin = 1252;
+
extern void Platform_Initialise(void *hInstance) noexcept;
extern void Platform_Finalise(bool fromDllMain) noexcept;
@@ -68,7 +70,12 @@ float GetDeviceScaleFactorWhenGdiScalingActive(HWND hWnd) noexcept;
int SystemMetricsForDpi(int nIndex, UINT dpi) noexcept;
-void AdjustWindowRectForDpi(LPRECT lpRect, DWORD dwStyle, UINT dpi) noexcept;
+// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+#ifndef AlphaBlend
+#define AlphaBlend GdiAlphaBlend
+#endif
+BOOL AdjustWindowRectForDpi(LPRECT lpRect, DWORD dwStyle, DWORD dwExStyle, UINT dpi) noexcept;
+// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
HCURSOR LoadReverseArrowCursor(UINT dpi) noexcept;

View File

@ -1,160 +0,0 @@
diff --git a/_upgrade_staging/scintilla557/scintilla/win32/ListBox.cxx b/scintilla/win32/ListBox.cxx
index 38806a373..fb2632a44 100644
--- a/_upgrade_staging/scintilla557/scintilla/win32/ListBox.cxx
+++ b/scintilla/win32/ListBox.cxx
@@ -77,6 +77,13 @@ void *PtrFromLParam(Scintilla::sptr_t lParam) noexcept {
return reinterpret_cast<void *>(lParam);
}
+// These are reasonable initial guesses that may be refined by measurement or calls.
+constexpr SIZE sizeList { 150, 80 };
+constexpr int commonLineHeight = 10;
+constexpr unsigned int commonCharacterWidth = 8;
+constexpr int commonItemLength = 12;
+constexpr int defaultVisibleRows = 9;
+
struct ListItemData {
const char *text;
int pixId;
@@ -115,11 +122,11 @@ public:
}
};
-const TCHAR ListBoxX_ClassName[] = TEXT("ListBoxX");
+const TCHAR *ListBoxX_ClassName = TEXT("ListBoxX");
ColourRGBA ColourElement(std::optional<ColourRGBA> colour, int nIndex) {
if (colour.has_value()) {
- return colour.value();
+ return colour.value().Opaque();
}
return ColourFromSys(nIndex);
}
@@ -143,7 +150,7 @@ struct LBGraphics {
}
class ListBoxX : public ListBox {
- int lineHeight = 10;
+ int lineHeight = commonLineHeight;
HFONT fontCopy {};
std::unique_ptr<FontWin> fontWin;
Technology technology = Technology::Default;
@@ -152,9 +159,9 @@ class ListBoxX : public ListBox {
HWND lb {};
bool unicodeMode = false;
int codePage = 0;
- int desiredVisibleRows = 9;
+ int desiredVisibleRows = defaultVisibleRows;
int maxItemCharacters = 0;
- unsigned int aveCharWidth = 8;
+ unsigned int aveCharWidth = commonCharacterWidth;
Window *parent = nullptr;
WNDPROC prevWndProc{};
int ctrlID = 0;
@@ -248,10 +255,11 @@ void ListBoxX::Create(Window &parent_, int ctrlID_, Point location_, int lineHei
HWND hwndParent = HwndFromWindow(*parent);
HINSTANCE hinstanceParent = GetWindowInstance(hwndParent);
// Window created as popup so not clipped within parent client area
+ constexpr int startPosition = 100; // Arbitrary as will be moved immediately
wid = ::CreateWindowEx(
WS_EX_WINDOWEDGE, ListBoxX_ClassName, TEXT(""),
WS_POPUP | frameStyle,
- 100,100, 150,80, hwndParent,
+ startPosition,startPosition, sizeList.cx,sizeList.cy, hwndParent,
{},
hinstanceParent,
this);
@@ -272,7 +280,8 @@ void ListBoxX::SetFont(const Font *font) {
fontCopy = pfm->HFont();
SetWindowFont(lb, fontCopy, 0);
fontWin = pfm->Duplicate();
- codePage = unicodeMode ? CpUtf8 : CodePageFromCharSet(fontWin->GetCharacterSet(), 1252);
+ codePage = unicodeMode ? CpUtf8 :
+ CodePageFromCharSet(fontWin->GetCharacterSet(), codePageWindowsLatin);
graphics.Release();
}
}
@@ -303,7 +312,6 @@ PRectangle ListBoxX::GetDesiredRect() {
int width = MinClientWidth();
int textSize = 0;
- int averageCharWidth = 8;
// Make a measuring surface
std::unique_ptr<Surface> surfaceItem(Surface::Allocate(technology));
@@ -320,7 +328,7 @@ PRectangle ListBoxX::GetDesiredRect() {
}
maxCharWidth = static_cast<int>(std::ceil(surfaceItem->WidthText(fontWin.get(), "W")));
- averageCharWidth = static_cast<int>(surfaceItem->AverageCharWidth(fontWin.get()));
+ const int averageCharWidth = static_cast<int>(surfaceItem->AverageCharWidth(fontWin.get()));
width = std::max({ width, textSize, (maxItemCharacters + 1) * averageCharWidth });
@@ -529,21 +537,20 @@ void ListBoxX::SetOptions(ListOptions options_) {
void ListBoxX::AdjustWindowRect(PRectangle *rc, UINT dpiAdjust) const noexcept {
RECT rcw = RectFromPRectangle(*rc);
- AdjustWindowRectForDpi(&rcw, frameStyle, dpiAdjust);
+ // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+ AdjustWindowRectForDpi(&rcw, frameStyle, WS_EX_WINDOWEDGE, dpiAdjust);
+ // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
*rc = PRectangleFromRECT(rcw);
}
int ListBoxX::ItemHeight() const noexcept {
- int itemHeight = lineHeight + (TextInset.y * 2);
+ const int itemHeight = lineHeight + (TextInset.y * 2);
const int pixHeight = images.GetHeight() + (ImageInset.y * 2);
- if (itemHeight < pixHeight) {
- itemHeight = pixHeight;
- }
- return itemHeight;
+ return std::max(itemHeight, pixHeight);
}
int ListBoxX::MinClientWidth() const noexcept {
- return 12 * (aveCharWidth+aveCharWidth/3);
+ return commonItemLength * (aveCharWidth+aveCharWidth/3);
}
POINT ListBoxX::MinTrackSize() const noexcept {
@@ -556,7 +563,7 @@ POINT ListBoxX::MinTrackSize() const noexcept {
POINT ListBoxX::MaxTrackSize() const noexcept {
PRectangle rc = PRectangle::FromInts(0, 0,
std::max<int>(static_cast<unsigned int>(MinClientWidth()),
- maxCharWidth * maxItemCharacters + TextInset.x * 2 +
+ (maxCharWidth * maxItemCharacters) + (TextInset.x * 2) +
TextOffset() + SystemMetricsForDpi(SM_CXVSCROLL, dpi)),
ItemHeight() * lti.Count());
AdjustWindowRect(&rc, dpi);
@@ -743,7 +750,7 @@ void ListBoxX::CentreItem(int n) {
}
void ListBoxX::AllocateBitMap() {
- const SIZE extent { GetClientExtent().x, lineHeight };
+ const SIZE extent { GetClientExtent().x, ItemHeight() };
graphics.bm.Create({}, extent.cx, -extent.cy, nullptr);
if (!graphics.bm) {
@@ -843,7 +850,7 @@ LRESULT ListBoxX::WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam
0, WC_LISTBOXW, L"",
WS_CHILD | WS_VSCROLL | WS_VISIBLE |
LBS_OWNERDRAWFIXED | LBS_NODATA | LBS_NOINTEGRALHEIGHT,
- 0, 0, 150,80, hWnd,
+ 0, 0, sizeList.cx, sizeList.cy, hWnd,
reinterpret_cast<HMENU>(static_cast<ptrdiff_t>(ctrlID)),
hinstanceParent,
nullptr);
@@ -932,10 +939,7 @@ LRESULT ListBoxX::WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam
const int nRows = GetVisibleRows();
int linesToScroll = std::clamp(nRows - 1, 1, 3);
linesToScroll *= wheelDelta.Actions();
- int top = ListBox_GetTopIndex(lb) + linesToScroll;
- if (top < 0) {
- top = 0;
- }
+ const int top = std::max(0, ListBox_GetTopIndex(lb) + linesToScroll);
ListBox_SetTopIndex(lb, top);
}
break;

View File

@ -1,13 +0,0 @@
diff --git a/_upgrade_staging/scintilla557/scintilla/win32/ScintillaDLL.cxx b/scintilla/win32/ScintillaDLL.cxx
index ca2c91add..2b90892c0 100644
--- a/_upgrade_staging/scintilla557/scintilla/win32/ScintillaDLL.cxx
+++ b/scintilla/win32/ScintillaDLL.cxx
@@ -20,7 +20,7 @@ using namespace Scintilla;
extern "C"
__declspec(dllexport)
-sptr_t __stdcall Scintilla_DirectFunction(
+sptr_t APIENTRY Scintilla_DirectFunction(
Internal::ScintillaWin *sci, UINT iMessage, uptr_t wParam, sptr_t lParam) {
return Internal::DirectFunction(sci, iMessage, wParam, lParam);
}

View File

@ -1,22 +0,0 @@
diff --git a/_upgrade_staging/scintilla557/scintilla/win32/SurfaceD2D.cxx b/scintilla/win32/SurfaceD2D.cxx
index 223d35fcf..0ca7a9475 100644
--- a/_upgrade_staging/scintilla557/scintilla/win32/SurfaceD2D.cxx
+++ b/scintilla/win32/SurfaceD2D.cxx
@@ -1028,7 +1028,7 @@ public:
ScreenLineLayout &operator=(ScreenLineLayout &&) = delete;
~ScreenLineLayout() noexcept override = default;
size_t PositionFromX(XYPOSITION xDistance, bool charPosition) override;
- XYPOSITION XFromPosition(size_t caretPosition) override;
+ XYPOSITION XFromPosition(size_t caretPosition) noexcept override;
std::vector<Interval> FindRangeIntervals(size_t start, size_t end) override;
};
@@ -1208,7 +1208,7 @@ size_t ScreenLineLayout::PositionFromX(XYPOSITION xDistance, bool charPosition)
// Finds the point of the caret position
-XYPOSITION ScreenLineLayout::XFromPosition(size_t caretPosition) {
+XYPOSITION ScreenLineLayout::XFromPosition(size_t caretPosition) noexcept {
if (!textLayout) {
return 0.0;
}

View File

@ -1,45 +1,63 @@
# Notepad3 Scintilla Patches
This directory documents **all** modifications made to upstream Scintilla 5.5.7 for Notepad3.
This directory contains complete documentation of all NP3 modifications to Scintilla.
## Baseline
## Current Baseline
**Upstream Version**: Scintilla 5.5.7 (official release from scintilla.org)
- **NP3 Scintilla**: Based on 5.5.7 with NP3 patches
- **Target Upgrade**: 5.5.8
## Patch Registry
## Patch Files
| ID | Patch File | Target File | Description |
|----|------------|-------------|-------------|
| 001 | `001_Scintilla_h_exports.patch` | `include/Scintilla.h` | DLL exports: WRECT, DPI functions, IME, Strikethrough, KEYWORDSET_MAX, SCFIND_DOT_MATCH_ALL |
| 002 | `002_ScintillaTypes_DotMatchAll.patch` | `include/ScintillaTypes.h` | `FindOption::DotMatchAll = 0x1000` for Oniguruma regex |
| 003 | `003_Sci_Position_cstdint.patch` | `include/Sci_Position.h` | C++ `<cstdint>` include guard |
| 004 | `004_ILoader_cxx_guard.patch` | `include/ILoader.h` | C++ header compatibility |
| 005 | `005_Platform_h_mods.patch` | `src/Platform.h` | AlphaBlend typedef, platform compatibility |
| 006 | `006_PlatWin_h_4param.patch` | `win32/PlatWin.h` | 4-param `AdjustWindowRectForDpi` signature (DPI fix) |
| 007 | `007_PlatWin_cxx_4param.patch` | `win32/PlatWin.cxx` | 4-param `AdjustWindowRectForDpi` implementation |
| 008 | `008_ScintillaWin_exports.patch` | `win32/ScintillaWin.cxx` | DPI/CodePage/DirectFunction exports, ALT-key drag |
| 009 | `009_ListBox_4param.patch` | `win32/ListBox.cxx` | Calls 4-param AdjustWindowRectForDpi |
| 010 | `010_ScintillaDLL_entry.patch` | `win32/ScintillaDLL.cxx` | DLL entry point modifications |
| 011 | `011_SurfaceD2D_mods.patch` | `win32/SurfaceD2D.cxx` | DirectWrite font rendering adjustments |
### Upgrade Patches (vs 5.5.8)
## Critical: DPI Scaling (Patches 006, 007, 009)
These patches transform official Scintilla 5.5.8 → NP3 implementation:
> ⚠️ **WARNING**: Upstream Scintilla 5.5.8 changed `AdjustWindowRectForDpi` from 4 parameters to 3 parameters. NP3 requires the 4-param version for proper DPI handling.
| File | Patch | Lines | Purpose |
|------|-------|-------|---------|
| `include/Scintilla.h` | `upgrade_001_*` | 99 | DLL exports, DPI, IME, Strikethrough |
| `include/ScintillaTypes.h` | `upgrade_002_*` | 23 | DotMatchAll flag |
| `src/AutoComplete.cxx` | `upgrade_020_*` | 19 | Custom autocomplete |
| `src/CellBuffer.cxx` | `upgrade_021_*` | 29 | Buffer mods |
| `src/CellBuffer.h` | `upgrade_022_*` | 15 | Buffer header |
| `src/Document.h` | `upgrade_023_*` | 134 | Document types |
| `src/Editor.cxx` | `upgrade_024_*` | **247** | Core editor (24 patch sections) |
| `src/Editor.h` | `upgrade_025_*` | 54 | Editor header |
| `src/EditView.cxx` | `upgrade_026_*` | 39 | Edit view |
| `src/Partitioning.h` | `upgrade_027_*` | 14 | Partitioning |
| `src/Platform.h` | `upgrade_028_*` | 52 | Platform defs |
| `src/ScintillaBase.cxx` | `upgrade_029_*` | 41 | Base class |
| `src/ScintillaBase.h` | `upgrade_030_*` | 27 | Base header |
| `src/SplitVector.h` | `upgrade_031_*` | 15 | Vector util |
| `src/Style.cxx` | `upgrade_032_*` | 14 | Style impl |
| `src/Style.h` | `upgrade_033_*` | 14 | Style header |
| `src/ViewStyle.cxx` | `upgrade_034_*` | 116 | ViewStyle impl |
| `src/ViewStyle.h` | `upgrade_035_*` | 58 | ViewStyle header |
| `win32/ListBox.cxx` | `upgrade_050_*` | 15 | 4-param DPI |
| `win32/PlatWin.cxx` | `upgrade_051_*` | 37 | 4-param impl |
| `win32/PlatWin.h` | `upgrade_052_*` | 18 | 4-param sig |
| `win32/ScintillaWin.cxx` | `upgrade_053_*` | **380** | Exports (34 patch sections) |
## Preserved Directories (Not Patched)
## Preserved Directories
These directories are entirely NP3-custom and must be preserved during upgrades:
Do NOT overwrite during upgrades:
- **`scintilla/oniguruma/`** - Custom regex engine (Oniguruma integration)
- **`scintilla/*.vcxproj`** - Project files with NP3 defines (`SCI_OWNREGEX`, `NP3`, `ONIG_STATIC`)
- **`scintilla/oniguruma/`** - Custom regex engine
- **`scintilla/*.vcxproj`** - NP3 build settings
## Upgrade Procedure
## Upgrade Procedure (5.5.7 → 5.5.8)
When upgrading Scintilla to a new version:
1. Copy ALL files from official 5.5.8 to `scintilla/`
2. Apply upgrade patches: `git apply upgrade_*.patch`
3. Preserve `oniguruma/` directory
4. Preserve `.vcxproj` files
5. Clean build and test DPI scaling
1. Download new upstream release
2. Copy ALL files from upstream (src/, include/, win32/)
3. Re-apply patches 001-011 in order
4. Preserve oniguruma/ directory (do not overwrite)
5. Preserve .vcxproj files (NP3 build settings)
6. Clean build and test DPI scaling at 100%, 150%, 200%
## NP3 Patch Markers
All intentional patches are marked with:
```
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
// code here
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
```

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
diff --git a/_upgrade_staging/scintilla557/scintilla/include/Scintilla.h b/scintilla/include/Scintilla.h
diff --git a/_upgrade_staging/scintilla/include/Scintilla.h b/scintilla/include/Scintilla.h
index f7afa4f50..0d9169572 100644
--- a/_upgrade_staging/scintilla557/scintilla/include/Scintilla.h
--- a/_upgrade_staging/scintilla/include/Scintilla.h
+++ b/scintilla/include/Scintilla.h
@@ -15,18 +15,30 @@
extern "C" {

View File

@ -1,6 +1,6 @@
diff --git a/_upgrade_staging/scintilla557/scintilla/include/ScintillaTypes.h b/scintilla/include/ScintillaTypes.h
diff --git a/_upgrade_staging/scintilla/include/ScintillaTypes.h b/scintilla/include/ScintillaTypes.h
index 0991a1480..4e55de257 100644
--- a/_upgrade_staging/scintilla557/scintilla/include/ScintillaTypes.h
--- a/_upgrade_staging/scintilla/include/ScintillaTypes.h
+++ b/scintilla/include/ScintillaTypes.h
@@ -286,6 +286,7 @@ enum class FindOption {
None = 0x0,

View File

@ -0,0 +1,19 @@
diff --git a/_upgrade_staging/scintilla/src/AutoComplete.cxx b/scintilla/src/AutoComplete.cxx
index 058550d62..d88720148 100644
--- a/_upgrade_staging/scintilla/src/AutoComplete.cxx
+++ b/scintilla/src/AutoComplete.cxx
@@ -239,10 +239,12 @@ void AutoComplete::Move(int delta) {
const int count = lb->Length();
int current = lb->GetSelection();
current += delta;
+ // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
if (current >= count)
- current = count - 1;
+ current = (current == count ? 0 : count - 1);
if (current < 0)
- current = 0;
+ current = (current == -1 ? count - 1 : 0);
+ // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
lb->Select(current);
}

View File

@ -0,0 +1,29 @@
diff --git a/_upgrade_staging/scintilla/src/CellBuffer.cxx b/scintilla/src/CellBuffer.cxx
index 3e9deb934..165dccedd 100644
--- a/_upgrade_staging/scintilla/src/CellBuffer.cxx
+++ b/scintilla/src/CellBuffer.cxx
@@ -21,12 +21,14 @@
#include <optional>
#include <algorithm>
#include <memory>
-#include <type_traits>
#include "ScintillaTypes.h"
#include "Debugging.h"
+// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+#include "Scintilla.h"
+// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
#include "Position.h"
#include "SplitVector.h"
#include "Partitioning.h"
@@ -216,7 +218,7 @@ public:
}
void InsertLines(Sci::Line line, const Sci::Position *positions, size_t lines, bool lineStart) override {
const POS lineAsPos = pos_cast(line);
- if constexpr (std::is_convertible_v<Sci::Position *, POS *>) {
+ if constexpr (sizeof(Sci::Position) == sizeof(POS)) {
starts.InsertPartitions(lineAsPos, positions, lines);
} else {
starts.InsertPartitionsWithCast(lineAsPos, positions, lines);

View File

@ -0,0 +1,15 @@
diff --git a/_upgrade_staging/scintilla/src/CellBuffer.h b/scintilla/src/CellBuffer.h
index 1b035597a..23916abc4 100644
--- a/_upgrade_staging/scintilla/src/CellBuffer.h
+++ b/scintilla/src/CellBuffer.h
@@ -8,6 +8,10 @@
#ifndef CELLBUFFER_H
#define CELLBUFFER_H
+// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+#include "Position.h"
+// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
+
namespace Scintilla::Internal {
// Interface to per-line data that wants to see each line insertion and deletion

View File

@ -0,0 +1,134 @@
diff --git a/_upgrade_staging/scintilla/src/Document.h b/scintilla/src/Document.h
index 7655d5290..c4da95967 100644
--- a/_upgrade_staging/scintilla/src/Document.h
+++ b/scintilla/src/Document.h
@@ -8,6 +8,14 @@
#ifndef DOCUMENT_H
#define DOCUMENT_H
+// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+#if defined(__cplusplus)
+#include <map>
+#else
+#endif
+#include "ILoader.h"
+// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
+
namespace Scintilla::Internal {
class DocWatcher;
@@ -349,7 +357,7 @@ public:
~Document() override;
int SCI_METHOD AddRef() noexcept override;
- int SCI_METHOD Release() override;
+ int SCI_METHOD Release() noexcept override;
// From PerLine
void Init() override;
@@ -363,14 +371,14 @@ public:
bool SetLineEndTypesAllowed(Scintilla::LineEndType lineEndBitSet_);
Scintilla::LineEndType GetLineEndTypesActive() const noexcept { return cb.GetLineEndTypes(); }
- int SCI_METHOD Version() const override {
+ int SCI_METHOD Version() const noexcept override {
return Scintilla::dvRelease4;
}
int SCI_METHOD DEVersion() const noexcept override;
- void SCI_METHOD SetErrorStatus(int status) override;
+ void SCI_METHOD SetErrorStatus(int status) noexcept override;
- Sci_Position SCI_METHOD LineFromPosition(Sci_Position pos) const override;
+ Sci_Position SCI_METHOD LineFromPosition(Sci_Position pos) const noexcept override;
Sci::Line SciLineFromPosition(Sci::Position pos) const noexcept; // Avoids casting LineFromPosition
Sci::Position ClampPositionIntoDocument(Sci::Position pos) const noexcept;
bool ContainsLineEnd(const char *s, Sci::Position length) const noexcept { return cb.ContainsLineEnd(s, length); }
@@ -382,11 +390,11 @@ public:
bool NextCharacter(Sci::Position &pos, int moveDir) const noexcept; // Returns true if pos changed
CharacterExtracted CharacterAfter(Sci::Position position) const noexcept;
CharacterExtracted CharacterBefore(Sci::Position position) const noexcept;
- Sci_Position SCI_METHOD GetRelativePosition(Sci_Position positionStart, Sci_Position characterOffset) const override;
+ Sci_Position SCI_METHOD GetRelativePosition(Sci_Position positionStart, Sci_Position characterOffset) const noexcept override;
Sci::Position GetRelativePositionUTF16(Sci::Position positionStart, Sci::Position characterOffset) const noexcept;
- int SCI_METHOD GetCharacterAndWidth(Sci_Position position, Sci_Position *pWidth) const override;
- int SCI_METHOD CodePage() const override;
- bool SCI_METHOD IsDBCSLeadByte(char ch) const override;
+ int SCI_METHOD GetCharacterAndWidth(Sci_Position position, Sci_Position *pWidth) const noexcept override;
+ int SCI_METHOD CodePage() const noexcept override;
+ bool SCI_METHOD IsDBCSLeadByte(char ch) const noexcept override;
bool IsDBCSLeadByteNoExcept(char ch) const noexcept;
bool IsDBCSTrailByteNoExcept(char ch) const noexcept;
unsigned char DBCSMinTrailByte() const noexcept;
@@ -405,7 +413,7 @@ public:
void ChangeInsertion(const char *s, Sci::Position length);
int SCI_METHOD AddData(const char *data, Sci_Position length) override;
IDocumentEditable *AsDocumentEditable() noexcept;
- void *SCI_METHOD ConvertToDocument() override;
+ void * SCI_METHOD ConvertToDocument() noexcept override;
Sci::Position Undo();
Sci::Position Redo();
bool CanUndo() const noexcept { return cb.CanUndo(); }
@@ -473,7 +481,7 @@ public:
void DelCharBack(Sci::Position pos);
char CharAt(Sci::Position position) const noexcept { return cb.CharAt(position); }
- void SCI_METHOD GetCharRange(char *buffer, Sci_Position position, Sci_Position lengthRetrieve) const override {
+ void SCI_METHOD GetCharRange(char *buffer, Sci_Position position, Sci_Position lengthRetrieve) const noexcept override {
cb.GetCharRange(buffer, position, lengthRetrieve);
}
char SCI_METHOD StyleAt(Sci_Position position) const override { return cb.StyleAt(position); }
@@ -492,7 +500,7 @@ public:
Sci::Line LineFromHandle(int markerHandle) const noexcept;
int MarkerNumberFromLine(Sci::Line line, int which) const noexcept;
int MarkerHandleFromLine(Sci::Line line, int which) const noexcept;
- Sci_Position SCI_METHOD LineStart(Sci_Position line) const override;
+ Sci_Position SCI_METHOD LineStart(Sci_Position line) const noexcept override;
[[nodiscard]] Range LineRange(Sci::Line line) const noexcept;
bool IsLineStartPosition(Sci::Position position) const noexcept;
Sci_Position SCI_METHOD LineEnd(Sci_Position line) const override;
@@ -506,7 +514,7 @@ public:
Sci::Line LineFromPositionAfter(Sci::Line line, Sci::Position length) const noexcept;
int SCI_METHOD SetLevel(Sci_Position line, int level) override;
- int SCI_METHOD GetLevel(Sci_Position line) const override;
+ int SCI_METHOD GetLevel(Sci_Position line) const noexcept override;
Scintilla::FoldLevel GetFoldLevel(Sci_Position line) const noexcept;
void ClearLevels();
Sci::Line GetLastChild(Sci::Line lineParent, std::optional<Scintilla::FoldLevel> level = {}, Sci::Line lastLine = -1);
@@ -516,7 +524,7 @@ public:
Sci::Position ExtendWordSelect(Sci::Position pos, int delta, bool onlyWordCharacters=false) const;
Sci::Position NextWordStart(Sci::Position pos, int delta) const;
Sci::Position NextWordEnd(Sci::Position pos, int delta) const;
- Sci_Position SCI_METHOD Length() const override { return cb.Length(); }
+ Sci_Position SCI_METHOD Length() const noexcept override { return cb.Length(); }
Sci::Position LengthNoExcept() const noexcept { return cb.Length(); }
void Allocate(Sci::Position newSize) { cb.Allocate(newSize); }
@@ -542,7 +550,7 @@ public:
int GetCharsOfClass(CharacterClass characterClass, unsigned char *buffer) const;
void SetCharacterCategoryOptimization(int countCharacters);
int CharacterCategoryOptimization() const noexcept;
- void SCI_METHOD StartStyling(Sci_Position position) override;
+ void SCI_METHOD StartStyling(Sci_Position position) noexcept override;
bool SCI_METHOD SetStyleFor(Sci_Position length, char style) override;
bool SCI_METHOD SetStyles(Sci_Position length, const char *styles) override;
Sci::Position GetEndStyled() const noexcept { return endStyled; }
@@ -550,7 +558,7 @@ public:
void StyleToAdjustingLineDuration(Sci::Position pos);
int GetStyleClock() const noexcept { return styleClock; }
void IncrementStyleClock() noexcept;
- void SCI_METHOD DecorationSetCurrentIndicator(int indicator) override;
+ void SCI_METHOD DecorationSetCurrentIndicator(int indicator) noexcept override;
void SCI_METHOD DecorationFillRange(Sci_Position position, int value, Sci_Position fillLength) override;
LexInterface *GetLexInterface() const noexcept;
void SetLexInterface(std::unique_ptr<LexInterface> pLexInterface) noexcept;
@@ -560,7 +568,7 @@ public:
void TruncateUndoComments(int action);
int SCI_METHOD SetLineState(Sci_Position line, int state) override;
- int SCI_METHOD GetLineState(Sci_Position line) const override;
+ int SCI_METHOD GetLineState(Sci_Position line) const noexcept override;
Sci::Line GetMaxLineState() const noexcept;
void SCI_METHOD ChangeLexerState(Sci_Position start, Sci_Position end) override;

View File

@ -0,0 +1,247 @@
diff --git a/_upgrade_staging/scintilla/src/Editor.cxx b/scintilla/src/Editor.cxx
index e7a309e67..f7b8af402 100644
--- a/_upgrade_staging/scintilla/src/Editor.cxx
+++ b/scintilla/src/Editor.cxx
@@ -13,6 +13,9 @@
#include <cstdio>
#include <cmath>
+// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+#include <ranges>
+// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
#include <stdexcept>
#include <string>
#include <string_view>
@@ -715,7 +718,7 @@ void Editor::SetSelectionFromSerialized(const char *serialized) {
sel = Selection(serialized);
sel.Truncate(pdoc->Length());
SetRectangularRange();
- Redraw();
+ InvalidateStyleRedraw();
}
}
@@ -2434,7 +2437,6 @@ void Editor::RestoreSelection(Sci::Position newPos, UndoRedo history) {
}
}
newPos = -1; // Used selection from stack so don't use position returned from undo/redo.
- Redraw();
}
}
if (newPos >= 0)
@@ -4064,20 +4066,22 @@ int Editor::KeyCommand(Message iMessage) {
case Message::FormFeed:
AddChar('\f');
break;
+ // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
case Message::ZoomIn:
- if (vs.zoomLevel < 60) {
- vs.zoomLevel++;
+ if (vs.ZoomIn()) {
+ //vs.zoomLevel++;
InvalidateStyleRedraw();
NotifyZoom();
}
break;
case Message::ZoomOut:
- if (vs.zoomLevel > -10) {
- vs.zoomLevel--;
+ if (vs.ZoomOut()) {
+ //vs.zoomLevel--;
InvalidateStyleRedraw();
NotifyZoom();
}
break;
+ // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
case Message::DelWordLeft:
case Message::DelWordRight:
@@ -4155,12 +4159,6 @@ int Editor::KeyDownWithModifiers(Keys key, KeyMod modifiers, bool *consumed) {
void Editor::Indent(bool forwards, bool lineIndent) {
UndoGroup ug(pdoc);
- // Avoid problems with recalculating rectangular range multiple times by temporarily
- // treating rectangular selection as multiple stream selection.
- const Selection::SelTypes selType = sel.selType;
- if (sel.IsRectangular()) {
- sel.selType = Selection::SelTypes::stream;
- }
for (size_t r=0; r<sel.Count(); r++) {
const Sci::Line lineOfAnchor =
pdoc->SciLineFromPosition(sel.Range(r).anchor.Position());
@@ -4237,8 +4235,6 @@ void Editor::Indent(bool forwards, bool lineIndent) {
}
}
}
- sel.selType = selType; // Restore rectangular mode
- ThinRectangularRange();
ContainerNeedsUpdate(Update::Selection);
}
@@ -4500,10 +4496,14 @@ void Editor::SetDragPosition(SelectionPosition newPos) {
posDrop = newPos;
}
if (!(posDrag == newPos)) {
+ // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+ int const slop_x = (caretPolicies.x.slop < 50) ? 50 : caretPolicies.x.slop;
+ int const slop_y = (caretPolicies.y.slop < 2) ? 2 : caretPolicies.y.slop;
const CaretPolicies dragCaretPolicies = {
- CaretPolicySlop(CaretPolicy::Slop | CaretPolicy::Strict | CaretPolicy::Even, 50),
- CaretPolicySlop(CaretPolicy::Slop | CaretPolicy::Strict | CaretPolicy::Even, 2)
+ CaretPolicySlop(CaretPolicy::Slop | CaretPolicy::Strict | CaretPolicy::Even, slop_x),
+ CaretPolicySlop(CaretPolicy::Slop | CaretPolicy::Strict | CaretPolicy::Even, slop_y)
};
+ // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
MovedCaret(newPos, posDrag, true, dragCaretPolicies);
caret.on = true;
@@ -4523,7 +4523,7 @@ void Editor::DisplayCursor(Window::Cursor c) {
wMain.SetCursor(static_cast<Window::Cursor>(cursorMode));
}
-bool Editor::DragThreshold(Point ptStart, Point ptNow) {
+bool Editor::DragThreshold(Point ptStart, Point ptNow) noexcept {
const Point ptDiff = ptStart - ptNow;
const XYPOSITION distanceSquared = ptDiff.x * ptDiff.x + ptDiff.y * ptDiff.y;
return distanceSquared > 16.0f;
@@ -4590,6 +4590,9 @@ void Editor::DropAt(SelectionPosition position, const char *value, size_t length
SetSelection(posAfterInsertion, position);
}
}
+ // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+ EnsureCaretVisible();
+ // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
} else if (inDragDrop == DragDrop::dragging) {
SetEmptySelection(position);
}
@@ -4993,6 +4996,9 @@ void Editor::SetHoverIndicatorPosition(Sci::Position position) {
}
}
if (hoverIndicatorPosPrev != hoverIndicatorPos) {
+ // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+ TickFor(TickReason::dwell); // trigger SCN_DWELLSTART
+ // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
Redraw();
}
}
@@ -5149,7 +5155,13 @@ void Editor::ButtonMoveWithModifiers(Point pt, unsigned int, KeyMod modifiers) {
SetHotSpotRange(&pt);
} else {
if (hoverIndicatorPos != Sci::invalidPosition)
- DisplayCursor(Window::Cursor::hand);
+ // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+ {
+ const bool ctrl = FlagSet(modifiers, KeyMod::Ctrl);
+ const bool alt = FlagSet(modifiers, KeyMod::Alt);
+ DisplayCursor(ctrl ? Window::Cursor::hand : (alt ? Window::Cursor::arrow : Window::Cursor::text));
+ }
+ // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
else
DisplayCursor(Window::Cursor::text);
SetHotSpotRange(nullptr);
@@ -5453,19 +5465,19 @@ void Editor::QueueIdleWork(WorkItems items, Sci::Position upTo) {
workNeeded.Need(items, upTo);
}
-int Editor::SupportsFeature(Supports feature) {
+int Editor::SupportsFeature(Scintilla::Supports feature) const noexcept {
AutoSurface surface(this);
return surface->SupportsFeature(feature);
}
-bool Editor::PaintContains(PRectangle rc) {
+bool Editor::PaintContains(PRectangle rc) const noexcept {
if (rc.Empty()) {
return true;
}
return rcPaint.Contains(rc);
}
-bool Editor::PaintContainsMargin() {
+bool Editor::PaintContainsMargin() const noexcept {
if (HasMarginWindow()) {
// With separate margin view, paint of text view
// never contains margin.
@@ -6071,6 +6083,12 @@ void Editor::StyleSetMessage(Message iMessage, uptr_t wParam, sptr_t lParam) {
case Message::StyleSetUnderline:
vs.styles[wParam].underline = lParam != 0;
break;
+ // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+ // Added strike style, 2020-05-31
+ case Message::StyleSetStrike:
+ vs.styles[wParam].strike = lParam != 0;
+ break;
+ // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
case Message::StyleSetCase:
vs.styles[wParam].caseForce = static_cast<Style::CaseForce>(lParam);
break;
@@ -6134,6 +6152,11 @@ sptr_t Editor::StyleGetMessage(Message iMessage, uptr_t wParam, sptr_t lParam) {
return StringResult(lParam, vs.styles[wParam].fontName);
case Message::StyleGetUnderline:
return vs.styles[wParam].underline ? 1 : 0;
+ // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+ // Added strike style, 2020-05-31
+ case Message::StyleGetStrike:
+ return vs.styles[wParam].strike ? 1 : 0;
+ // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
case Message::StyleGetCase:
return static_cast<int>(vs.styles[wParam].caseForce);
case Message::StyleGetCharacterSet:
@@ -6904,7 +6927,9 @@ sptr_t Editor::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) {
break;
case Message::SetPrintMagnification:
- view.printParameters.magnification = static_cast<int>(wParam);
+ // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+ view.printParameters.magnification = std::clamp(static_cast<int>(wParam), SC_MIN_ZOOM_LEVEL, SC_MAX_ZOOM_LEVEL);
+ // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
break;
case Message::GetPrintMagnification:
@@ -7162,6 +7187,7 @@ sptr_t Editor::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) {
case Message::SetUseTabs:
pdoc->useTabs = wParam != 0;
+ InvalidateStyleRedraw();
break;
case Message::GetUseTabs:
@@ -7695,6 +7721,9 @@ sptr_t Editor::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) {
case Message::StyleSetSizeFractional:
case Message::StyleSetFont:
case Message::StyleSetUnderline:
+ // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+ case Message::StyleSetStrike:
+ // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
case Message::StyleSetCase:
case Message::StyleSetCharacterSet:
case Message::StyleSetVisible:
@@ -7716,6 +7745,9 @@ sptr_t Editor::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) {
case Message::StyleGetSizeFractional:
case Message::StyleGetFont:
case Message::StyleGetUnderline:
+ // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+ case Message::StyleGetStrike:
+ // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
case Message::StyleGetCase:
case Message::StyleGetCharacterSet:
case Message::StyleGetVisible:
@@ -8374,11 +8406,15 @@ sptr_t Editor::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) {
InvalidateStyleRedraw();
break;
- case Message::SetZoom:
- if (SetAppearance(vs.zoomLevel, static_cast<int>(wParam))) {
+ // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+ case Message::SetZoom: {
+ const int zoomLevel = std::clamp(static_cast<int>(wParam), SC_MIN_ZOOM_LEVEL, SC_MAX_ZOOM_LEVEL);
+ if (SetAppearance(vs.zoomLevel, zoomLevel)) {
NotifyZoom();
}
- break;
+ }
+ break;
+ // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
case Message::GetZoom:
return vs.zoomLevel;

View File

@ -0,0 +1,54 @@
diff --git a/_upgrade_staging/scintilla/src/Editor.h b/scintilla/src/Editor.h
index f8bc18970..26f3c1941 100644
--- a/_upgrade_staging/scintilla/src/Editor.h
+++ b/scintilla/src/Editor.h
@@ -69,13 +69,17 @@ class SelectionText {
public:
bool rectangular;
bool lineCopy;
+ // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+ bool asBinary;
int codePage;
Scintilla::CharacterSet characterSet;
- SelectionText() noexcept : rectangular(false), lineCopy(false), codePage(0), characterSet(Scintilla::CharacterSet::Ansi) {}
+ SelectionText() noexcept : rectangular(false), lineCopy(false), asBinary(false), codePage(0), characterSet(Scintilla::CharacterSet::Ansi) {}
void Clear() noexcept {
s.clear();
rectangular = false;
lineCopy = false;
+ asBinary = false;
+ // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
codePage = 0;
characterSet = Scintilla::CharacterSet::Ansi;
}
@@ -462,7 +466,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
virtual void NotifyChange() = 0;
virtual void NotifyFocus(bool focus);
virtual void SetCtrlID(int identifier);
- virtual int GetCtrlID() { return ctrlID; }
+ virtual int GetCtrlID() const noexcept { return ctrlID; }
virtual void NotifyParent(Scintilla::NotificationData scn) = 0;
virtual void NotifyStyleToNeeded(Sci::Position endStyleNeeded);
void NotifyChar(int ch, Scintilla::CharacterSource charSource);
@@ -537,7 +541,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
void CopyText(size_t length, const char *text);
void SetDragPosition(SelectionPosition newPos);
virtual void DisplayCursor(Window::Cursor c);
- virtual bool DragThreshold(Point ptStart, Point ptNow);
+ virtual bool DragThreshold(Point ptStart, Point ptNow) noexcept;
virtual void StartDrag();
void DropAt(SelectionPosition position, const char *value, size_t lengthValue, bool moving, bool rectangular);
void DropAt(SelectionPosition position, const char *value, bool moving, bool rectangular);
@@ -583,9 +587,9 @@ protected: // ScintillaBase subclass needs access to much of Editor
virtual void IdleWork();
virtual void QueueIdleWork(WorkItems items, Sci::Position upTo=0);
- virtual int SupportsFeature(Scintilla::Supports feature);
- virtual bool PaintContains(PRectangle rc);
- bool PaintContainsMargin();
+ virtual int SupportsFeature(Scintilla::Supports feature) const noexcept;
+ virtual bool PaintContains(PRectangle rc) const noexcept;
+ bool PaintContainsMargin() const noexcept;
void CheckForChangeOutsidePaint(Range r);
void SetBraceHighlight(Sci::Position pos0, Sci::Position pos1, int matchStyle);

View File

@ -0,0 +1,39 @@
diff --git a/_upgrade_staging/scintilla/src/EditView.cxx b/scintilla/src/EditView.cxx
index 3bf0a1fbb..285bb2b2c 100644
--- a/_upgrade_staging/scintilla/src/EditView.cxx
+++ b/scintilla/src/EditView.cxx
@@ -70,7 +70,9 @@ using namespace Scintilla;
using namespace Scintilla::Internal;
PrintParameters::PrintParameters() noexcept {
- magnification = 0;
+ // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+ magnification = 100;
+ // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
colourMode = PrintOption::Normal;
wrapState = Wrap::Word;
}
@@ -602,7 +604,7 @@ void EditView::LayoutLine(const EditModel &model, Surface *surface, const ViewSt
// Fill the LineLayout bidirectional data fields according to each char style
void EditView::UpdateBidiData(const EditModel &model, const ViewStyle &vstyle, LineLayout *ll) {
- if (model.BidirectionalEnabled() && (ll->numCharsInLine >= 0)) {
+ if (model.BidirectionalEnabled()) {
ll->EnsureBidiData();
for (int stylesInLine = 0; stylesInLine < ll->numCharsInLine; stylesInLine++) {
ll->bidiData->stylesFonts[stylesInLine] = vstyle.styles[ll->styles[stylesInLine]].font;
@@ -2320,6 +2322,14 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi
}
surface->FillRectangleAligned(rcUL, colourUnderline);
}
+ // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+ else if (vsDraw.styles[styleMain].strike) {
+ PRectangle rcUL = rcSegment;
+ rcUL.top = rcUL.top + std::ceil((rcUL.bottom - rcUL.top) / 2);
+ rcUL.bottom = rcUL.top + 1;
+ surface->FillRectangleAligned(rcUL, Fill(textFore));
+ }
+ // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
} else if (horizontal.left > rcLine.right) {
break;
}

View File

@ -0,0 +1,14 @@
diff --git a/_upgrade_staging/scintilla/src/Partitioning.h b/scintilla/src/Partitioning.h
index db2e63c11..7cd3d4df9 100644
--- a/_upgrade_staging/scintilla/src/Partitioning.h
+++ b/scintilla/src/Partitioning.h
@@ -8,6 +8,9 @@
#ifndef PARTITIONING_H
#define PARTITIONING_H
+// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+#include <memory>
+// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
namespace Scintilla::Internal {
/// Divide an interval into multiple partitions.

View File

@ -1,6 +1,6 @@
diff --git a/_upgrade_staging/scintilla557/scintilla/src/Platform.h b/scintilla/src/Platform.h
diff --git a/_upgrade_staging/scintilla/src/Platform.h b/scintilla/src/Platform.h
index 119b4ef3f..035fb3f86 100644
--- a/_upgrade_staging/scintilla557/scintilla/src/Platform.h
--- a/_upgrade_staging/scintilla/src/Platform.h
+++ b/scintilla/src/Platform.h
@@ -81,6 +81,12 @@

View File

@ -0,0 +1,41 @@
diff --git a/_upgrade_staging/scintilla/src/ScintillaBase.cxx b/scintilla/src/ScintillaBase.cxx
index 1f4c360da..d448dad59 100644
--- a/_upgrade_staging/scintilla/src/ScintillaBase.cxx
+++ b/scintilla/src/ScintillaBase.cxx
@@ -156,10 +156,12 @@ int ScintillaBase::KeyCommand(Message iMessage) {
AutoCompleteMove(-ac.lb->GetVisibleRows());
return 0;
case Message::VCHome:
- AutoCompleteMove(-5000);
+ case Message::HomeWrap:
+ AutoCompleteMove(-10000);
return 0;
case Message::LineEnd:
- AutoCompleteMove(5000);
+ case Message::LineEndWrap:
+ AutoCompleteMove(10000);
return 0;
case Message::DeleteBack:
DelCharBack(true);
@@ -561,6 +563,10 @@ void ScintillaBase::CallTipClick() {
NotifyParent(scn);
}
+
+// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+#if SCI_EnablePopupMenu
+
bool ScintillaBase::ShouldDisplayPopup(Point ptInWindowCoordinates) const {
return (displayPopupMenu == PopUp::All ||
(displayPopupMenu == PopUp::Text && !PointInSelMargin(ptInWindowCoordinates)));
@@ -583,6 +589,10 @@ void ScintillaBase::ContextMenu(Point pt) {
}
}
+#endif
+// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
+
+
void ScintillaBase::CancelModes() {
AutoCompleteCancel();
ct.CallTipCancel();

View File

@ -0,0 +1,27 @@
diff --git a/_upgrade_staging/scintilla/src/ScintillaBase.h b/scintilla/src/ScintillaBase.h
index d3a6e1ad6..cc575c7c5 100644
--- a/_upgrade_staging/scintilla/src/ScintillaBase.h
+++ b/scintilla/src/ScintillaBase.h
@@ -87,9 +87,13 @@ protected:
void CallTipShow(Point pt, const char *defn);
virtual void CreateCallTipWindow(PRectangle rc) = 0;
+// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+#if SCI_EnablePopupMenu
virtual void AddToPopUp(const char *label, int cmd=0, bool enabled=true) = 0;
bool ShouldDisplayPopup(Point ptInWindowCoordinates) const;
void ContextMenu(Point pt);
+#endif
+// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
void ButtonDownWithModifiers(Point pt, unsigned int curTime, Scintilla::KeyMod modifiers) override;
void RightButtonDownWithModifiers(Point pt, unsigned int curTime, Scintilla::KeyMod modifiers) override;
@@ -97,7 +101,7 @@ protected:
void NotifyStyleToNeeded(Sci::Position endStyleNeeded) override;
public:
- ~ScintillaBase() override;
+ virtual ~ScintillaBase() override;
// Public so scintilla_send_message can use it
Scintilla::sptr_t WndProc(Scintilla::Message iMessage, Scintilla::uptr_t wParam, Scintilla::sptr_t lParam) override;

View File

@ -0,0 +1,15 @@
diff --git a/_upgrade_staging/scintilla/src/SplitVector.h b/scintilla/src/SplitVector.h
index d46156e27..c4befe78b 100644
--- a/_upgrade_staging/scintilla/src/SplitVector.h
+++ b/scintilla/src/SplitVector.h
@@ -9,6 +9,10 @@
#ifndef SPLITVECTOR_H
#define SPLITVECTOR_H
+// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+#include "Debugging.h"
+// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
+
namespace Scintilla::Internal {
template <typename T>

View File

@ -0,0 +1,14 @@
diff --git a/_upgrade_staging/scintilla/src/Style.cxx b/scintilla/src/Style.cxx
index 2c78c5241..16643fb95 100644
--- a/_upgrade_staging/scintilla/src/Style.cxx
+++ b/scintilla/src/Style.cxx
@@ -74,6 +74,9 @@ Style::Style(const char *fontName_) noexcept :
back(white),
eolFilled(false),
underline(false),
+ // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+ strike(false),
+ // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
caseForce(CaseForce::mixed),
visible(true),
changeable(true),

View File

@ -0,0 +1,14 @@
diff --git a/_upgrade_staging/scintilla/src/Style.h b/scintilla/src/Style.h
index 19679cd04..6bbfd4275 100644
--- a/_upgrade_staging/scintilla/src/Style.h
+++ b/scintilla/src/Style.h
@@ -47,6 +47,9 @@ public:
ColourRGBA back;
bool eolFilled;
bool underline;
+// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+ bool strike;
+// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
enum class CaseForce {mixed, upper, lower, camel};
CaseForce caseForce;
bool visible;

View File

@ -0,0 +1,116 @@
diff --git a/_upgrade_staging/scintilla/src/ViewStyle.cxx b/scintilla/src/ViewStyle.cxx
index 92d084ee6..f1301aec5 100644
--- a/_upgrade_staging/scintilla/src/ViewStyle.cxx
+++ b/scintilla/src/ViewStyle.cxx
@@ -61,9 +61,12 @@ bool MarginStyle::ShowsFolding() const noexcept {
void FontRealised::Realise(Surface &surface, int zoomLevel, Technology technology, const FontSpecification &fs, const char *localeName) {
PLATFORM_ASSERT(fs.fontName);
- measurements.sizeZoomed = fs.size + zoomLevel * FontSizeMultiplier;
- if (measurements.sizeZoomed <= FontSizeMultiplier) // May fail if sizeZoomed < 1
- measurements.sizeZoomed = FontSizeMultiplier;
+ // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+ //~measurements.sizeZoomed = fs.size + zoomLevel * FontSizeMultiplier;
+ //~if (measurements.sizeZoomed <= FontSizeMultiplier) // May fail if sizeZoomed < 1
+ //~ measurements.sizeZoomed = FontSizeMultiplier;
+ measurements.sizeZoomed = GetFontSizeZoomed(fs.size, zoomLevel);
+ // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
const float deviceHeight = static_cast<float>(surface.DeviceHeightFont(measurements.sizeZoomed));
const FontParameters fp(fs.fontName, deviceHeight / FontSizeMultiplier, fs.weight,
@@ -225,7 +228,9 @@ ViewStyle::ViewStyle(size_t stylesSize_) :
marginInside = true;
CalculateMarginWidthAndMask();
textStart = marginInside ? fixedColumnWidth : leftMarginWidth;
- zoomLevel = 0;
+ // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+ zoomLevel = 100; /// @ 20018-09-06 Changed to percent
+ // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
viewWhitespace = WhiteSpace::Invisible;
tabDrawMode = TabDrawMode::LongArrow;
whitespaceSize = 1;
@@ -413,11 +418,9 @@ void ViewStyle::Refresh(Surface &surface, int tabInChars) {
maxAscent = std::max(1.0, maxAscent + extraAscent);
maxDescent = std::max(0.0, maxDescent + extraDescent);
lineHeight = static_cast<int>(std::lround(maxAscent + maxDescent));
- lineOverlap = lineHeight / 10;
- if (lineOverlap < 2)
- lineOverlap = 2;
- if (lineOverlap > lineHeight)
- lineOverlap = lineHeight;
+ // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+ lineOverlap = std::clamp(lineHeight / 10, 1, std::max(1, lineHeight));
+ // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
someStylesProtected = std::any_of(styles.cbegin(), styles.cend(),
[](const Style &style) noexcept { return style.IsProtected(); });
@@ -427,7 +430,10 @@ void ViewStyle::Refresh(Surface &surface, int tabInChars) {
aveCharWidth = styles[StyleDefault].aveCharWidth;
spaceWidth = styles[StyleDefault].spaceWidth;
- tabWidth = spaceWidth * tabInChars;
+ // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+ //~tabWidth = spaceWidth * tabInChars;
+ tabWidth = aveCharWidth * tabInChars;
+ // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
controlCharWidth = 0.0;
if (controlCharSymbol >= 32) {
@@ -761,6 +767,44 @@ ViewStyle::CaretShape ViewStyle::CaretShapeForMode(bool inOverstrike, bool isMai
return (caretStyle <= CaretStyle::Block) ? static_cast<CaretShape>(caretStyle) : CaretShape::line;
}
+// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+bool ViewStyle::ZoomIn() noexcept {
+ if (zoomLevel < SC_MAX_ZOOM_LEVEL) {
+ int level = zoomLevel;
+ if (level < 200) {
+ level += 10;
+ } else {
+ level += 25;
+ }
+
+ level = std::min(level, SC_MAX_ZOOM_LEVEL);
+ if (level != zoomLevel) {
+ zoomLevel = level;
+ return true;
+ }
+ }
+ return false;
+}
+
+bool ViewStyle::ZoomOut() noexcept {
+ if (zoomLevel > SC_MIN_ZOOM_LEVEL) {
+ int level = zoomLevel;
+ if (level <= 200) {
+ level -= 10;
+ } else {
+ level -= 25;
+ }
+
+ level = std::max(level, SC_MIN_ZOOM_LEVEL);
+ if (level != zoomLevel) {
+ zoomLevel = level;
+ return true;
+ }
+ }
+ return false;
+}
+// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
+
void ViewStyle::AllocStyles(size_t sizeNew) {
size_t i=styles.size();
styles.resize(sizeNew);
@@ -782,10 +826,10 @@ void ViewStyle::CreateAndAddFont(const FontSpecification &fs) {
}
}
-FontRealised *ViewStyle::Find(const FontSpecification &fs) {
+FontRealised *ViewStyle::Find(const FontSpecification &fs) const {
if (!fs.fontName) // Invalid specification so return arbitrary object
return fonts.begin()->second.get();
- const FontMap::iterator it = fonts.find(fs);
+ const auto it = fonts.find(fs);
if (it != fonts.end()) {
// Should always reach here since map was just set for all styles
return it->second.get();

View File

@ -0,0 +1,58 @@
diff --git a/_upgrade_staging/scintilla/src/ViewStyle.h b/scintilla/src/ViewStyle.h
index 6985e3f03..28474d536 100644
--- a/_upgrade_staging/scintilla/src/ViewStyle.h
+++ b/scintilla/src/ViewStyle.h
@@ -8,6 +8,10 @@
#ifndef VIEWSTYLE_H
#define VIEWSTYLE_H
+// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+#include "Scintilla.h"
+// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
+
namespace Scintilla::Internal {
/**
@@ -67,6 +71,14 @@ struct CaretLineAppearance {
int frame = 0;
};
+// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+constexpr int GetFontSizeZoomed(int size, int zoomLevel) noexcept {
+ size = (size * zoomLevel + 50) / 100;
+ // Hangs if sizeZoomed (in point) <= 1
+ return std::max(size, 2 * FontSizeMultiplier);
+}
+// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
+
struct CaretAppearance {
// Line, block, over-strike bar ...
Scintilla::CaretStyle style = CaretStyle::Line;
@@ -148,7 +160,9 @@ public:
int fixedColumnWidth = 0; ///< Total width of margins
bool marginInside; ///< true: margin included in text view, false: separate views
int textStart; ///< Starting x position of text within the view
- int zoomLevel;
+ // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+ int zoomLevel; /// @ 2018-09-06 Changed to a percent value
+ // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
Scintilla::WhiteSpace viewWhitespace;
Scintilla::TabDrawMode tabDrawMode;
int whitespaceSize;
@@ -245,11 +259,15 @@ public:
bool IsCaretVisible(bool isMainSelection) const noexcept;
bool DrawCaretInsideSelection(bool inOverstrike, bool imeCaretBlockOverride) const noexcept;
CaretShape CaretShapeForMode(bool inOverstrike, bool isMainSelection) const noexcept;
+ // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+ bool ZoomIn() noexcept;
+ bool ZoomOut() noexcept;
+ // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
private:
void AllocStyles(size_t sizeNew);
void CreateAndAddFont(const FontSpecification &fs);
- FontRealised *Find(const FontSpecification &fs);
+ FontRealised *Find(const FontSpecification &fs) const;
void FindMaxAscentDescent() noexcept;
};

View File

@ -0,0 +1,15 @@
diff --git a/_upgrade_staging/scintilla/win32/ListBox.cxx b/scintilla/win32/ListBox.cxx
index 0548ea5bc..fb2632a44 100644
--- a/_upgrade_staging/scintilla/win32/ListBox.cxx
+++ b/scintilla/win32/ListBox.cxx
@@ -537,7 +537,9 @@ void ListBoxX::SetOptions(ListOptions options_) {
void ListBoxX::AdjustWindowRect(PRectangle *rc, UINT dpiAdjust) const noexcept {
RECT rcw = RectFromPRectangle(*rc);
- AdjustWindowRectForDpi(&rcw, frameStyle, dpiAdjust);
+ // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+ AdjustWindowRectForDpi(&rcw, frameStyle, WS_EX_WINDOWEDGE, dpiAdjust);
+ // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
*rc = PRectangleFromRECT(rcw);
}

View File

@ -1,6 +1,6 @@
diff --git a/_upgrade_staging/scintilla557/scintilla/win32/PlatWin.cxx b/scintilla/win32/PlatWin.cxx
diff --git a/_upgrade_staging/scintilla/win32/PlatWin.cxx b/scintilla/win32/PlatWin.cxx
index ff47c28ab..735c68b4a 100644
--- a/_upgrade_staging/scintilla557/scintilla/win32/PlatWin.cxx
--- a/_upgrade_staging/scintilla/win32/PlatWin.cxx
+++ b/scintilla/win32/PlatWin.cxx
@@ -29,9 +29,11 @@
#define NOMINMAX

View File

@ -0,0 +1,18 @@
diff --git a/_upgrade_staging/scintilla/win32/PlatWin.h b/scintilla/win32/PlatWin.h
index 2ffc4a5fb..8ebf5bd7a 100644
--- a/_upgrade_staging/scintilla/win32/PlatWin.h
+++ b/scintilla/win32/PlatWin.h
@@ -70,7 +70,12 @@ float GetDeviceScaleFactorWhenGdiScalingActive(HWND hWnd) noexcept;
int SystemMetricsForDpi(int nIndex, UINT dpi) noexcept;
-void AdjustWindowRectForDpi(LPRECT lpRect, DWORD dwStyle, UINT dpi) noexcept;
+// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+#ifndef AlphaBlend
+#define AlphaBlend GdiAlphaBlend
+#endif
+BOOL AdjustWindowRectForDpi(LPRECT lpRect, DWORD dwStyle, DWORD dwExStyle, UINT dpi) noexcept;
+// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
HCURSOR LoadReverseArrowCursor(UINT dpi) noexcept;

View File

@ -1,6 +1,6 @@
diff --git a/_upgrade_staging/scintilla557/scintilla/win32/ScintillaWin.cxx b/scintilla/win32/ScintillaWin.cxx
index b4c268562..064bb9746 100644
--- a/_upgrade_staging/scintilla557/scintilla/win32/ScintillaWin.cxx
diff --git a/_upgrade_staging/scintilla/win32/ScintillaWin.cxx b/scintilla/win32/ScintillaWin.cxx
index fbec35f76..064bb9746 100644
--- a/_upgrade_staging/scintilla/win32/ScintillaWin.cxx
+++ b/scintilla/win32/ScintillaWin.cxx
@@ -33,9 +33,11 @@
#define NOMINMAX
@ -103,17 +103,6 @@ index b4c268562..064bb9746 100644
const Point ptDifference = ptStart - ptNow;
const XYPOSITION xMove = std::trunc(std::abs(ptDifference.x));
const XYPOSITION yMove = std::trunc(std::abs(ptDifference.y));
@@ -1628,8 +1641,8 @@ UINT CodePageFromCharSet(CharacterSet characterSet, UINT documentCodePage) noexc
return CpUtf8;
}
switch (characterSet) {
- case CharacterSet::Ansi: return 1252;
- case CharacterSet::Default: return documentCodePage ? documentCodePage : 1252;
+ case CharacterSet::Ansi: return codePageWindowsLatin;
+ case CharacterSet::Default: return documentCodePage ? documentCodePage : codePageWindowsLatin;
case CharacterSet::Baltic: return 1257;
case CharacterSet::ChineseBig5: return 950;
case CharacterSet::EastEurope: return 1250;
@@ -1758,11 +1771,21 @@ Window::Cursor ScintillaWin::ContextCursor(Point pt) {
const Sci::Position pos = PositionFromLocation(pt, true, true);
if (pos != Sci::invalidPosition) {