Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TUI in small windows wastes 50% of screen #137

Open
bnichs opened this issue Nov 30, 2023 · 6 comments
Open

TUI in small windows wastes 50% of screen #137

bnichs opened this issue Nov 30, 2023 · 6 comments

Comments

@bnichs
Copy link
Contributor

bnichs commented Nov 30, 2023

When using hishtory in a small window like those within an IDE, the whitespacing causes for a lot of wasted screen usage and when small enough, it will report that there are no history entries.

TUI erroneously showing no entries:
Screenshot_20231130_111450

TUI showing entries but wasting half of the usable vertical space:
hishtory-small-window

Is it possible to have a config option for more compact screen usage? There are a few approaches i could see:

  1. It looks like the space between "Search Query" and the prompt is used for debug messages, but those don't seem to be super useful compared to the history information being sought. It would be nice to either have those debug messages in the bottom footer, or make it so when they disappear the space being used is taken back to allow for history result to have the entire screen.

  2. The footer might be useful in the first few invocations, but when using the tool a lot its just redundant information that takes space from history items.

  3. The spacing between history items and the "Search Query" line could be reduced.

  4. The column headers seem to have a lot of spacing around them.

Any of these changes would be useful for smaller windows, but in general, my opinion is that the history items should be the first priority in terms of screen real estate, with everything else being optional.

If this seems like something that would be useful I can look into making a patch.

Thanks!

@ddworken
Copy link
Owner

ddworken commented Dec 4, 2023

Thank you for the feedback! PR #138 will improve this by removing the spacing for the debug header and the space for an expanded help panel. Check out this screenshot:

Screenshot 2023-12-03 at 4 54 14 PM

Do you think that this is sufficient? I could also look into make it even more compact, but I'm inclined to start with this improvement rather than making the TUI overly dense.

@ddworken
Copy link
Owner

ddworken commented Dec 4, 2023

If you run hishtory update, you'll get the latest version with these improvements. Please let me know what you think!

@bnichs
Copy link
Contributor Author

bnichs commented Dec 4, 2023

Thank you for the quick update! Also, that update command is great! I updated to:

% hishtory update 
Verified signature against tlog entry index 54503613 at URL: https://rekor.sigstore.dev/api/v1/log/entries/24296fb24b8ad77afa0a008e9611acf5ba3f43dbf075c8fbf676a25ff93ea7dabc491a46d95c91d8
Verified build using builder https://github.com/slsa-framework/slsa-github-generator/.github/workflows/builder_go_slsa3.yml@refs/tags/v1.2.1 at commit be3ad76e680cfdb97a275d54cec408adaee9910a
Successfully updated hishtory from v0.256 to v0.258

Top spacing

Its better in that i get that first history entry now instead of none. However, these two lines seem to be wasted space as once they disappear, its just a blank line (or two sometimes depending on load time of the remote):

⣻  Loading hishtory entries from other devices...
⣻  Executing search query...

It's not ideal that the space used by those messages isn't always reclaimed. Or if its not meant to be reclaimed, i'd love for those messages to only be shown under a debug or high verbosity mode.

Bottoms spacing

This update also seems to introduce a weird spacing on the bottom margin:

hishtory-new

Seems like if that bottom margin were cleaned up we could get maybe 3 or so history entries where we currently have 1. When combined with the top margin mentioned above, we could probably get 5 or 6 total entries in the list even in a very small terminal like I'm using in idea.

@bnichs
Copy link
Contributor Author

bnichs commented Dec 4, 2023

For reference, the window size im using is:

% python -c "import shutil;print(shutil.get_terminal_size())"
os.terminal_size(columns=74, lines=11)

@ddworken
Copy link
Owner

ddworken commented Dec 7, 2023

Got it, thank you for the explanation and details! I've pushed out another update with improved handling for these extra small terminals (see #140 for the code). Please give it a shot and let me know what you think.

@bnichs
Copy link
Contributor Author

bnichs commented Dec 7, 2023

Looks great! Now the smallest window i can do before showing no entries is 7 rows which is way too small to be useful anyway.

Thanks for the great work! lmk if i can buy you a coffee.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants