rxi / lite

A lightweight text editor written in Lua
MIT License
7.42k stars 353 forks source link

Improve left/right scrolling behavior for DocView #230

Closed franko closed 3 years ago

franko commented 3 years ago

With the new behavior when moving right and triggering a scroll in the right direction a subsequent movement left do not longer triggers a scrolling to the left. The scrolling to the left happens only when needed for the visibility of the current position.

In other terms with the old behavior the scrolling was purely a function of the position and was adjusted even when not strictly needed for the visibility of the cursor. Now the scrolling is no longer a pure function of the position but it has a "memory" behavior. The scrolling will be adjusted only if needed to accommodate the position of the cursor.

Reduce also the width of the margin when the scrolling will be triggered and calculate as a function of the font character width.

With the modification now Lite behaves like the other editors. In addition the selection of text with the mouse is much more easy when a scrolling of the line is needed.