Page MenuHome

Add smooth scrolling to text editor
AbandonedPublic

Authored by Diego Gangl (januz) on Jan 5 2016, 1:04 AM.

Details

Summary

This patch adds smooth (line by line) scrolling for the text editor.
Scrolling starts at 4 lines away from the top/bottom edge.

It also adds a small padding to the top, so the ascenders aren't touching
the top of the editor.

Diff Detail

Repository
rB Blender
Branch
text_ed_scroll

Event Timeline

Diego Gangl (januz) retitled this revision from to Add smooth scrolling to text editor.
Diego Gangl (januz) updated this object.

Here's a comparison of the padding (left) with current (right)

Sergey Sharybin (sergey) requested changes to this revision.Jan 13 2016, 9:53 AM

tested the patch and it does not behave correct. Try going from the middle of screen to the top line of text using the mouse and then pres down key. Even tho cursor is being moved down, the text is scrolled upwards.

Another issue with the patch is that it adds some runtime state to DNA which isn't really nice. Think it's relatively simple to avoid this by, probably, storing current line in the operator and perhaps passing it to a few utility functions. Other ideas could work here as well.

This revision now requires changes to proceed.Jan 13 2016, 9:53 AM

Ahh forgot to test mouse scroll too, you're right.

My first attempt was to make a new function but I ended up duplicating a lot of code. Adding a new parameter was tricky too, because almost all text ops go through text_update_cursor_moved.

What do you mean by a few utility functions?

Diego Gangl (januz) edited edge metadata.
  • Rebased
  • Jump to position when cursor is not visible (fixes the mouse scroll error)
  • Use a boolean instead of the lines difference to check for line-by-line movement
  • Remove prev_curl from text DNA (since it is not needed anymore)

Rebased on current master

Hi guys, wondering if this is still wanted? Should I rebase?

Dropping this one since D5876 is doing the same, but based on current master