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 width and draw_white_space setting #300

Closed
quarnster opened this issue Jun 15, 2014 · 0 comments
Closed

Tab width and draw_white_space setting #300

quarnster opened this issue Jun 15, 2014 · 0 comments

Comments

@quarnster
Copy link
Member

quarnster commented Jun 15, 2014

There should be a function which replaces white-space characters with an appropriate character corresponding to the draw_white_space setting. Like · for space, ↩ for return and — for tab. This is a common issue that all frontends will have to deal with so we should have a helper function in the backend, probably in backend/render as this transformation isn't useful outside of rendering. Though themes might want to style these characters differently and be able to customize which exact unicode character is displayed so we should keep that in mind.

There's also a need for some helper code which scans a string for \t and returns a RegionSet (or []Region, or whatever) indicating in Region.A the position of the \t character, and in Region.B the number of spaces that it should be replaced with. Doing it this way we can use Region.A to reference the original string data or the "symbolized" version created with the unicode replacement characters as above, and then insert the appropriate number of characters for alignment.

Code from view.Insert should be refactored out to a separate function. IIRC the termbox frontend performs this transformation manually at the moment too, but the qml frontend will need something similar as \t is hardcoded in Qt to 8 spaces and isn't configurable, if I read the source code correctly.

But even if qml supported custom tab width, if we replace \t with another unicode character we still need to pad the text with white spaces to align the text, so this functionality is still needed.

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

No branches or pull requests

2 participants