peterh / liner

Pure Go line editor with history, inspired by linenoise
MIT License
1.04k stars 132 forks source link

Dumb terminal support is broken for Emacs #39

Closed samertm closed 9 years ago

samertm commented 9 years ago

(State).Prompt return ErrNotTerminalOutput when called from called from "eshell" or "shell-mode" in Emacs because it doesn't know how many columns the output is (I believe that's the correct interpretation of https://github.com/peterh/liner/blob/master/input.go#L70, which is where outputRedirected is being set). (State).promptUnsupported works, though, and if you move the terminalSupported check above the outputRedirected check (https://github.com/peterh/liner/blob/master/line.go#L472), everything works as expected.

Liner is great, thanks for the solid library.

peterh commented 9 years ago

Thanks for the bug report.

If I move the test for terminalSupported, it preempts the stdout redirection test. I'll have to find a block of free time to work on finding the correct fix.

peterh commented 9 years ago

I didn't actually test with emacs. Please give the latest commit a try and let me know if it doesn't behave the way you expect.

samertm commented 9 years ago

Yes, it works for me! And by extension, this makes my app, cayley, and gore all work with my normal shell workflow :) thanks!