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
Incorrect behavior on Home, End, etc. under screen #152
Comments
I can also reproduce this under Workaround: use C-a/C-e (that is, Ctrl-a for Home, or Ctrl-e for End).
Makes total sense to me. Background: Different terminal emulators use different escape sequences for the same commands, so native *x programs need to use libraries to interpret those escape sequences (that is, termcap/terminfo, or higher-level libraries wrapping those, such as readline or ncurses). Those libraries are hard to access on the JVM, hence I guess Ammonite doesn't use them. Indeed, escape sequences are hardcoded in Working hypothesis: screen sends for Home/End a different escape sequence than xterm, hence Ammonite-REPL does not understand it. |
Is termcap/terminfo accessible via shelling out? That would be the easiest, since we already shell out to get TTY height/width, set terminal state, etc. like we do here If not we can add it to the list of hardcodes. I'm guessing JLine has fixed/doesn't-have this problem, so whatever they're doing probably works for us too. (I know nothing about terminals and just hacked this stuff together, so don't take my word for anything, and feel free to tell me the code I have in terminal/ is totally wrong) |
I just learned that commands
What I looked up: But I don't fully get terminals either — I've carefully avoided entering that deep swamp I'm also confused that you have those hardcodes and use JLine? Any chance this is also a quick hack because interfacing more to JLine is the right thing but hard to do, or is JLine too restrictive? |
If you want to use JLine, go ahead! // Ammonite on Linux/OSX and JLineWindows on Windows
repl.frontEnd() = ammonite.repl.frontend.FrontEnd.JLineUnix (Documented in http://lihaoyi.github.io/Ammonite/#Configuration) Put it in your I, for one, want my input-syntax-highlighting, and multiline editing capabilities, so I'm willing to beat through a few bugs to make it work =D JLine is pretty restrictive. In particular, input highlighting and multiline editing/history are basically never going to happen. I've tried! So I went and made my own thing and left JLine as a fallback for people who like the old way |
Thanks, I see. I've seen some of the shelling out code that you pointed me to overlaps a lot with https://github.com/jline/jline2/blob/master/src/main/java/jline/UnixTerminal.java — and the interaction with |
It seems like JLine has much of the logic around these terminal key things in this file https://github.com/jline/jline2/blob/92792c59a42713d55d434526ddf0361993d3f741/src/main/java/jline/internal/InfoCmp.java The question is how can we use it to do the same thing... |
Oddly enough, this exists in JLine master but not in 2.12 I'm using. I wonder why that's the case |
Yes, that's the parsing of the |
Reproduce steps: start screen, start Ammonite using
sbt projectName/test:console
(I can't download https://git.io/vOdoc), tap Home, tap Enter:End, Enter:
Same for Alt+arrow.
Home, End, etc works fine for default scala repl under screen and for Ammonite without screen.
Difference between
export
under screen and without screen is inTERM
,TERMCAP
,WINDOW
,SHLVL
,STY
,OLDPWD
variables.TERM="xterm" TERMCAP="" WINDOW="" SHLVL="1" STY="" OLDPWD="" sbt projectName/test:console
command doesn't fix Ammonite under screen and doesn't break Ammonite without screen.The text was updated successfully, but these errors were encountered: