Page MenuHome

Add horizontal scrollbar to the Text Editor
Needs ReviewPublic

Authored by Amit Sari (Hamitos) on Dec 8 2018, 5:24 PM.

Diff Detail

Repository
rB Blender
Branch
arcpatch-D4054 (branched from master)
Build Status
Buildable 3228
Build 3228: arc lint + arc unit

Event Timeline

William Reynish (billreynish) created this revision.EditedDec 8 2018, 5:24 PM

@Amit Sari (Hamitos): I added a revision here for your diff.

@Campbell Barton (campbellbarton) or @Brecht Van Lommel (brecht): Can you check if this is ok?

Am not keen on looping over all lines for every redraw just to show horizontal scroll. Could this be limited to only looping over lines being displayed?

Hmm you're right.
However I think looping over visible lines only will cause weird behavior e.g. Jumping left horizontally when scrolling away from the longest line.
I added longest_line_length to the drawcache instead.

I tried updating this diff but it kept forcing me to create a new revision.
The updated result of "git diff" is attached.

Amit Sari (Hamitos) commandeered this revision.Sat, Mar 23, 9:01 PM

Commandeering to try and update when I'm the author.

Added longest line length to the drawcache so we don't need to loop over all lines every draw call.

This patch measures length in bytes which doesn't work properly w/ multi-byte characters, try paste this into the text editor for eg:

λλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλ

We could apply the patch with this as a known limitation, or calculate the length with BLF_width which is much more expensive (don't think it's worth it).