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

Tab padding character? #3427

Closed
m-kru opened this issue Aug 14, 2022 · 7 comments · Fixed by #3458
Closed

Tab padding character? #3427

m-kru opened this issue Aug 14, 2022 · 7 comments · Fixed by #3458
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements

Comments

@m-kru
Copy link

m-kru commented Aug 14, 2022

Is it possible to set tab padding character? https://docs.helix-editor.com/configuration.html#editorwhitespace-section does not mention it.
By the way what is nbsp? Maybe it would be nice to add some comment in the line to explain it.

@the-mikedavis
Copy link
Member

Only the space, newline, tab, and nbsp can be rendered currently. Which is the tab padding character? U+0080?

NBSP is https://en.wikipedia.org/wiki/Non-breaking_space. It's used most often when writing HTML.

@m-kru
Copy link
Author

m-kru commented Aug 14, 2022

I guess there is no standard tab padding character. People use different characters for this purpose.

@the-mikedavis
Copy link
Member

I don't understand - is the tab padding character a character in a file or something displayed when a file has a tab in it?

You can customize the latter with the editor.whitespace.characters.tab configuration you linked. For example I have mine bound to rightwards triangle ()

tab

@m-kru
Copy link
Author

m-kru commented Aug 14, 2022

image
In Kakoune I use centered dots. Single character length is always 1, however the tab is usually configured to be longer, hence some character to pad the tab character.

@n0s4
Copy link
Contributor

n0s4 commented Aug 15, 2022

Do you mean adding virtual whitespace to change tab length? Virtual whitespace is a WIP but you can configure the tab length.

@m-kru
Copy link
Author

m-kru commented Aug 15, 2022

No. The tab character is a single character. However, the tab is usually set to be longer than single character. In @the-mikedavis screenshot you can see there is a little arrow and then nothing. In my screenshot there is a little arrow and 3 dots. It is all about how the tab is displayed.

@the-mikedavis
Copy link
Member

Currently this isn't possible: the tab setting in editor.whitespace.characters must be deserializable to a char. We pad the tab character with spaces here:

let tab = if whitespace.render.tab() == WhitespaceRenderValue::All {
(1..tab_width).fold(whitespace.characters.tab.to_string(), |s, _| s + " ")
} else {

which could be replaced either with a new padding character or the tab setting could be a string that gets truncated to the tab-width.

@the-mikedavis the-mikedavis added C-enhancement Category: Improvements A-helix-term Area: Helix term improvements labels Aug 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants