TextBoxWidget: handle tabs and tabstops#5870
Merged
poire-z merged 2 commits intokoreader:masterfrom Feb 18, 2020
Merged
Conversation
Don't display a tofu glyph when meeting a tab (none of our fonts have a glyph for it). New parameter: TextBoxWidget.tabstop_nb_space_width, that defaults to 8, to ensure tabstops in the usual left aligmnent.
Merged
mwoz123
pushed a commit
to mwoz123/koreader
that referenced
this pull request
Mar 29, 2020
Don't display a tofu glyph when meeting a tab (none of our fonts have a glyph for it). New parameter: TextBoxWidget.tabstop_nb_space_width, that defaults to 8, to ensure tabstops in the usual left aligmnent (or right when para is RTL).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Don't display a tofu glyph when meeting a tab (none of our fonts have a glyph for it).
New parameter: TextBoxWidget.tabstop_nb_space_width, that defaults to 8, to ensure tabstops in the usual left aligmnent.
Needs a bump for base/xtext.cpp koreader/koreader-base#1049.
Closes #5837,
Defaulted to 8 spaces, because our spaces are really small and 4 was really tiny.
Also, only for TextBoxWidget - makes no real sense in TextWidget that hopefully only gets our own text or filenames.
I initially thought: why bother? as all our input is mostly tab-free (most dictionaries, Wikipedia, Google translate results, our own Lua code), except, as seen, some dict - and possibly some text files edited with TextEditor.
So, well, let's have a go: if it's not handled correctly, or the trick with text justification is really ugly, it won't affect much of our usual UI. And it's not that intrusive into the usual code, so, let's have it.
When text is justified, space extension is done only on spaces after the last tab on the line (which is a bit ugly, but well... haven't check how other text editors do it):

This change is