-
Notifications
You must be signed in to change notification settings - Fork 218
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 sizes in LineReader and System.out.println() are not the same (with LineReader.Option.INSERT_TAB) #861
Comments
Tab key is bound by default to As for displaying, tabs are hard-coded to 4 spaces: Proper handling of tabulations has never been implemented. The |
Using an implementation such as the following:
I have two questions:
1. LineReader representation of tab character
My REPL supports inserting indentation using the tab character. And, I can verify that the actual program input received from jline is in fact a tab character. However, jline presents the tab as 4 space characters on the command line. This causes issues with my error reporting mechanism, which assumes the user input's tab spacing is the same as
System.out.println("\t")
which formats a tab as a single character spanning 8 characters on my machine (macOS 12.6 Terminal app). I know this setting may vary across environments (even my shell zsh displays a tab as 8 spaces, but treats them as tabs when backspacing), so I would prefer not to alter my error reporting output to convert tabs to a set number of spaces for REPL output.So is there a way to configure what actual character(s) are inserted/displayed when the tab character is pressed? Can it be an actual tab, instead of spaces? Also, are tabs guaranteed to always be 4 spaces, no matter what environment or OS my program utilizing jline is executed?
2. Typing a tab after non-whitespace characters
And also, a second, related issue. I see no way to type a tab character after a non-whitespace character has been typed. It simply beeps, and does nothing. However, a copied tab character can still be pasted. So is there a way to enable typing of a tab at any arbitrary point of user input?
The text was updated successfully, but these errors were encountered: