Scrolling
-
I don’t understand what this means. :-(
-
example:
(I had never heard of such a thing, and had guessed it wasn’t possible; so I was surprised that @Michael-Vincent readily knew how to do it.)
-
Thanks Peter. I understand it now. It is rather hard to put into words what it does, it seems. I could see it as a device to keep the (vertical) caret in the middle of the “viewport”, presuming that one always uses the same vertical size viewport and an appropriate setting for this parameter (i.e., half the viewport size).
-
Yeah, the scintilla doc that @Michael-Vincent mentioned says,
By keeping the caret away from the edges, it is seen within its context. This makes it likely that the identifier that the caret is on can be completely seen, and that the current line is seen with some of the lines following it, which are often dependent on that line.
That seems a reasonable justification for enabling that feature. I’m not likely to switch to using it… but I can at least see why some people would find it useful.
-
@PeterJones
That’s exactly why I use it with just 5. Enough lines to get some context.Cheers.
-
Hi, @nbonniere, @michael-vincent, @alan-kilborn, @peterjones and All,
From your posts, I just decided to investigate about these notions, especially the different kinds of vertical scrolling
Y
, allowed in N++ ;-))
I first tried to assimilate the
SCI_SETYCARETPOLICY
Scintilla message from :https://www.scintilla.org/ScintillaDoc.html#SCI_SETYCARETPOLICY
Unfortunately, the columns of the table are wrongly displayed. Indeed, from the file
...\scintilla\include\Scintilla.h
, we learn that the values of the4
flags are :... #define CARET_SLOP 0x01 #define CARET_STRICT 0x04 #define CARET_JUMPS 0x10 #define CARET_EVEN 0x08 ...
So, to my mind, in order to get the correct value of caretYPolicy, which is a combination of CARET_SLOP, CARET_STRICT, CARET_JUMPS and CARET_EVEN flags, the right order, by decreasing weights, should be :
CARET_JUMPS (
16
) - CARET_EVEN (8
) - CARET_STRICT (4
) - CARET_SLOP (1
)Now, from the file
...\scintilla\src\Editor.cxx
... caretXPolicy = CARET_SLOP | CARET_EVEN; caretXSlop = 50; caretYPolicy = CARET_EVEN; caretYSlop = 0; visiblePolicy = 0; visibleSlop = 0; ...
We can deduce that the default N++ caretYPolicy is CARET_EVEN, with a
NULL
caretSlop valueOn the other hand, in the
...\scintilla\include\Scintilla.h
file, we have the line :... #define SCI_SETYCARETPOLICY 2403 ...
Now, everything is clear ;-)) To study the N++ caretYPolicy we just need to :
-
Use, for instance, the
NppExec
plugin -
Execute the command
SCI_SENDMSG SCI_SETYCARETPOLICY caretYPolicy caretYSlop
( orSCI_SENDMSG 2403 caretYPolicy caretYSlop
), where :-
caretYPolicy is a combination of the
4
flags, with value between0
and29
-
caretYSlop represents the number of lines of the unwanted zone
UZ
where the caret is… unwanted !
-
Remarks :
-
From above, to restore the default N++ caretPolicy, simply use the command
SCI_SENDMSG SCI_SETYCARETPOLICY 8 0
-
When the CARET_SLOP flag is not set (
0
), obviously, the caretYSlop value can be any -
When the CARET_SLOP flag is set (
Y
), I chose the caretYSlop value of5
lines, during the test phase -
In order to easily test the different possibilities :
-
Notepad++ must have a single row of tabs
-
Use the
Courier New
font, with size10
(Settings > Style Configurator... > Global Styles > Default Style > Font Style
) -
Use the default zoom (
Ctrl + /
) -
Disable the Word wrap feature (
View > Word wrap
) -
Create a
Test.txt
file containing, at least,300
lines, from Line 001 to Line 300
-
Notes :
- With some caretYPolicy tested, it may be difficult to get the caret on the first / last visible line ! If so, use, first, the mouse wheel or the vertical scroll bar to move the line, containing the caret, at the very beginning / end of the text window, before pressing the Up / Down keys or clicking on the left mouse button to see the effects of the current policy :-))
Here are, below, in two tables, the different results of my searches. Unfortunately, due to the
16,384
bytes maximum post size, each table is posted, separately !Best Regards,
guy038
-
-
Hi, All,
Here is the first table, relative to the caretYPolicy, when caretYSlop value is not used :
===================================================================== ║ JUMPS | EVEN | STRICT | SLOP ║ caretYPolicy ║ caretYSlop ║ ║---------•---------•---------•---------║ ║ ║ ║ 16 | 8 | 4 | 1 ║ Total ║ UZ Width ║ ==========•=========•=========•=========•==============•============•============================================================================================================== ║ | | | ║ ║ ║ By pressing the DOWN key, with the CARET on the LAST VISIBLE line N, ║ ║ | | | ║ ║ ║ this line N becomes the new FIRST VISIBLE line, with the CARET inside ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ By pressing the UP key, with the CARET on the FIRST VISIBLE line N, the ║ ║ 0 | 0 | 0 | 0 ║ 0 ║ - ║ PREVIOUS line N-1 becomes the new FIRST VISIBLE line, with the CARET inside ( DEFAULT behavior ) ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ By a SINGLE LEFT mouse CLICK, on the LAST VISIBLE line N, this ║ ║ | | | ║ ║ ║ line becomes the new FIRST VISIBLE line, with the CARET inside ║ ║ | | | ║ ║ ║ ║ ║ 1 | 0 | 0 | 0 ║ 16 ║ - ║ If a SINGLE LEFT mouse CLICK, on the FIRST VISIBLE line N, NO action occurs ( DEFAULT behavior ) ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ When pressing REPEATEDLY on the DOWN or UP keys, the CARET lies ║ ║ | | | ║ ║ ║ between the TOP of the window and the PENULTIMATE VISIBLE line ║ ║---------•---------•---------•---------•--------------•------------•-------------------------------------------------------------------------------------------------------------║ ║ | | | ║ ║ ║ By pressing the DOWN key, with the CARET on the LAST VISIBLE line N, the NEXT ║ ║ | | | ║ ║ ║ line N+1 becomes the new PENULTIMATE VISIBLE line, with the CARET inside ( DEFAULT behavior ) ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ By pressing the UP key, with the CARET on the FIRST VISIBLE line N, the ║ ║ | | | ║ ║ ║ PREVIOUS line N-1 becomes the new FIRST VISIBLE line, with the CARET inside ( DEFAULT behavior ) ║ ║ | | | ║ ║ ║ ║ ║ 0 | 1 | 0 | 0 ║ 8 ║ - ║ By a SINGLE LEFT mouse CLICK, on the LAST VISIBLE line N, this line ║ ║ | | | ║ ║ ║ becomes the new PENULTIMATE VISIBLE line N-1, with the CARET inside ( DEFAULT behavior ) ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ If a SINGLE LEFT mouse CLICK, on the FIRST VISIBLE line N, NO action occurs ( DEFAULT behavior ) ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ When pressing REPEATEDLY on the DOWN or UP keys, the CARET lies ║ ║ | | | ║ ║ ║ between the TOP of the window and the PENULTIMATE VISIBLE line ║ ║---------•---------•---------•---------•--------------•------------•-------------------------------------------------------------------------------------------------------------║ ║ | | | ║ ║ ║ By pressing the DOWN key, with the CARET on the LAST VISIBLE line N, the NEXT ║ ║ | | | ║ ║ ║ line N+1 becomes the new MIDDLE line of the window, with the CARET inside ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ By pressing the UP key, with the CARET on the FIRST VISIBLE line N, the ║ ║ | | | ║ ║ ║ PREVIOUS line N-1 becomes the new MIDDLE line of the window, with the CARET inside ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ By a SINGLE LEFT mouse CLICK, on the LAST VISIBLE line N, this line ║ ║ 1 | 1 | 0 | 0 ║ 24 ║ - ║ becomes the new MIDDLE line of the window, with the CARET inside ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ If a SINGLE LEFT mouse CLICK, on the FIRST VISIBLE line N, NO action occurs ( DEFAULT behavior ) ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ When pressing REPEATEDLY on the UP key, the CARET lies between the TOP and the MIDDLE of the window ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ When pressing REPEATEDLY on the DOWN key, the CARET lies between the MIDDLE and the END of the window ║ ║---------•---------•---------•---------•--------------•------------•-------------------------------------------------------------------------------------------------------------║ ║ | | | ║ ║ ║ By pressing the DOWN key, with the CARET on the LAST VISIBLE line N, ║ ║ | | | ║ ║ ║ the NEXT line N+1 becomes the new FIRST VISIBLE line, with the CARET inside ║ ║ | | | ║ ║ ║ ║ ║ 0 | 0 | 1 | 0 ║ 4 ║ - ║ By pressing the UP key, with the CARET on the FIRST VISIBLE line N, the ║ ║ | | | ║ ║ ║ PREVIOUS line N-1 becomes the new FIRST VISIBLE line, with the CARET inside ( DEFAULT behavior ) ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ By a SINGLE LEFT mouse CLICK, on ANY VISIBLE line Y, this line Y ║ ║ 1 | 0 | 1 | 0 ║ 20 ║ - ║ becomes the new FIRST VISIBLE line, with the CARET inside ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ When pressing REPEATEDLY on the DOWN or UP keys, the CARET remains on the FISRT VISIBLE line ║ ║---------•---------•---------•---------•--------------•------------•-------------------------------------------------------------------------------------------------------------║ ║ | | | ║ ║ ║ By pressing the DOWN key, with the CARET on the LAST VISIBLE line N, ║ ║ | | | ║ ║ ║ the NEXT line N+1 becomes the new MIDDLE line, with the CARET inside ║ ║ | | | ║ ║ ║ ║ ║ 0 | 1 | 1 | 0 ║ 12 ║ - ║ By pressing the UP key, with the CARET on the FIRST VISIBLE line N, ║ ║ | | | ║ ║ ║ the PREVIOUS line N-1 becomes the new MIDDLE line, with the CARET inside ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ By a SINGLE LEFT mouse CLICK, on ANY VISIBLE line N, this ║ ║ 1 | 1 | 1 | 0 ║ 28 ║ - ║ line N becomes the new MIDDLE line, with the CARET inside ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ When pressing REPEATEDLY on the DOWN or UP keys, the CARET remains on the MIDDLE line ║ ===================================================================================================================================================================================
Cheers,
guy038
-
Hi, All,
Again, I need to split this second table, relative to the caretYPolicy when caretYSlop value
Y
is used, in two parts :-(===================================================================== ║ JUMPS | EVEN | STRICT | SLOP ║ caretYPolicy ║ caretYSlop ║ ║---------•---------•---------•---------║ ║ ║ ║ 16 | 8 | 4 | 1 ║ Total ║ UZ Width ║ ║=========•=========•=========•=========•==============•============•============================================================================================================== ║ | | | ║ ║ ║ By pressing the DOWN key, with the CARET on the LAST VISIBLE line N, the NEXT ║ ║ | | | ║ ║ ║ line N+1 becomes the Y+1_th VISIBLE line, from the TOP, with the CARET inside ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ By pressing the UP key, with the CARET on the FIRST VISIBLE line N, the PREVIOUS ║ ║ | | | ║ ║ ║ line N-1 becomes the Y+1_th VISIBLE line, from the TOP, with the CARET inside ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ By a SINGLE LEFT mouse CLICK, on the LAST VISIBLE line N, this line ║ ║ 0 | 0 | 0 | 1 ║ 1 ║ Y ║ becomes the Y+1_th VISIBLE line, from the TOP, with the CARET inside ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ If a SINGLE LEFT mouse CLICK, on the FIRST VISIBLE line N, NO action occurs ( DEFAULT behavior ) ║ ║ | | | ║ ║ ║ ║ ║ ║ | | | ║ ║ ║ When pressing REPEATEDLY on the UP key, the CARET lies between the TOP and the Y+1_th line from the TOP ║ ║ | | | ║ ║ ║ ║ ║ ║ | | | ║ ║ ║ When pressing REPEATEDLY on the DOWN key, the CARET lies between the Y+1_th line from the TOP and the END ║ ║---------•---------•---------•---------•--------------•------------•-------------------------------------------------------------------------------------------------------------║ ║ | | | ║ ║ ║ By pressing the DOWN key, with the CARET on the LAST VISIBLE line N, the NEXT ║ ║ | | | ║ ║ ║ line N+1 becomes the 3Y+1_th VISIBLE line, from the TOP, with the CARET inside ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ By pressing the UP key, with the CARET on the FIRST VISIBLE line N, the PREVIOUS ║ ║ | | | ║ ║ ║ line N-1 becomes the 3Y+1_th VISIBLE line, from the TOP, with the CARET inside ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ By a SINGLE LEFT mouse CLICK, on the LAST VISIBLE line N, this line ║ ║ 1 | 0 | 0 | 1 ║ 17 ║ Y ║ becomes the 3Y+1_th VISIBLE line, from the TOP, with the CARET inside ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ If a SINGLE LEFT mouse CLICK, on the FIRST VISIBLE line N, NO action occurs ( DEFAULT behavior ) ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ When pressing REPEATEDLY on the UP key, the CARET lies between the TOP and the 3Y+1_th line from the TOP ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ When pressing REPEATEDLY on the DOWN key, the CARET lies between the 3Y+1_th line from the TOP and the END ║ ║---------•---------•---------•---------•--------------•------------•-------------------------------------------------------------------------------------------------------------║ ║ | | | ║ ║ ║ By pressing the DOWN key, with the CARET on the LAST VISIBLE line N, the NEXT ║ ║ | | | ║ ║ ║ line N+1 becomes the Y+2_th VISIBLE line, from the END, with the CARET inside ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ By pressing the UP key, with the CARET on the FIRST VISIBLE line N, the PREVIOUS ║ ║ | | | ║ ║ ║ line N-1 becomes the Y+1_th VISIBLE line, from the TOP, with the CARET inside ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ By a SINGLE LEFT mouse CLICK, on the LAST VISIBLE line N, the NEXT line N+1 ║ ║ 0 | 1 | 0 | 1 ║ 9 ║ Y ║ becomes the Y+1_th VISIBLE line, from the END, with the CARET inside the OLD line N ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ If a SINGLE LEFT mouse CLICK, on the FIRST VISIBLE line N, NO action occurs ( DEFAULT behavior ) ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ When pressing REPEATEDLY on the UP key, the CARET lies between the TOP and the Y+1_th line from the TOP ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ When pressing REPEATEDLY on the DOWN key, the CARET lies between the Y+2_th line from the END and the END ║ ║---------•---------•---------•---------•--------------•------------•-------------------------------------------------------------------------------------------------------------║ ║ | | | ║ ║ ║ By pressing the DOWN key, with the CARET on the LAST VISIBLE line N, the NEXT ║ ║ | | | ║ ║ ║ line N+1 becomes the 3Y+2_th VISIBLE line, from the END, with the CARET inside ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ By pressing the UP key, with the CARET on the FIRST VISIBLE line N, the PREVIOUS ║ ║ | | | ║ ║ ║ line N-1 becomes the 3Y+1_th VISIBLE line, from the TOP, with the CARET inside ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ By a SINGLE LEFT mouse CLICK, on the LAST VISIBLE line N, the NEXT line N+1 ║ ║ 1 | 1 | 0 | 1 ║ 25 ║ Y ║ becomes the 3Y+1_th VISIBLE line, from the END, with the CARET inside the OLD line N ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ If a SINGLE LEFT mouse CLICK, on the FIRST VISIBLE line N, NO action occurs ( DEFAULT behavior ) ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ When pressing REPEATEDLY on the UP key, the CARET lies between the TOP and the 3Y+1_th line from the TOP ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ When pressing REPEATEDLY on the DOWN key, the CARET lies between the 3Y+2_th line from the END and the END ║ ===================================================================================================================================================================================
Cheers,
Guy
-
Hi, All,
And here is the last part, relative to the caretYPolicy, when caretYSlop value
Y
is used :===================================================================== ║ JUMPS | EVEN | STRICT | SLOP ║ caretYPolicy ║ caretYSlop ║ ║---------•---------•---------•---------║ ║ ║ ║ 16 | 8 | 4 | 1 ║ Total ║ UZ Width ║ ==========•=========•=========•=========•==============•============•============================================================================================================== ║ | | | ║ ║ ║ By pressing the DOWN key, with the CARET on the LAST VISIBLE line N, the NEXT ║ ║ | | | ║ ║ ║ line N+1 becomes the Y+1_th VISIBLE line, from the TOP, with the CARET inside ║ ║ | | | ║ ║ ║ ║ ║ 0 | 0 | 1 | 1 ║ 5 ║ Y ║ By pressing the UP key, with the CARET on the FIRST VISIBLE line N, the PREVIOUS ║ ║ | | | ║ ║ ║ line N-1 becomes the Y+1_th VISIBLE line, from the TOP, with the CARET inside ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ By a SINGLE LEFT mouse CLICK, on the LAST VISIBLE line N, this ║ ║ | | | ║ ║ ║ line becomes the new FIRST VISIBLE line, with the CARET inside ║ ║ 1 | 0 | 1 | 1 ║ 21 ║ Y ║ ║ ║ | | | ║ ║ ║ If a SINGLE LEFT mouse CLICK, on the FIRST VISIBLE line N, NO action occurs ( DEFAULT behavior ) ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ When pressing REPEATEDLY on the DOWN or UP keys, the CARET remains on the Y+1_th line, from the TOP ║ ║---------•---------•---------•---------•--------------•------------•-------------------------------------------------------------------------------------------------------------║ ║ | | | ║ ║ ║ By pressing the DOWN key, with the CARET on the LAST VISIBLE line N, the NEXT ║ ║ | | | ║ ║ ║ line N+1 becomes the Y+2_th VISIBLE line, from the END, with the CARET inside ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ By pressing the UP key, with the CARET on the FIRST VISIBLE line N, the PREVIOUS ║ ║ | | | ║ ║ ║ line N-1 becomes the Y+1_th VISIBLE line, from the TOP, with the CARET inside ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ By a SINGLE LEFT mouse CLICK, on the LAST VISIBLE line N, this line ║ ║ 0 | 1 | 1 | 1 ║ 13 ║ Y ║ becomes the new PENULTIMATE VISIBLE line N-1, with the CARET inside ( DEFAULT behavior ) ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ If a SINGLE LEFT mouse CLICK, on the FIRST VISIBLE line N, NO action occurs ( DEFAULT behavior ) ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ When pressing REPEATEDLY on the DOWN or UP keys, the CARET lies between ║ ║ | | | ║ ║ ║ the Y+1_th line, from the TOP, and the Y+2_th line, from the END ║ ║---------•---------•---------•---------•--------------•------------•-------------------------------------------------------------------------------------------------------------║ ║ | | | ║ ║ ║ By pressing the DOWN key, with the CARET on the LAST VISIBLE line N, the NEXT ║ ║ | | | ║ ║ ║ line N+1 becomes the 3Y+2_th VISIBLE line, from the END, with the CARET inside ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ By pressing the UP key, with the CARET on the FIRST VISIBLE line N, this line ║ ║ | | | ║ ║ ║ becomes the 3Y+1_th VISIBLE line, from the TOP, with the CARET inside ║ ║ | | | ║ ║ ║ ║ ║ 1 | 1 | 1 | 1 ║ 29 ║ Y ║ By a SINGLE LEFT mouse CLICK, on the LAST VISIBLE line N, this line ║ ║ | | | ║ ║ ║ becomes the 3Y+2_th VISIBLE line, from the END, with the CARET inside ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ If a SINGLE LEFT mouse CLICK, on the FIRST VISIBLE line N, NO action occurs ( DEFAULT behavior ) ║ ║ | | | ║ ║ ║ ║ ║ | | | ║ ║ ║ When pressing REPEATEDLY on the DOWN or UP keys, the CARET lies between ║ ║ | | | ║ ║ ║ the Y+1_th line, from the TOP, and the Y+2_th line, from the END ║ ===================================================================================================================================================================================
Note the caret management, defined with caretYPolicy =
12
. A bit weird !I just hope, that it’ll useful to someone ;-))
Best Regards,
guy038
-
@guy038
Thanks! I should have mentioned that I figured the table was wrong also and had to experiment to get my script to work. I didn’t document like you did though … Bravo!Cheers.