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

Scrollable tab-bar #437

Merged
merged 1 commit into from
Oct 9, 2023
Merged

Scrollable tab-bar #437

merged 1 commit into from
Oct 9, 2023

Conversation

DLFW
Copy link
Contributor

@DLFW DLFW commented Sep 30, 2023

This implements a scrollable tab bar, like discussed in #233.

This makes tabs easier to read, better utilizes the space in the top-bar and makes handling many tabs way easier.

The display of the current directory has been removed. The current tab will show the directory always in full form. The directories of other tabs will be shown in full form if there is enough space, otherwise, they will be shown in a short form. If the available space in the top-bar is still not sufficient, scroll tags will be added at each end.

The long-form is currently defined as the full, absolute path. The short-form is currently defined as the last directory element of the path.

The tab-bar is configurable in terms of font styling and style character (like dividers, prefixes, and postfixes).

Documentation has been created in a separate file.

Collateral impact:

  • The tilde_in_titlebar option for [display] in joshuto.toml has been removed. (Because the "current dir display" has been removed.)
  • The display_mode option for [tabs] in joshuto.toml has been removed and with it, also the tab_bar_mode command. The appearance of index-numbers in tags is not configurable anymore. Numbers are shown if and only if there are more than one tab. This feature can be re-introduced later in some other form if still desired with the new tab-bar. With the new tab-bar, this configuration option did not make sense the way it was designed.
  • The max_len option for [tabs] in joshuto.toml has been removed. (Because tabs don't have a fixed width anymore.)
  • The function/feature of shortening paths by replacing heading path elements with their first character only has been removed. (Because I expect that this hard-to-interpret representation of a path will rarely be beneficial, now that there is a better space utilization in the top bar.)
  • The "old" tab-bar configuration options have been removed.
  • A AppStyleOptionsRaw struct has been introduced to allow handling of more complex default styling logic. Each styling attribute is defined there as an Option to indicate if a styling option has been set by the user or not.
  • A PathStyleIfSome trait is now available in "utils" to patch ratatui styles with another, optional style.

This implements a scrollable tab bar, like discussed in kamiyaa#233.

This makes tabs easier to read, better utilizes the space in the top-bar
and makes handling many tabs way easier.

The display of the current directory has been removed.
The current tab will show the directory always in full form.
The directories of other tabs will be shown in full form if there is
enough space, otherwise, they will be shown in a short form.
If the available space in the top-bar is still not sufficient, scroll
tags will be added at each end.

The long-form is currently defined as the full, absolute path.
The short-form is currently defined as the last directory element of the
path.

The tab-bar is configurable in terms of font styling and style character
(like dividers, prefixes, and postfixes).

Documentation has been created in a separate file.

Collateral impact:
* The `tilde_in_titlebar` option for `[display]` in `joshuto.toml`
  has been removed.
  (Because the "current dir display" has been removed.)
* The `display_mode` option for `[tabs]` in `joshuto.toml`
  has been removed and with it, also the `tab_bar_mode` command.
  The appearance of index-numbers in tags is not configurable anymore.
  Numbers are shown if and only if there are more than one tab.
  This feature can be re-introduced later in some other form if still
  desired with the new tab-bar.
  With the new tab-bar, this configuration option did not make sense the
  way it was designed.
* The `max_len` option for `[tabs]` in `joshuto.toml`
  has been removed. (Because tabs don't have a fixed width anymore.)
* The function/feature of shortening paths by replacing heading path
  elements with their first character only has been removed.
  (Because I expect that this hard-to-interpret representation of a path
  will rarely be beneficial, now that there is a better space utilization in
  the top bar.)
* The "old" tab-bar configuration options have been removed.
* A `AppStyleOptionsRaw` struct has been introduced to allow handling of
  more complex default styling logic. Each styling attribute is defined
  there as an `Option` to indicate if a styling option has been
  set by the user or not.
* A `PathStyleIfSome` trait is now available in "utils" to patch ratatui
  styles with another, _optional_ style.
@DLFW
Copy link
Contributor Author

DLFW commented Sep 30, 2023

Quick link to the documentation for tab-bar configuration in my fork: https://github.com/DLFW/joshuto/tree/nicer-tabs/docs/configuration/tabbar

I would enhance the docs in some time, I guess.

Here are two screenshots of the default configuration; without scroll tags:
Screenshot_20230930_211141

...and with scroll tags:
Screenshot_20230930_211736

Copy link
Owner

@kamiyaa kamiyaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, this is amazing! Thank you!

@kamiyaa kamiyaa merged commit 8412f05 into kamiyaa:main Oct 9, 2023
@kamiyaa
Copy link
Owner

kamiyaa commented Oct 9, 2023

Fixed crash 👍 cfcefaf

@DLFW
Copy link
Contributor Author

DLFW commented Oct 9, 2023

Thanks @kamiyaa! Sorry for the bug... I was testing this since weeks but it seems I'm not so interested in my root dir.... 😄

Dzordzu pushed a commit to Dzordzu/joshuto that referenced this pull request Oct 14, 2023
This implements a scrollable tab bar, like discussed in kamiyaa#233.

This makes tabs easier to read, better utilizes the space in the top-bar
and makes handling many tabs way easier.

The display of the current directory has been removed.
The current tab will show the directory always in full form.
The directories of other tabs will be shown in full form if there is
enough space, otherwise, they will be shown in a short form.
If the available space in the top-bar is still not sufficient, scroll
tags will be added at each end.

The long-form is currently defined as the full, absolute path.
The short-form is currently defined as the last directory element of the
path.

The tab-bar is configurable in terms of font styling and style character
(like dividers, prefixes, and postfixes).

Documentation has been created in a separate file.

Collateral impact:
* The `tilde_in_titlebar` option for `[display]` in `joshuto.toml`
  has been removed.
  (Because the "current dir display" has been removed.)
* The `display_mode` option for `[tabs]` in `joshuto.toml`
  has been removed and with it, also the `tab_bar_mode` command.
  The appearance of index-numbers in tags is not configurable anymore.
  Numbers are shown if and only if there are more than one tab.
  This feature can be re-introduced later in some other form if still
  desired with the new tab-bar.
  With the new tab-bar, this configuration option did not make sense the
  way it was designed.
* The `max_len` option for `[tabs]` in `joshuto.toml`
  has been removed. (Because tabs don't have a fixed width anymore.)
* The function/feature of shortening paths by replacing heading path
  elements with their first character only has been removed.
  (Because I expect that this hard-to-interpret representation of a path
  will rarely be beneficial, now that there is a better space utilization in
  the top bar.)
* The "old" tab-bar configuration options have been removed.
* A `AppStyleOptionsRaw` struct has been introduced to allow handling of
  more complex default styling logic. Each styling attribute is defined
  there as an `Option` to indicate if a styling option has been
  set by the user or not.
* A `PathStyleIfSome` trait is now available in "utils" to patch ratatui
  styles with another, _optional_ style.
@DLFW DLFW deleted the nicer-tabs branch December 19, 2023 19:58
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

Successfully merging this pull request may close these issues.

2 participants