As a follow-up on our discussion of feature request 1450, I've updated merge request 35 to support horizontal scrolling by holding down the shift key while using the vertical mouse wheel.
Following is the code that I currently use, horizontal scrolling does nothing when word wrap is enabled or user disabled that in system settings.
voidScintillaWin::GetIntelliMouseParameters()noexcept{// This retrieves the number of lines per scroll as configured in the Mouse Properties sheet in Control Panel::SystemParametersInfo(SPI_GETWHEELSCROLLLINES,0,&linesPerScroll,0);::SystemParametersInfo(SPI_GETWHEELSCROLLCHARS,0,&charsPerScroll,0);}
// https://github.com/zufuliu/notepad2/blob/main/scintilla/win32/ScintillaWin.cxx#L1737if(wParam&MK_SHIFT){if(vs.wrap.state!=Wrap::None||charsPerScroll==0){return::DefWindowProc(MainHWND(),iMessage,wParam,lParam);}}// Either SCROLL or ZOOM. We handle the wheel steppings calculationwheelDelta-=GET_WHEEL_DELTA_WPARAM(wParam);if(std::abs(wheelDelta)<WHEEL_DELTA){return0;}if(wParam&MK_SHIFT){intcharsToScroll=charsPerScroll;if(charsPerScroll==WHEEL_PAGESCROLL){constPRectanglercText=GetTextRectangle();constintpageWidth=static_cast<int>(rcText.Width()*2/3);charsToScroll=pageWidth;}else{charsToScroll=1+static_cast<int>(std::max(charsToScroll,1)*vs.aveCharWidth);}charsToScroll*=(wheelDelta/WHEEL_DELTA);if(wheelDelta>=0){wheelDelta=wheelDelta%WHEEL_DELTA;}else{wheelDelta=-(-wheelDelta%WHEEL_DELTA);}HorizontalScrollTo(xOffset+charsToScroll);}elseif(linesPerScroll>0){}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
My feature request here is about triggering horizontal scrolling in a different manner.
Respecting user defined system settings certainly enhances usability and hence the user experience. I suppose Neil welcomes a patch from your side in this regard.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There is duplicated code for extracting the whole portion and remainder from wheelDelta. The unusual modulo code in particular could be hoisted out.
To be picky, there should be a second wheelDelta for WM_MOUSEHWHEEL (but not MK_SHIFT + WM_MOUSEWHEEL) to accumulate partial movements from the two sensors independently. However, I have never seen a high resolution mouse wheel and they may not exist. https://devblogs.microsoft.com/oldnewthing/20130123-00/?p=5473
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Neil, if you approve of my updated merge request 35, could that be committed please?
Zufu Liu's remark is basically hijacking this thread, having the discussion no longer match the subject while it deserves its own feature request: "Mouse wheel action respects user system settings on Windows".
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The patches above from Zufu Liu do implement the subject of this feature request although they also change some other things. The other changes appear to have some merit and it would be better to not commit some code then rewrite it again soon after.
Scrolling horizontally by 120 pixels per wheel click seems excessive with other applications scrolling much less: VS Code seems to be around 40 pixels.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Following is the code that I currently use, horizontal scrolling does nothing when word wrap is enabled or user disabled that in system settings.
My feature request here is about triggering horizontal scrolling in a different manner.
Respecting user defined system settings certainly enhances usability and hence the user experience. I suppose Neil welcomes a patch from your side in this regard.
There is no page option for horizontal movement:
Patch removed copy & pasted WHEEL_PAGESCROLL handling.
There is duplicated code for extracting the whole portion and remainder from
wheelDelta
. The unusual modulo code in particular could be hoisted out.To be picky, there should be a second
wheelDelta
forWM_MOUSEHWHEEL
(but notMK_SHIFT + WM_MOUSEWHEEL
) to accumulate partial movements from the two sensors independently. However, I have never seen a high resolution mouse wheel and they may not exist.https://devblogs.microsoft.com/oldnewthing/20130123-00/?p=5473
Neil, if you approve of my updated merge request 35, could that be committed please?
Zufu Liu's remark is basically hijacking this thread, having the discussion no longer match the subject while it deserves its own feature request: "Mouse wheel action respects user system settings on Windows".
The patches above from Zufu Liu do implement the subject of this feature request although they also change some other things. The other changes appear to have some merit and it would be better to not commit some code then rewrite it again soon after.
Scrolling horizontally by 120 pixels per wheel click seems excessive with other applications scrolling much less: VS Code seems to be around 40 pixels.
OK, I can put my patch into [feature-requests:#749].
Related
Feature Requests:
#749Same as [feature-requests:#749] which was resolved with [1295fc] which also depends on [4927ac] and [b0f78a].
Related
Feature Requests:
#749Commit: [1295fc]
Commit: [4927ac]
Commit: [b0f78a]