Edd12321/zrc

Problems with GNU screen

Opened this issue · 2 comments

lucmp commented

When I test zrc on the interactive command line, I often have these problems:

  • Backspace takes the cursor back past the prompt, overwriting it.
  • Pasting text is messy in multiple ways.
  • Pressing the UP arrow key causes the past command lines to be printed close to the prompt, with no space separating it as in the normal prompt.

The problem seems to be related to GNU screen. I use the Fish shell in GNU screen and my terminal application is stjerm, which is almost extinct nowadays. But I don't think stjerm is to blame. The same problem is not reproducible on sakura (another terminal application), until I start a GNU screen session in sakura. Then the problems begin again.

I never had any problem with GNU screen and Fish or Bash, so I am guessing Zrc and screen don't get along too well. It's hard to find anyone who still uses stjerm, but GNU screen is very popular so it's probably a good idea to check that. Maybe tmux too, but I never used it so I don't know if it has issues with Zrc (or any other shell for that matter).

Just as a temporary fix, you can always use another line editor with zrc.

Run make nozledit. This compiles zrc without its custom line editor. Then, install rlwrap instead of launching zrc, launch rlwrap zrc. This lets you use GNU readline, which takes into account many obscure terminal emulators, multiplexers and so on.

The problem is some terminals handle escape sequences differently. Working with termcap is very cumbersome as terminals are still 70s tech at heart, so inconsistencies like this are to be expected. GNU Readline also adds keyboard shortcuts, and is just nicer than the default line editor I wrote, because it's been around for so many years. You could also use this with tclsh, but the experience will just suck a bit more.

lucmp commented

rlwrap also messes things up. Not only with zrc, also with tclsh. So no. I'll keep using fish or Tkcon.

Which brings me to another thing, the readline history. I could open another ticket, but why not just mention it here.

In fish, I can do this:

$ for i in (seq 1 5) {
echo $i
}

When I press up and bring that from the history, fish remembers the entire sequence and prints it entirely. rlwrap doesn't. rlwrap will print every line individually as I press up.

At first I thought it was only rlwrap's fault, but then I saw that zrc without rlwrap also fails to bring the entire command sequence, printing one line at a time. Maybe that could be improved in the future?