Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions scintilla/call/ScintillaCall.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -563,9 +563,11 @@ void ScintillaCall::StyleSetUnderline(int style, bool underline) {
Call(Message::StyleSetUnderline, style, underline);
}

// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
void ScintillaCall::StyleSetStrike(int style, bool strike) {
Call(Message::StyleSetStrike, style, strike);
}
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<

Colour ScintillaCall::StyleGetFore(int style) {
return static_cast<Colour>(Call(Message::StyleGetFore, style));
Expand Down Expand Up @@ -603,9 +605,11 @@ bool ScintillaCall::StyleGetUnderline(int style) {
return Call(Message::StyleGetUnderline, style);
}

// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
bool ScintillaCall::StyleGetStrike(int style) {
return Call(Message::StyleGetStrike, style);
}
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<

CaseVisible ScintillaCall::StyleGetCase(int style) {
return static_cast<Scintilla::CaseVisible>(Call(Message::StyleGetCase, style));
Expand Down
2 changes: 1 addition & 1 deletion scintilla/include/ILoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ILoader {
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() noexcept = 0;
virtual void * SCI_METHOD ConvertToDocument() = 0;
};

static constexpr int deRelease0 = 0;
Expand Down
2 changes: 2 additions & 0 deletions scintilla/include/Sci_Position.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
#ifndef SCI_POSITION_H
#define SCI_POSITION_H

// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
#if defined(__cplusplus)
#include <cstddef>
#else
#include <stddef.h>
#endif
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<

// Basic signed type used throughout interface
typedef ptrdiff_t Sci_Position;
Expand Down
14 changes: 14 additions & 0 deletions scintilla/include/Scintilla.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ __declspec(dllexport) int Scintilla_AdjustWindowRectForDpi(LPWRECT lpRect,
#endif

// Include header that defines basic numeric types.
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
#if defined(__cplusplus)
#include <cstdint>
#else
#include <stdint.h>
#endif
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<

// Define uptr_t, an unsigned integer type large enough to hold a pointer.
typedef uintptr_t uptr_t;
Expand All @@ -57,7 +59,9 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP
#define SCI_START 2000
#define SCI_OPTIONAL_START 3000
#define SCI_LEXER_START 4000
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
#define SCI_DEV_USER_DEFINED 6000
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
#define SCI_ADDTEXT 2001
#define SCI_ADDSTYLEDTEXT 2002
#define SCI_INSERTTEXT 2003
Expand Down Expand Up @@ -126,8 +130,10 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP
#define SC_IME_INLINE 1
#define SCI_GETIMEINTERACTION 2678
#define SCI_SETIMEINTERACTION 2679
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
#define SCI_ISIMEOPEN 6003
#define SCI_ISIMEMODECJK 6004
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
#define SC_ALPHA_TRANSPARENT 0
#define SC_ALPHA_OPAQUE 255
#define SC_ALPHA_NOALPHA 256
Expand Down Expand Up @@ -268,7 +274,9 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP
#define SCI_STYLESETEOLFILLED 2057
#define SCI_STYLERESETDEFAULT 2058
#define SCI_STYLESETUNDERLINE 2059
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
#define SCI_STYLESETSTRIKE 6001
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
#define SC_CASE_MIXED 0
#define SC_CASE_UPPER 1
#define SC_CASE_LOWER 2
Expand All @@ -281,7 +289,9 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP
#define SCI_STYLEGETFONT 2486
#define SCI_STYLEGETEOLFILLED 2487
#define SCI_STYLEGETUNDERLINE 2488
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
#define SCI_STYLEGETSTRIKE 6002
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
#define SCI_STYLEGETCASE 2489
#define SCI_STYLEGETCHARACTERSET 2490
#define SCI_STYLEGETVISIBLE 2491
Expand Down Expand Up @@ -538,7 +548,9 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP
#define SCFIND_NONE 0x0
#define SCFIND_WHOLEWORD 0x2
#define SCFIND_MATCHCASE 0x4
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
#define SCFIND_DOT_MATCH_ALL 0x1000
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
#define SCFIND_WORDSTART 0x00100000
#define SCFIND_REGEXP 0x00200000
#define SCFIND_POSIX 0x00400000
Expand Down Expand Up @@ -1221,7 +1233,9 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP
#define SCI_GETLEXER 4002
#define SCI_COLOURISE 4003
#define SCI_SETPROPERTY 4004
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
#define KEYWORDSET_MAX 15
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
#define SCI_SETKEYWORDS 4005
#define SCI_GETPROPERTY 4008
#define SCI_GETPROPERTYEXPANDED 4009
Expand Down
2 changes: 2 additions & 0 deletions scintilla/include/Scintilla.iface
Original file line number Diff line number Diff line change
Expand Up @@ -3339,7 +3339,9 @@ fun void Colourise=4003(position start, position end)
set void SetProperty=4004(string key, string value)

# Maximum value of keywordSet parameter of SetKeyWords.
# >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
val KEYWORDSET_MAX=15
# <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<

# Set up the key words used by the lexer.
set void SetKeyWords=4005(int keyWordSet, string keyWords)
Expand Down
6 changes: 5 additions & 1 deletion scintilla/include/ScintillaCall.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,9 @@ class ScintillaCall {
void StyleSetEOLFilled(int style, bool eolFilled);
void StyleResetDefault();
void StyleSetUnderline(int style, bool underline);
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
void StyleSetStrike(int style, bool strike);
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
Colour StyleGetFore(int style);
Colour StyleGetBack(int style);
bool StyleGetBold(int style);
Expand All @@ -196,7 +198,9 @@ class ScintillaCall {
std::string StyleGetFont(int style);
bool StyleGetEOLFilled(int style);
bool StyleGetUnderline(int style);
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
bool StyleGetStrike(int style);
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
Scintilla::CaseVisible StyleGetCase(int style);
Scintilla::CharacterSet StyleGetCharacterSet(int style);
bool StyleGetVisible(int style);
Expand Down Expand Up @@ -889,7 +893,7 @@ class ScintillaCall {
Scintilla::EOLAnnotationVisible EOLAnnotationGetVisible();
void EOLAnnotationSetStyleOffset(int style);
int EOLAnnotationGetStyleOffset();
bool SupportsFeature(Scintilla::Supports feature) noexcept;
bool SupportsFeature(Scintilla::Supports feature);
Scintilla::LineCharacterIndexType LineCharacterIndex();
void AllocateLineCharacterIndex(Scintilla::LineCharacterIndexType lineCharacterIndex);
void ReleaseLineCharacterIndex(Scintilla::LineCharacterIndexType lineCharacterIndex);
Expand Down
4 changes: 4 additions & 0 deletions scintilla/include/ScintillaMessages.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ enum class Message {
StyleSetEOLFilled = 2057,
StyleResetDefault = 2058,
StyleSetUnderline = 2059,
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
StyleSetStrike = 6001,
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
StyleGetFore = 2481,
StyleGetBack = 2482,
StyleGetBold = 2483,
Expand All @@ -124,7 +126,9 @@ enum class Message {
StyleGetFont = 2486,
StyleGetEOLFilled = 2487,
StyleGetUnderline = 2488,
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
StyleGetStrike = 6002,
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
StyleGetCase = 2489,
StyleGetCharacterSet = 2490,
StyleGetVisible = 2491,
Expand Down
4 changes: 4 additions & 0 deletions scintilla/include/ScintillaTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,9 @@ enum class FindOption {
None = 0x0,
WholeWord = 0x2,
MatchCase = 0x4,
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
DotMatchAll = 0x1000,
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
WordStart = 0x00100000,
RegExp = 0x00200000,
Posix = 0x00400000,
Expand Down Expand Up @@ -743,9 +745,11 @@ constexpr int MaskFolders = 0xFE000000;
constexpr int MaxMargin = 4;
constexpr int FontSizeMultiplier = 100;
constexpr int TimeForever = 10000000;
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
constexpr int MinZoomLevel = 10;
constexpr int MaxZoomLevel = 1000;
constexpr int KeywordsetMax = 15;
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<

//--Autogenerated -- end of section automatically generated from Scintilla.iface

Expand Down
10 changes: 6 additions & 4 deletions scintilla/np3_patches/001_directwrite_font_resolution.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/scintilla/win32/SurfaceD2D.cxx b/scintilla/win32/SurfaceD2D.cxx
index 0ca7a9475..57b53880f 100644
index de8b7aea4..d554a0679 100644
--- a/scintilla/win32/SurfaceD2D.cxx
+++ b/scintilla/win32/SurfaceD2D.cxx
@@ -161,6 +161,83 @@ constexpr D2D1_TEXT_ANTIALIAS_MODE DWriteMapFontQuality(FontQuality extraFontFla
@@ -164,6 +164,83 @@ constexpr D2D1_TEXT_ANTIALIAS_MODE DWriteMapFontQuality(FontQuality extraFontFla
}
}

Expand Down Expand Up @@ -86,7 +86,7 @@ index 0ca7a9475..57b53880f 100644
struct FontDirectWrite : public FontWin {
ComPtr<IDWriteTextFormat> pTextFormat;
FontQuality extraFontFlag = FontQuality::QualityDefault;
@@ -173,21 +250,37 @@ struct FontDirectWrite : public FontWin {
@@ -176,23 +253,39 @@ struct FontDirectWrite : public FontWin {
explicit FontDirectWrite(const FontParameters &fp) :
extraFontFlag(fp.extraFontFlag),
characterSet(fp.characterSet) {
Expand All @@ -107,7 +107,6 @@ index 0ca7a9475..57b53880f 100644
+ if (fp.italic) {
+ style = DWRITE_FONT_STYLE_ITALIC;
+ }
+// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
+
const std::wstring wsLocale = WStringFromUTF8(fp.localeName);
const FLOAT fHeight = static_cast<FLOAT>(fp.size);
Expand All @@ -130,4 +129,7 @@ index 0ca7a9475..57b53880f 100644
+ stretch,
fHeight, L"en-us", pTextFormat.ReleaseAndGetAddressOf());
}
+// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
if (SUCCEEDED(hr)) {
pTextFormat->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP);

51 changes: 51 additions & 0 deletions scintilla/np3_patches/003_mousevanish_cursor_scope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Scope "Hide Pointer While Typing" to the Edit Client

## Description

Reworks the "hide mouse pointer while typing" behaviour (Windows setting
`SPI_GETMOUSEVANISH`) so it is scoped to the Scintilla **edit client** instead of
the whole application.

Previously the pointer was hidden with `::ShowCursor(FALSE)`. That API manipulates
a **per-input-queue (application-wide) counter**: because Notepad3's main window,
toolbar, statusbar, scrollbars, margins and the edit control all run on the same
thread/input-queue, typing blanked the pointer over the *entire* window. The
matching `::ShowCursor(TRUE)` only ran inside the edit control's mouse handlers, so
when the pointer re-entered over a non-text region (toolbar/margins/scrollbar) it
stayed invisible until it finally reached the text area — "the pointer is invisible
for a while after moving back in".

The patch switches to `::SetCursor(nullptr)`, which is per-window / per-message and
does **not** touch the shared show-count. The empty cursor is re-asserted in
`WM_SETCURSOR` while `cursorIsHidden` is set (so it stays hidden over the text area
during typing), and is cleared on genuine pointer movement, on `WM_MOUSELEAVE` and
on `WM_KILLFOCUS`. A hidden pointer is only revealed on a *real* `WM_MOUSEMOVE`
(position actually changed), preventing the flicker from synthetic moves that
Windows generates when a popup/statusbar repaints under a stationary pointer.

## Issues Fixed

- Pointer invisible over toolbar/margins/scrollbars "for a while" after typing with
the mouse outside the window, then moving it back in.

## Related History

- [#4942](https://github.com/rizonesoft/Notepad3/issues/4942) - Typing causes cursor
to flash, disappear and reappear (anti-flicker `ptMouseLast != pt` gate preserved).
- [#5369](https://github.com/rizonesoft/Notepad3/issues/5369) - Recover cursor state
when the editor window loses focus (`WM_KILLFOCUS` recovery preserved).

## Files Modified

- `scintilla/win32/ScintillaWin.cxx`

## Changes

1. `HideCursorIfPreferred()` - hide via `::SetCursor(nullptr)` instead of
`::ShowCursor(FALSE)` (client-scoped, not the process-wide counter).
2. `WM_SETCURSOR` (`HTCLIENT`) - while hidden, re-assert `::SetCursor(nullptr)`;
otherwise show the context cursor as before.
3. `WM_MOUSEMOVE` - reveal only on real movement (`ptMouseLast != pt`) via
`DisplayCursor(ContextCursor(pt))`; removed `::ShowCursor(TRUE)`.
4. `WM_MOUSELEAVE` / `WM_KILLFOCUS` - clear `cursorIsHidden` only (no counter to
restore); removed `::ShowCursor(TRUE)`.
86 changes: 86 additions & 0 deletions scintilla/np3_patches/003_mousevanish_cursor_scope.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
diff --git a/scintilla/win32/ScintillaWin.cxx b/scintilla/win32/ScintillaWin.cxx
index 8712c40af..aaf069b58 100644
--- a/scintilla/win32/ScintillaWin.cxx
+++ b/scintilla/win32/ScintillaWin.cxx
@@ -1887,10 +1887,14 @@ sptr_t ScintillaWin::MouseMessage(unsigned int iMessage, uptr_t wParam, sptr_t l

// Windows might send WM_MOUSEMOVE even though the mouse has not been moved:
// http://blogs.msdn.com/b/oldnewthing/archive/2003/10/01/55108.aspx
+ // Only a *real* movement (position actually changed) reveals a pointer
+ // hidden while typing. Spurious moves (Windows synthesizes WM_MOUSEMOVE
+ // when a popup/statusbar repaints under a stationary pointer) must NOT
+ // reveal it, otherwise the pointer flickers while typing (issue #4942).
if (ptMouseLast != pt) {
if (cursorIsHidden) {
- ::ShowCursor(TRUE);
- cursorIsHidden = false; // to be shown by ButtonMoveWithModifiers
+ cursorIsHidden = false;
+ DisplayCursor(ContextCursor(pt));
}
SetTrackMouseLeaveEvent(true);
ButtonMoveWithModifiers(pt, ::GetMessageTime(), MouseModifiers(wParam));
@@ -1901,8 +1905,9 @@ sptr_t ScintillaWin::MouseMessage(unsigned int iMessage, uptr_t wParam, sptr_t l

case WM_MOUSELEAVE:
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+ // Pointer left the edit client: drop the "hidden while typing" state so
+ // the normal pointer is shown again (nothing to restore, SetCursor-scoped).
if (cursorIsHidden) {
- ::ShowCursor(TRUE);
cursorIsHidden = false;
}
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
@@ -2064,8 +2069,11 @@ sptr_t ScintillaWin::FocusMessage(unsigned int iMessage, uptr_t wParam, sptr_t)
switch (iMessage) {
case WM_KILLFOCUS: {
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+ // Losing focus while typing: drop the "hidden while typing" state. The
+ // system does not send WM_MOUSELEAVE when the pointer is not above this
+ // window, so this is the recovery point for that case (nothing to
+ // restore, hiding is SetCursor-scoped, not ShowCursor()-counter based).
if (cursorIsHidden) {
- ::ShowCursor(TRUE);
cursorIsHidden = false;
}
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
@@ -2404,13 +2412,24 @@ sptr_t ScintillaWin::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) {

case WM_SETCURSOR:
if (LOWORD(lParam) == HTCLIENT) {
- if (!cursorIsHidden) {
+ // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
+ // "Hide pointer while typing" (SPI_GETMOUSEVANISH) is scoped to the
+ // edit client only. While hidden, re-assert the empty cursor here so
+ // it stays hidden over the text area during typing WITHOUT using the
+ // process-wide ShowCursor() counter. ShowCursor() is per input-queue
+ // and thus shared by the toolbar / statusbar / scrollbars / margins,
+ // which would then also blank the pointer until it happens to re-enter
+ // the text area ("pointer invisible for a while" on re-entry).
+ if (cursorIsHidden) {
+ ::SetCursor(nullptr);
+ } else {
POINT pt;
if (::GetCursorPos(&pt)) {
::ScreenToClient(MainHWND(), &pt);
DisplayCursor(ContextCursor(PointFromPOINT(pt)));
}
}
+ // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
return TRUE;
} else {
return ::DefWindowProc(MainHWND(), msg, wParam, lParam);
@@ -2682,8 +2701,12 @@ void ScintillaWin::HideCursorIfPreferred() noexcept {
// SPI_GETMOUSEVANISH from OS.
if (typingWithoutCursor && !cursorIsHidden) {
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
- //::SetCursor({});
- ::ShowCursor(FALSE);
+ // Hide the pointer for the edit client only. SetCursor(nullptr) is
+ // per-window/per-message (not the process-wide ShowCursor() counter),
+ // so the toolbar / statusbar / scrollbars / margins keep their normal
+ // pointer. WM_SETCURSOR re-asserts this while cursorIsHidden stays set,
+ // and a real WM_MOUSEMOVE clears it again (see MouseMessage()).
+ ::SetCursor(nullptr);
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
cursorIsHidden = true;
}
Loading