fix: patch Scintilla to try to fix "vanishing mouse pointer" issue

chore: realign to original Scintilla Source Code (except functional patches)
This commit is contained in:
METANEOCORTEX\Kotti 2026-07-10 11:48:20 +02:00
parent 2212cf1298
commit 9fba9f75c3
27 changed files with 306 additions and 101 deletions

View File

@ -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));
@ -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));

View File

@ -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() noexcept = 0;
virtual void * SCI_METHOD ConvertToDocument() = 0;
};
static constexpr int deRelease0 = 0;

View File

@ -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;

View File

@ -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;
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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

View File

@ -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)

View File

@ -186,7 +186,9 @@ public:
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);
@ -196,7 +198,9 @@ public:
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);
@ -889,7 +893,7 @@ public:
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);

View File

@ -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,
@ -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,

View File

@ -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,
@ -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

View File

@ -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
}
}
@ -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) {
@ -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);
@ -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);

View File

@ -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)`.

View File

@ -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;
}

View File

@ -15,11 +15,11 @@
using namespace Scintilla::Internal;
CharClassify::CharClassify() noexcept : charClass{} {
CharClassify::CharClassify() : charClass{} {
SetDefaultCharClasses(true);
}
void CharClassify::SetDefaultCharClasses(bool includeWordClass) noexcept {
void CharClassify::SetDefaultCharClasses(bool includeWordClass) {
// Initialize all char classes to default values
for (int ch = 0; ch < maxChar; ch++) {
if (ch == '\r' || ch == '\n')
@ -33,7 +33,7 @@ void CharClassify::SetDefaultCharClasses(bool includeWordClass) noexcept {
}
}
void CharClassify::SetCharClasses(const unsigned char *chars, CharacterClass newCharClass) noexcept {
void CharClassify::SetCharClasses(const unsigned char *chars, CharacterClass newCharClass) {
// Apply the newCharClass to the specified chars
if (chars) {
while (*chars) {

View File

@ -14,10 +14,10 @@ enum class CharacterClass : unsigned char { space, newLine, word, punctuation };
class CharClassify {
public:
CharClassify() noexcept;
CharClassify();
void SetDefaultCharClasses(bool includeWordClass) noexcept;
void SetCharClasses(const unsigned char *chars, CharacterClass newCharClass) noexcept;
void SetDefaultCharClasses(bool includeWordClass);
void SetCharClasses(const unsigned char *chars, CharacterClass newCharClass);
int GetCharsOfClass(CharacterClass characterClass, unsigned char *buffer) const noexcept;
CharacterClass GetClass(unsigned char ch) const noexcept { return charClass[ch];}
bool IsWord(unsigned char ch) const noexcept { return charClass[ch] == CharacterClass::word;}

View File

@ -201,7 +201,7 @@ int SCI_METHOD Document::AddRef() noexcept {
// Decrease reference count and return its previous value.
// Delete the document if reference count reaches zero.
int SCI_METHOD Document::Release() noexcept{
int SCI_METHOD Document::Release() {
const int curRefCount = --refCount;
if (curRefCount == 0)
delete this;
@ -506,7 +506,7 @@ int Document::MarkerHandleFromLine(Sci::Line line, int which) const noexcept {
return Markers()->HandleFromLine(line, which);
}
Sci_Position SCI_METHOD Document::LineStart(Sci_Position line) const noexcept {
Sci_Position SCI_METHOD Document::LineStart(Sci_Position line) const {
return cb.LineStart(line);
}
@ -526,17 +526,13 @@ int SCI_METHOD Document::DEVersion() const noexcept {
return deRelease0;
}
void SCI_METHOD Document::SetErrorStatus(int status) noexcept {
void SCI_METHOD Document::SetErrorStatus(int status) {
// Tell the watchers an error has occurred.
for (const WatcherWithUserData &watcher : watchers) {
watcher.watcher->NotifyErrorOccurred(this, watcher.userData, static_cast<Status>(status));
}
}
Sci_Position SCI_METHOD Document::LineFromPosition(Sci_Position pos) const noexcept {
return cb.LineFromPosition(pos);
}
void Document::CheckPosition(Sci::Position pos) const {
PLATFORM_ASSERT((pos >= 0) && (pos <= LengthNoExcept()));
if ((pos < 0) || (pos > LengthNoExcept())) {
@ -544,6 +540,10 @@ void Document::CheckPosition(Sci::Position pos) const {
}
}
Sci_Position SCI_METHOD Document::LineFromPosition(Sci_Position pos) const {
return cb.LineFromPosition(pos);
}
Sci::Line Document::SciLineFromPosition(Sci::Position pos) const noexcept {
// Avoids casting in callers for this very common function
return cb.LineFromPosition(pos);
@ -612,7 +612,7 @@ int SCI_METHOD Document::SetLevel(Sci_Position line, int level) {
return prev;
}
int SCI_METHOD Document::GetLevel(Sci_Position line) const noexcept {
int SCI_METHOD Document::GetLevel(Sci_Position line) const {
return Levels()->GetLevel(line);
}
@ -1025,7 +1025,7 @@ CharacterExtracted Document::CharacterBefore(Sci::Position position) const noexc
}
// Return -1 on out-of-bounds
Sci_Position SCI_METHOD Document::GetRelativePosition(Sci_Position positionStart, Sci_Position characterOffset) const noexcept {
Sci_Position SCI_METHOD Document::GetRelativePosition(Sci_Position positionStart, Sci_Position characterOffset) const {
Sci::Position pos = positionStart;
if (dbcsCodePage) {
const int increment = (characterOffset > 0) ? 1 : -1;
@ -1065,7 +1065,7 @@ Sci::Position Document::GetRelativePositionUTF16(Sci::Position positionStart, Sc
return pos;
}
int SCI_METHOD Document::GetCharacterAndWidth(Sci_Position position, Sci_Position *pWidth) const noexcept {
int SCI_METHOD Document::GetCharacterAndWidth(Sci_Position position, Sci_Position *pWidth) const {
int bytesInCharacter = 1;
const unsigned char leadByte = cb.UCharAt(position);
int character = leadByte;
@ -1099,11 +1099,11 @@ int SCI_METHOD Document::GetCharacterAndWidth(Sci_Position position, Sci_Positio
return character;
}
int SCI_METHOD Document::CodePage() const noexcept {
int SCI_METHOD Document::CodePage() const {
return dbcsCodePage;
}
bool SCI_METHOD Document::IsDBCSLeadByte(char ch) const noexcept {
bool SCI_METHOD Document::IsDBCSLeadByte(char ch) const {
// Used by lexers so must match IDocument method exactly
return IsDBCSLeadByteNoExcept(ch);
}
@ -1573,7 +1573,7 @@ IDocumentEditable *Document::AsDocumentEditable() noexcept {
return static_cast<IDocumentEditable *>(this);
}
void * SCI_METHOD Document::ConvertToDocument() noexcept {
void *SCI_METHOD Document::ConvertToDocument() {
return AsDocumentEditable();
}
@ -2581,7 +2581,7 @@ int Document::CharacterCategoryOptimization() const noexcept {
return charMap.Size();
}
void SCI_METHOD Document::StartStyling(Sci_Position position) noexcept {
void SCI_METHOD Document::StartStyling(Sci_Position position) {
endStyled = position;
}
@ -2684,7 +2684,7 @@ int SCI_METHOD Document::SetLineState(Sci_Position line, int state) {
return statePrevious;
}
int SCI_METHOD Document::GetLineState(Sci_Position line) const noexcept {
int SCI_METHOD Document::GetLineState(Sci_Position line) const {
return States()->GetLineState(line);
}
@ -2818,7 +2818,7 @@ void Document::IncrementStyleClock() noexcept {
styleClock = (styleClock + 1) % 0x100000;
}
void SCI_METHOD Document::DecorationSetCurrentIndicator(int indicator) noexcept {
void SCI_METHOD Document::DecorationSetCurrentIndicator(int indicator) {
decorations->SetCurrentIndicator(indicator);
}

View File

@ -360,7 +360,7 @@ public:
~Document() override;
int SCI_METHOD AddRef() noexcept override;
int SCI_METHOD Release() noexcept override;
int SCI_METHOD Release() override;
// From PerLine
void Init() override;
@ -374,15 +374,15 @@ public:
bool SetLineEndTypesAllowed(Scintilla::LineEndType lineEndBitSet_);
Scintilla::LineEndType GetLineEndTypesActive() const noexcept { return cb.GetLineEndTypes(); }
int SCI_METHOD Version() const noexcept override {
int SCI_METHOD Version() const override {
return Scintilla::dvRelease4;
}
int SCI_METHOD DEVersion() const noexcept override;
void SCI_METHOD SetErrorStatus(int status) noexcept override;
void SCI_METHOD SetErrorStatus(int status) override;
void CheckPosition(Sci::Position pos) const;
Sci_Position SCI_METHOD LineFromPosition(Sci_Position pos) const noexcept override;
Sci_Position SCI_METHOD LineFromPosition(Sci_Position pos) const 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); }
@ -394,11 +394,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 noexcept override;
Sci_Position SCI_METHOD GetRelativePosition(Sci_Position positionStart, Sci_Position characterOffset) const override;
Sci::Position GetRelativePositionUTF16(Sci::Position positionStart, Sci::Position characterOffset) const noexcept;
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;
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;
bool IsDBCSLeadByteNoExcept(char ch) const noexcept;
bool IsDBCSTrailByteNoExcept(char ch) const noexcept;
unsigned char DBCSMinTrailByte() const noexcept;
@ -417,7 +417,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() noexcept override;
void *SCI_METHOD ConvertToDocument() override;
Sci::Position Undo();
Sci::Position Redo();
bool CanUndo() const noexcept { return cb.CanUndo(); }
@ -486,7 +486,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 noexcept override {
void SCI_METHOD GetCharRange(char *buffer, Sci_Position position, Sci_Position lengthRetrieve) const override {
cb.GetCharRange(buffer, position, lengthRetrieve);
}
char SCI_METHOD StyleAt(Sci_Position position) const override { return cb.StyleAt(position); }
@ -505,7 +505,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 noexcept override;
Sci_Position SCI_METHOD LineStart(Sci_Position line) const 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;
@ -519,7 +519,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 noexcept override;
int SCI_METHOD GetLevel(Sci_Position line) const 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);
@ -529,7 +529,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 noexcept override { return cb.Length(); }
Sci_Position SCI_METHOD Length() const override { return cb.Length(); }
Sci::Position LengthNoExcept() const noexcept { return cb.Length(); }
void Allocate(Sci::Position newSize) { cb.Allocate(newSize); }
@ -555,7 +555,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) noexcept override;
void SCI_METHOD StartStyling(Sci_Position position) 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; }
@ -563,7 +563,7 @@ public:
void StyleToAdjustingLineDuration(Sci::Position pos);
int GetStyleClock() const noexcept { return styleClock; }
void IncrementStyleClock() noexcept;
void SCI_METHOD DecorationSetCurrentIndicator(int indicator) noexcept override;
void SCI_METHOD DecorationSetCurrentIndicator(int indicator) 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;
@ -573,7 +573,7 @@ public:
void TruncateUndoComments(int action);
int SCI_METHOD SetLineState(Sci_Position line, int state) override;
int SCI_METHOD GetLineState(Sci_Position line) const noexcept override;
int SCI_METHOD GetLineState(Sci_Position line) const override;
Sci::Line GetMaxLineState() const noexcept;
void SCI_METHOD ChangeLexerState(Sci_Position start, Sci_Position end) override;

View File

@ -4566,7 +4566,7 @@ void Editor::DisplayCursor(Window::Cursor c) {
wMain.SetCursor(static_cast<Window::Cursor>(cursorMode));
}
bool Editor::DragThreshold(Point ptStart, Point ptNow) noexcept {
bool Editor::DragThreshold(Point ptStart, Point ptNow) {
const Point ptDiff = ptStart - ptNow;
const XYPOSITION distanceSquared = ptDiff.x * ptDiff.x + ptDiff.y * ptDiff.y;
return distanceSquared > 16.0f;
@ -5500,19 +5500,19 @@ void Editor::QueueIdleWork(WorkItems items, Sci::Position upTo) {
workNeeded.Need(items, upTo);
}
int Editor::SupportsFeature(Supports feature) const noexcept {
int Editor::SupportsFeature(Supports feature) {
AutoSurface surface(this);
return surface->SupportsFeature(feature);
}
bool Editor::PaintContains(PRectangle rc) const noexcept {
bool Editor::PaintContains(PRectangle rc) {
if (rc.Empty()) {
return true;
}
return rcPaint.Contains(rc);
}
bool Editor::PaintContainsMargin() const noexcept {
bool Editor::PaintContainsMargin() {
if (HasMarginWindow()) {
// With separate margin view, paint of text view
// never contains margin.

View File

@ -476,7 +476,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() const noexcept { return ctrlID; }
virtual int GetCtrlID() { return ctrlID; }
virtual void NotifyParent(Scintilla::NotificationData scn) = 0;
virtual void NotifyStyleToNeeded(Sci::Position endStyleNeeded);
void NotifyChar(int ch, Scintilla::CharacterSource charSource);
@ -551,7 +551,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) noexcept;
virtual bool DragThreshold(Point ptStart, Point ptNow);
virtual void StartDrag();
void DropAt(SelectionPosition position, std::string_view value, bool moving, bool rectangular);
[[deprecated]] void DropAt(SelectionPosition position, const char *value, size_t lengthValue, bool moving, bool rectangular);
@ -598,9 +598,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) const noexcept;
virtual bool PaintContains(PRectangle rc) const noexcept;
bool PaintContainsMargin() const noexcept;
virtual int SupportsFeature(Scintilla::Supports feature);
virtual bool PaintContains(PRectangle rc);
bool PaintContainsMargin();
void CheckForChangeOutsidePaint(Range r);
void SetBraceHighlight(Sci::Position pos0, Sci::Position pos1, int matchStyle);

View File

@ -156,24 +156,23 @@ public:
class IScreenLine {
public:
virtual ~IScreenLine() noexcept = default;
virtual std::string_view Text() const noexcept = 0;
virtual size_t Length() const noexcept = 0;
virtual std::string_view Text() const = 0;
virtual size_t Length() const = 0;
virtual size_t RepresentationCount() const = 0;
virtual XYPOSITION Width() const noexcept = 0;
virtual XYPOSITION Height() const noexcept = 0;
virtual XYPOSITION TabWidth() const noexcept = 0;
virtual XYPOSITION TabWidthMinimumPixels() const noexcept = 0;
virtual const Font *FontOfPosition(size_t position) const noexcept = 0;
virtual XYPOSITION RepresentationWidth(size_t position) const noexcept = 0;
virtual XYPOSITION TabPositionAfter(XYPOSITION xPosition) const noexcept = 0;
virtual XYPOSITION Width() const = 0;
virtual XYPOSITION Height() const = 0;
virtual XYPOSITION TabWidth() const = 0;
virtual XYPOSITION TabWidthMinimumPixels() const = 0;
virtual const Font *FontOfPosition(size_t position) const = 0;
virtual XYPOSITION RepresentationWidth(size_t position) const = 0;
virtual XYPOSITION TabPositionAfter(XYPOSITION xPosition) const = 0;
};
class IScreenLineLayout {
public:
virtual ~IScreenLineLayout() noexcept = default;
virtual size_t PositionFromX(XYPOSITION xDistance, bool charPosition) = 0;
virtual XYPOSITION XFromPosition(size_t caretPosition) noexcept = 0;
virtual XYPOSITION XFromPosition(size_t caretPosition) = 0;
virtual std::vector<Interval> FindRangeIntervals(size_t start, size_t end) = 0;
};

View File

@ -388,11 +388,11 @@ ScreenLine::ScreenLine(
ScreenLine::~ScreenLine() = default;
std::string_view ScreenLine::Text() const noexcept {
std::string_view ScreenLine::Text() const {
return std::string_view(&ll->chars[start], len);
}
size_t ScreenLine::Length() const noexcept {
size_t ScreenLine::Length() const {
return len;
}
@ -402,31 +402,31 @@ size_t ScreenLine::RepresentationCount() const {
[](XYPOSITION w) noexcept { return w > 0.0f; });
}
XYPOSITION ScreenLine::Width() const noexcept {
XYPOSITION ScreenLine::Width() const {
return width;
}
XYPOSITION ScreenLine::Height() const noexcept {
XYPOSITION ScreenLine::Height() const {
return height;
}
XYPOSITION ScreenLine::TabWidth() const noexcept {
XYPOSITION ScreenLine::TabWidth() const {
return tabWidth;
}
XYPOSITION ScreenLine::TabWidthMinimumPixels() const noexcept {
XYPOSITION ScreenLine::TabWidthMinimumPixels() const {
return static_cast<XYPOSITION>(tabWidthMinimumPixels);
}
const Font *ScreenLine::FontOfPosition(size_t position) const noexcept {
const Font *ScreenLine::FontOfPosition(size_t position) const {
return ll->bidiData->stylesFonts[start + position].get();
}
XYPOSITION ScreenLine::RepresentationWidth(size_t position) const noexcept {
XYPOSITION ScreenLine::RepresentationWidth(size_t position) const {
return ll->bidiData->widthReprs[start + position];
}
XYPOSITION ScreenLine::TabPositionAfter(XYPOSITION xPosition) const noexcept {
XYPOSITION ScreenLine::TabPositionAfter(XYPOSITION xPosition) const {
return (std::floor((xPosition + TabWidthMinimumPixels()) / TabWidth()) + 1) * TabWidth();
}

View File

@ -124,16 +124,16 @@ struct ScreenLine : public IScreenLine {
void operator=(ScreenLine &&) = delete;
virtual ~ScreenLine();
std::string_view Text() const noexcept override;
size_t Length() const noexcept override;
std::string_view Text() const override;
size_t Length() const override;
size_t RepresentationCount() const override;
XYPOSITION Width() const noexcept override;
XYPOSITION Height() const noexcept override;
XYPOSITION TabWidth() const noexcept override;
XYPOSITION TabWidthMinimumPixels() const noexcept override;
const Font *FontOfPosition(size_t position) const noexcept override;
XYPOSITION RepresentationWidth(size_t position) const noexcept override;
XYPOSITION TabPositionAfter(XYPOSITION xPosition) const noexcept override;
XYPOSITION Width() const override;
XYPOSITION Height() const override;
XYPOSITION TabWidth() const override;
XYPOSITION TabWidthMinimumPixels() const override;
const Font *FontOfPosition(size_t position) const override;
XYPOSITION RepresentationWidth(size_t position) const override;
XYPOSITION TabPositionAfter(XYPOSITION xPosition) const override;
};
struct SignificantLines {

View File

@ -156,12 +156,16 @@ int ScintillaBase::KeyCommand(Message iMessage) {
AutoCompleteMove(-ac.lb->GetVisibleRows());
return 0;
case Message::VCHome:
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
case Message::HomeWrap:
AutoCompleteMove(-10000);
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
return 0;
case Message::LineEnd:
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
case Message::LineEndWrap:
AutoCompleteMove(10000);
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
return 0;
case Message::DeleteBack:
DelCharBack(true);

View File

@ -101,7 +101,7 @@ protected:
void NotifyStyleToNeeded(Sci::Position endStyleNeeded) override;
public:
virtual ~ScintillaBase() override;
~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

@ -787,10 +787,10 @@ void ViewStyle::CreateAndAddFont(const FontSpecification &fs) {
}
}
FontRealised *ViewStyle::Find(const FontSpecification &fs) const {
FontRealised *ViewStyle::Find(const FontSpecification &fs) {
if (!fs.fontName) // Invalid specification so return arbitrary object
return fonts.begin()->second.get();
const auto it = fonts.find(fs);
const FontMap::iterator 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

@ -253,7 +253,7 @@ public:
private:
void AllocStyles(size_t sizeNew);
void CreateAndAddFont(const FontSpecification &fs);
FontRealised *Find(const FontSpecification &fs) const;
FontRealised *Find(const FontSpecification &fs);
void FindMaxAscentDescent() noexcept;
};

View File

@ -20,7 +20,9 @@ using namespace Scintilla;
extern "C"
__declspec(dllexport)
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
sptr_t APIENTRY Scintilla_DirectFunction(
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
Internal::ScintillaWin *sci, UINT iMessage, uptr_t wParam, sptr_t lParam) {
return Internal::DirectFunction(sci, iMessage, wParam, lParam);
}

View File

@ -585,7 +585,7 @@ class ScintillaWin :
enum : UINT_PTR { invalidTimerID, standardTimerID, idleTimerID, fineTimerStart };
void DisplayCursor(Window::Cursor c) override;
bool DragThreshold(Point ptStart, Point ptNow) noexcept override;
bool DragThreshold(Point ptStart, Point ptNow) override;
void StartDrag() override;
static KeyMod MouseModifiers(uptr_t wParam) noexcept;
@ -630,7 +630,7 @@ class ScintillaWin :
void SetTrackMouseLeaveEvent(bool on) noexcept;
void HideCursorIfPreferred() noexcept;
void UpdateBaseElements() override;
bool PaintContains(PRectangle rc) const noexcept override;
bool PaintContains(PRectangle rc) override;
void ScrollText(Sci::Line linesToMove) override;
void NotifyCaretMove() override;
void UpdateSystemCaret() override;
@ -642,7 +642,7 @@ class ScintillaWin :
void NotifyChange() override;
void NotifyFocus(bool focus) override;
void SetCtrlID(int identifier) override;
int GetCtrlID() const noexcept override;
int GetCtrlID() override;
void NotifyParent(NotificationData scn) override;
void NotifyDoubleClick(Point pt, KeyMod modifiers) override;
std::unique_ptr<CaseFolder> CaseFolderForEncoding() override;
@ -1084,7 +1084,7 @@ void ScintillaWin::DisplayCursor(Window::Cursor c) {
}
}
bool ScintillaWin::DragThreshold(Point ptStart, Point ptNow) noexcept {
bool ScintillaWin::DragThreshold(Point ptStart, Point ptNow) {
const Point ptDifference = ptStart - ptNow;
const XYPOSITION xMove = std::trunc(std::abs(ptDifference.x));
const XYPOSITION yMove = std::trunc(std::abs(ptDifference.y));
@ -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);
@ -2455,7 +2474,9 @@ sptr_t ScintillaWin::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) {
InvalidateStyleRedraw();
break;
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
#if(WINVER >= 0x0605)
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
case WM_DPICHANGED_AFTERPARENT: {
const UINT dpiNow = DpiForWindow(wMain.GetID());
if (dpi != dpiNow) {
@ -2465,7 +2486,9 @@ sptr_t ScintillaWin::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) {
}
}
break;
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
#endif
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
#if SCI_EnablePopupMenu
@ -2682,8 +2705,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;
}
@ -2706,7 +2733,7 @@ void ScintillaWin::UpdateBaseElements() {
}
}
bool ScintillaWin::PaintContains(PRectangle rc) const noexcept {
bool ScintillaWin::PaintContains(PRectangle rc) {
if (paintState == PaintState::painting) {
return BoundsContains(rcPaint, hRgnUpdate, rc);
}
@ -2850,7 +2877,7 @@ void ScintillaWin::SetCtrlID(int identifier) {
::SetWindowID(HwndFromWindow(wMain), identifier);
}
int ScintillaWin::GetCtrlID() const noexcept {
int ScintillaWin::GetCtrlID() {
return ::GetDlgCtrlID(HwndFromWindow(wMain));
}

View File

@ -1124,7 +1124,7 @@ public:
ScreenLineLayout &operator=(ScreenLineLayout &&) = delete;
~ScreenLineLayout() noexcept override = default;
size_t PositionFromX(XYPOSITION xDistance, bool charPosition) override;
XYPOSITION XFromPosition(size_t caretPosition) noexcept override;
XYPOSITION XFromPosition(size_t caretPosition) override;
std::vector<Interval> FindRangeIntervals(size_t start, size_t end) override;
};
@ -1304,7 +1304,7 @@ size_t ScreenLineLayout::PositionFromX(XYPOSITION xDistance, bool charPosition)
// Finds the point of the caret position
XYPOSITION ScreenLineLayout::XFromPosition(size_t caretPosition) noexcept {
XYPOSITION ScreenLineLayout::XFromPosition(size_t caretPosition) {
if (!textLayout) {
return 0.0;
}