br0xen / boltbrowser

A CLI Browser for BoltDB Files
GNU General Public License v3.0
631 stars 91 forks source link

scrolling/highlighting for buckets with lots of long values #6

Closed bits01 closed 7 years ago

bits01 commented 7 years ago

If you are browsing a bucket with lots of keys, it seems that the terminal does not scroll or highlight properly. You can see the correct key in the right panel, but the left panel is always at the top, it does not scroll. Not sure whether this can be implemented or it is a limitation of the term library.

bits01 commented 7 years ago

The highlighting seems to be broken on Mac OS (iTerm2 or stock Terminal app), but it seems to at least work in Linux gnome-terminal. Looks like the platform support from the term lib matters too.

br0xen commented 7 years ago

When you experience it not scrolling/highlighting properly, is it always with databases that have keys/values that wrap in the left pane?

bits01 commented 7 years ago

So far yes. Keys can be pretty long too, not just values. It seems that the highlighting breaks when the key itself is long and it wraps. If the key doesn't wrap, but the value does wrap highlighting works.

br0xen commented 7 years ago

:+1: That's what I figured. The current code assumes that a key-value pair in that left pane will only take up a single line on the screen. I'm thinking that it should just abbreviate that line if it can't fit it all, the full information, then, would be displayed in the right pane (when you highlight it). Does that sound like a good solution to you?

bits01 commented 7 years ago

Perhaps one approach would be to just display the keys in the left pane but no values. Even the keys could be made to either fit by doing something like STARTLONG...KEYEND or wrapping the key. I suspect a user would be interested in certain keys and it would be fine to look at the value in the right pane only. Of course, scrolling would still need to work in the left pane, for lots of keys.

br0xen commented 7 years ago

Just pushed a quick hotfix. Pull that down and see if it works for now.

bits01 commented 7 years ago

Very nice. Thank you!