You are not logged in.

#1 2017-03-30 22:27:40

nbd
Member
Registered: 2014-08-04
Posts: 389

[SOLVED] Gnome terminal doesn't move caret to the new line

Hello,

when in, e.g., xterm terminal emulator, one types a long line exceeding the terminal's width, then the caret is automatically moved to the beginning of the next line. As if there were inserted two control characters: new_line and carriage_return.

In Gnome terminal (out of the box, without any customization) the caret, upon reaching the right terminal's end,  is moved to beginning of the current line, and the text is continued to be typed from the left end of the existing text. As if only carriage return control character without new line were issued.

How this can be corrected?

Thanks.

Last edited by nbd (2017-03-30 23:11:59)


bing different

Offline

#2 2017-03-30 22:32:00

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] Gnome terminal doesn't move caret to the new line

This sounds like either a broken prompt or a forced TERM variable.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2017-03-30 22:40:42

nbd
Member
Registered: 2014-08-04
Posts: 389

Re: [SOLVED] Gnome terminal doesn't move caret to the new line

Strange, I didn't made any customizations yet to the newly installed Arch with Gnome. The .bashrc is the original one:

#
# ~/.bashrc
#

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

alias ls='ls --color=auto'
PS1='[\u@\h \W]\$ '

The xterm terminal emulator works normally with long lines.

EDIT:

The second cause seems the case. Looks like the TERM variable is configured to be set to "term-256color" on the new Arch installation. And this causes some glitches in Gnome terminal.

Last edited by nbd (2017-03-30 23:10:43)


bing different

Offline

#4 2017-03-31 18:28:39

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

Re: [SOLVED] Gnome terminal doesn't move caret to the new line

Can you explain what you did after you found out that the value of $TERM influences that behavior?

For me here, I remember I "fixed" it by disabling an option named "rewrap on resize". Normally, gnome-terminal remembers those long lines that exceed the window's width. It uses that to re-wrap lines when you resize the window. I thought that was a cute feature and would like to keep it. Does it work for you after whatever you did to $TERM?

Offline

#5 2017-03-31 19:32:58

nbd
Member
Registered: 2014-08-04
Posts: 389

Re: [SOLVED] Gnome terminal doesn't move caret to the new line

I normally very rarely resize terminal window (I configured its initial size so that it fits for most cases), and if I expect a long lines in the output (e.g. in journalctl), I resize it beforehand, so that I haven't notice a need in rewrapping.

You can check the needed behavior yourself, by starting another terminal instance as follows:

$ TERM="" gnome-terminal

bing different

Offline

#6 2017-03-31 20:55:11

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] Gnome terminal doesn't move caret to the new line

nbd wrote:

Looks like the TERM variable is configured to be set to "term-256color" on the new Arch installation.

Nope. Arch doesn't work like that. This is something you would have had to configure.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#7 2017-03-31 22:52:19

nbd
Member
Registered: 2014-08-04
Posts: 389

Re: [SOLVED] Gnome terminal doesn't move caret to the new line

jasonwryan wrote:

Nope. Arch doesn't work like that. This is something you would have had to configure.

I certainly didn't yet do any changes to configuration files yet (I'm busy with some work on another machine):

[root /]# grep -r xterm_256color /etc/*
[root /]# grep -r xterm_256color /home/*
[root /]# env | grep TERM
TERM=xterm-256color

Maybe terminals themselves set the TERM variable when it's not defined? In gnome-terminal this variable is set to "xterm_256color" (which apparently causes the problems with multiline commands):

[al ~]$ echo $TERM
xterm-256color

and in xterm this variable is set to "xterm":

[al ~]$ echo $TERM
xterm

bing different

Offline

#8 2017-03-31 23:21:03

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] Gnome terminal doesn't move caret to the new line

nbd wrote:

Maybe terminals themselves set the TERM variable when it's not defined?

Yes, that is how it is supposed to work. It is only when you force a TERM variable that you see the sort of behaviour you described.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB