I'm making an intensive use of Florian Balmer's Scintilla based Notepad2 editor and I miss a feature which is available in many design-like [free] software (like Freemind, Gimp, Inkscape, ...) :
the ability to horizontal scroll with the combination of the Shift key and the mouse wheel (when 'Word wrap' is not enabled).
This is not normal behaviour for text editors so will not be expected by users.
Diff:
As discussed in [feature-requests:#1451], first patch to encapsulate
wheelDelta(may need better method names or merge the last two methods into one).Related
Feature Requests:
#1451The modulus code comes from [94b1dc] and doesn't appear to be needed as C
%is really remainder soDisposecan be:Which is simple enough to move back to inline.
The change was motivated by an email that pointed to the then current C++ standard where "If both operands are nonnegative then the remainder is nonnegative; if not, the sign of the remainder is implementation-defined." but that was fixed in 2008 with
https://open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3027.html (search for "expr.mul").
Related
Commit: [94b1dc]
Updated
Dispose().After thinking about this some more, I think the right thing to do is to remove support for high resolution mouse wheels: they just don't exist and its been over 20 years. If such things are developed, we can easily restore the code that supported them. The advantage of removing this feature is that it simplifies the code and makes it OK to handle
WM_MOUSEHWHEELandMK_SHIFT + WM_MOUSEWHEELuniformly.The
wheelDeltainstance variable move to a local insideMouseMessage:The modulus code is removed.
Yes, this would simplify the code, per the document for WM_MOUSEWHEEL and WM_MOUSEHWHEEL:
so current code with WHEEL_DELTA as the threshold to take action accumulated nothing.
Edit: I'm wrong on
divisions of WHEEL_DELTA.Last edit: Zufu Liu 2022-09-24
Full changes with
wheelDeltamoved local, indentation for original code not changed to make the diff smaller.Add back
std::abs(wheelDelta) >= WHEEL_DELTA.Mentioned on the mailing list to try and find if there are any high-resolution mouse wheels.
https://groups.google.com/g/scintilla-interest/c/4khpih1uHRk/m/um4hs_mkBgAJ
It seems it exists, search "high-resolution mouse wheel" find a bug report at https://github.com/fork-dev/TrackerWin/issues/974
Full changes with two wheel delta.
Improve accuracy for horizontal widthToScroll.
That allows horizontally scrolling past the maximum. It should probably stop at the
pageWidthcalculated inScintillaWin::ModifyScrollBars. The best place for this check is an issue: placing it inEditor::HorizontalScrollTomay stop overscroll-and-bounce-back which is a feature on some platforms.Something like following?
Sorry, got it wrong: its
horizEndPreferredthat is the maximum horizontal scrollbar value.Changed into
case Message::LineScrollinEditor::WndProc()may needs small changes:Just tested, limiting
widthToScrollseems not required, no behavior difference with/without the clamp.Windows scroll bars don't allow
SCROLLINFO::nPosto go toSCROLLINFO::nMaxbut take the size of the page or thumb asSCROLLINFO::nMax - SCROLLINFO::nPage. With this rough code, the horizontal wheel scroll goes to the same position as moving the thumb.To test, enable short adaptive scroll width in SciTE with.
OK, see the difference.
Maybe it's better to have a method that returns max horizontal scroll position.
There is similar code needed for
ModifyScrollBarswhich wants both the page and document width so proving a common method that returns both:Committed with [1295fc] which also depends on [4927ac] and [b0f78a].
Related
Commit: [1295fc]
Commit: [4927ac]
Commit: [b0f78a]