Bug 383976

Summary: newer vim outputs $q q on konsole (broken xterm-256color compatibility)
Product: [Applications] konsole Reporter: Albert Astals Cid <aacid>
Component: emulationAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED FIXED    
Severity: normal CC: drankinatty, egmont, elvis.angelaccio, michal.zajac+kde.org, mike.cloaked, rdieter, scott
Priority: NOR    
Version: 17.08.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Albert Astals Cid 2017-08-24 22:27:30 UTC
According to https://github.com/vim/vim/issues/2008#issuecomment-324476312

This is the usual problem of setting 'term' to "xterm", while the terminal is not actually xterm compatible. You have to set 'term' to the right value.

So either we change the 
 echo $TERM
  xterm-256color

or ideally we make it xterm compatible

I can try having a look at what needs fixing, but a pointer would be welcome :)
Comment 1 Egmont Koblinger 2017-08-25 09:47:10 UTC
This comment summarizes properly what is it that's not supported by konsole: https://github.com/vim/vim/issues/2008#issuecomment-324829794

Just FYI: VTE (gnome-terminal et al) doesn't support this either (ESC P aka "device control string" is totally unsupported there), but at least silently ignores it. Probably good enough, at least people don't complain about gnome-terminal there :)
Comment 2 Rex Dieter 2017-08-25 15:27:41 UTC
confirming here (on fedora 26).

(in case it matters):
$ echo $TERM
xterm-256color
Comment 3 David Rankin 2017-08-26 04:40:46 UTC
Just for the sake of completeness, this effects all versions of konsole back to 3.5.10.
Comment 4 MikeC 2017-08-26 08:22:30 UTC
(In reply to Rex Dieter from comment #2)
> confirming here (on fedora 26).
> 
> (in case it matters):
> $ echo $TERM
> xterm-256color

For my arch installation I have the same as you. 

After editing the file ~/.local/share/konsole/Shell.profile to add a line to the end of the [general] section containing "Environment=TERM=konsole-256color" then on starting konsole the $TERM now has:

 $ echo $TERM
konsole-256color

and the problem with vim no longer occurs.
Comment 5 Albert Astals Cid 2017-09-01 17:15:55 UTC
I've a very basic "fix" at https://phabricator.kde.org/D7644
Comment 6 Albert Astals Cid 2017-09-02 08:54:40 UTC
Git commit 6dc09a36c106879f3b86d024e6b95ac0f5f028c8 by Albert Astals Cid.
Committed on 02/09/2017 at 08:54.
Pushed by aacid into branch 'master'.

Ignore xterm-DCS messages

Summary:
Would be ideal to process them too, but they seem kind of corner
case and ignoring them fixes vim having $q q written on the first
line on startup

Test Plan:
Ran vim, looks good

Should this go to 17.08 or master?

Reviewers: hindenburg

Reviewed By: hindenburg

Subscribers: #konsole

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D7644

M  +2    -0    src/Vt102Emulation.cpp

https://commits.kde.org/konsole/6dc09a36c106879f3b86d024e6b95ac0f5f028c8
Comment 7 Kurt Hindenburg 2017-09-05 13:55:09 UTC
Git commit f3ddd3ef301d3c1e4f51405bf9a6afdc897edd8a by Kurt Hindenburg, on behalf of Albert Astals Cid.
Committed on 05/09/2017 at 13:46.
Pushed by hindenburg into branch 'Applications/17.08'.

Ignore xterm-DCS messages

Summary:
Would be ideal to process them too, but they seem kind of corner
case and ignoring them fixes vim having $q q written on the first
line on startup

Test Plan:
Ran vim, looks good

Should this go to 17.08 or master?

Reviewers: hindenburg

Reviewed By: hindenburg

Subscribers: #konsole

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D7644

(cherry picked from commit 6dc09a36c106879f3b86d024e6b95ac0f5f028c8)

M  +2    -0    src/Vt102Emulation.cpp

https://commits.kde.org/konsole/f3ddd3ef301d3c1e4f51405bf9a6afdc897edd8a
Comment 8 Kurt Hindenburg 2017-09-05 18:03:44 UTC
*** Bug 382501 has been marked as a duplicate of this bug. ***