Move scroll to focus only if it is out of sight#212
Conversation
|
Hi, thanks for the commit. I think this changed behavior should be controlled by an option setting. For example, I prefer the fixed centering behavior, but I acknowledge not everyone wants this. You can see examples of the options code here: https://github.com/nakst/gf/blob/master/gf2.cpp#L1276 |
|
I added option 'center_execution_pointer'. It's value is 'true' by default. It would be better to have the default value be 0, but I couldn't came up with the good name for the opposite property. |
You could keep the same name and have |
|
Oh, I just assumed that Nakst wanted the old behavior to be the default. |
|
Oh my bad I misunderstood your comment. Personally I think it is just fine as is. |
| int verticalMotionColumn; | ||
| bool useVerticalMotionColumn; | ||
| bool moveScrollToCaretNextLayout; | ||
| bool centerExecutionPointer = true; |
There was a problem hiding this comment.
Since UICode is allocated with calloc, I don't think this default assignment ever runs. Can you remove it?
Not that it matters because it's overwritten later anyway, but it could be misleading to someone reading the code.
Before:
When you walk through code the focused line is always in the middle of the view.
After:
The code stays in place and only moves if the focused line leaves the visible area (minus 5 rows of padding).
This way, if you iterate through a small loop the code doesn't jitter back and forth.