0

I´m a keen user of the fish-shell and I like it a lot.

One question though:

on the page https://fishshell.com/docs/2.1/index.html there is a paragraph entitled "Command line editor". It lists a lot of useful shortcuts.

What´s most interesting to me is ctrl-L. According to the description: "Ctrl-L clears and repaints the screen". I tried it out and it works as desired. Yet it produces some signs that are added to the previous prompt. That can be seen when scrolling backwards.

Example:

rosika@... ~/Schreibtisch> [3;J
rosika@... ~/Schreibtisch>

So this [3;J is what I´m asking about. The [ is indeed some sort of rectangle with (I guess) 4 digits in it.

Can anyone tell me why that phenomenon occurs? What´s it about and is it supposed to be this way?

Thanks a lot in advance.

Greetings

Rosika

My system:

Linux/Lubuntu 16.04.4 LTS, 64 bit

fish v. 2.2.0-3

2 Answers 2

2

unix terminals are filled with content by interpreting control sequences and text intermixed in a single stream. many characters can be both text and a control code and it depends on context what they mean.

<esc>[3;J is one such sequence. in the wrong context it prints, in the right context it's part of resetting the display.

see the termcap, console_codes, and tput man pages for more details.

1
  • Hi Jasen. Tnx a lot. It´s a really fine explanation. I´m always glad to learn something new. I looked up the man-mages you were referring to. In man console_codes I found ESC [ 3 J: erase whole display including scroll−back buffer (since Linux 3.0). That´s it I suppose. The semicolon between 3 and J is syntax-specific I guess.
    – Rosika
    Commented May 30, 2018 at 11:52
1

Your terminal emulator does not match the value of your TERM environment variable. The most common error is to think that something that is not XTerm will match the termcap/terminfo records named xterm or xterm-new or xterm-256color.

Your terminfo record specifies the relatively new E3 capability (currently specified for the linux, putty, putty-256color, xterm-basic, xterm-new, xterm, xterm-256color, and a few other terminal types) that tells programs that there is a scrollback buffer to clear and how to clear it. But your terminal emulator does not in fact support that control sequence, and prints what you see in response to it, instead. The fish shell is running the clear command, which now makes use of this terminfo augmentation.

The name given in the value of your TERM environment variable must match the name of a termcap/terminfo record that correctly describes your terminal emulator's operation.

Further reading

1
  • Hi. Tnx for the info and the links. You´re right. My default terminal emulator is lxterminal. By the way: when typing clear it produces the same symbols. I never realized that before. When typing clear or "ctrl-L** within xterm however the clearing of the terminal-screen occurs as it should without the option of rolling back to the previous prompt. Like you said: Your terminal emulator does not match the value of your TERM environment variable. And indeed echo $TERM returns xterm. So I might change settings so that xterm becomes my default.
    – Rosika
    Commented May 30, 2018 at 14:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .