Related to [bugs:#2063] caret is thin after window DPI increased, though application can handle this in WM_DPICHANGED, it maybe better to auto scale the width within Scintilla.
Here is my though by adding a new field effectiveCaretWidth.
// ScintillaWin
vs.effectiveCaretWidth = ::MulDiv(vs.caretWidth, dpi, USER_DEFAULT_SCREEN_DPI);
// ScintillaWin::CreateSystemCaret()
sysCaretWidth = vs.effectiveCaretWidth;
// EditView::DrawCarets()
rcCaret.right = rcCaret.left + vsDraw.effectiveCaretWidth;
// other code to sync vs.caretWidth and vs.effectiveCaretWidth.
Diff:
Since the caret is commonly a single pixel wide, scaling up to 2 pixels is a huge jump. Scaling the caret width automatically stops users and applications being able to choose whether to scale the caret and the points at which scaling occurs. The change magnifies the caret at 150% scaling which is not the point that I, and I suspect many others, would make the change. There is no way to specify a single pixel wide caret.
I also found this will complicate both application and Scintilla, especially when application set caret width to 2 or 3.
How about increase the caret width limitation for SCI_SETCARETWIDTH, Windows accessibility allows 20 pixels caret width.
If application scaling caret width them self, it will behaviors as expected.
Last edit: Zufu Liu 2020-06-09
Is that for an actual caret or is that for something more like a rectangular cursor? Where is this documented?
It seems not documented, however can be set in Settings, see Know where you're pointing on
https://support.microsoft.com/en-us/help/27928/windows-10-make-windows-easier-to-see
also SPI_GETCARETWIDTH
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-systemparametersinfoa
Last edit: Zufu Liu 2020-06-10
Since the caret is symmetric, making it wider makes it go more negative when at the start of the line. There may have been a problem here in the past, possibly with some buggy clipping.
The current maximum can be increased but there could be bugs.
I find one bug: text under wider caret is not draw with inverted color.
Carets do not invert text in Scintilla.
screenshot is 10 px caret in Windows Notepad with purple text cursor indicator, 'W' is draw as two parts.
patch is use ReleaseUnknown() in Platform_Finalise().
Horribly ugly.
Committed with [986abc] .
Related
Commit: [986abc]
I don't find other bugs after increasing the upper limit for caret width to 20 (no change to caret drawing code, i.e. still treat as line caret like Visual Studio 2017/2019, however Visual Studio 2017/1029 supports text cursor indicator. I don't find the document on how to implement this, maybe some UI Automation control patterns need be implemented).
Committed [9f3c5a] to allow 20 pixel wide carets.
Related
Commit: [9f3c5a]