[FEATURE REQUEST] - Supporting TAB space in GUI and drawn texts (\t)

Started by Gal Shemesh, Wed 03/07/2024 13:28:33

Previous topic - Next topic

Gal Shemesh

Currently, we can only use \n escape sequence to making new lines within text elements. But if you'd wish to align some left to right text to the right-hand side of the text box by using \t for tabs it doesn't work. An example of how this would be useful is an context-menu GUI where you want to present the keyboard shortcuts of each option in a straight aligned line from top to bottom to the right side, while having the text aligned from left to right:

File    <F1>
Edit    <F2>
View    <F3>
...

Using spaces for this alignment doesn't work very well, unless the font you're using have an exact width for any of its characters, including of the space. So in some lines the alignment would show broken (just as showed above where I used 4 spaces between the words and the first < sign. In text editors, when hitting TAB after words, it automatically completes the desired spacing until the next TAB point, by either subtracting the words length from the amount of spacing that a TAB consists, or if the word length is more than 1 or more TABs, it completes the number of spaces until it reaches the next point where a new TAB should start.

It seems that each text editing program has different amount of spaces for a TAB character. A TAB in Notepad++ for example consists of 4 spaces, and in the regular Notepad in Windows, a TAB is consist from 8 spaces. But the general idea is the same: when you use TAB in any of these programs after words, it subtracts or adds the character amount of the word from the next TAB, until it reaches the next TAB position, where all lines could eventually be aligned for showing the further text vertically straight.

word Let's say that a tab- if the word is in text editors

Crimson Wizard

@Gal Shemesh I took a liberty to rename the topic, just to make the purpose more clear.

SMF spam blocked by CleanTalk