Weird output on multiline command in Kitty?
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
I'm running non-GUI ArchLinux on VMWare 14.0. I installed a ssh server on it (by openssh) and connected to my virtual machine by using Kitty 0.70 on Windows 10 [Version 10.0.15063].
My problem is: When I use multiline command, the output of command in Kitty is really weird.
For example:
On Kitty ssh client:
[ddk@mylinux:~]
14:23:08 $ if [[ -o interactive ]]
if> then
then> echo 'inter'
then> fi
then # not my typing
echo 'inter' # not my typing
fi)inter # not my typing
[ddk@mylinux:~]
14:23:34 $
On terminal in my virtual machine:
[ddk@mylinux:~]
14:23:54 $ if [[ -o interactive ]]
if > then
then > echo interactive
then > fi
interactive
[ddk@mylinux:~]
14:24:37 $
So how do I fix improper output on my Kitty ssh client?
P/S: I am running zsh without any preconfigure scripts like oh-my-zsh. This is my .zshrc.
command-line zsh prompt special-characters window-title
add a comment |Â
up vote
2
down vote
favorite
I'm running non-GUI ArchLinux on VMWare 14.0. I installed a ssh server on it (by openssh) and connected to my virtual machine by using Kitty 0.70 on Windows 10 [Version 10.0.15063].
My problem is: When I use multiline command, the output of command in Kitty is really weird.
For example:
On Kitty ssh client:
[ddk@mylinux:~]
14:23:08 $ if [[ -o interactive ]]
if> then
then> echo 'inter'
then> fi
then # not my typing
echo 'inter' # not my typing
fi)inter # not my typing
[ddk@mylinux:~]
14:23:34 $
On terminal in my virtual machine:
[ddk@mylinux:~]
14:23:54 $ if [[ -o interactive ]]
if > then
then > echo interactive
then > fi
interactive
[ddk@mylinux:~]
14:24:37 $
So how do I fix improper output on my Kitty ssh client?
P/S: I am running zsh without any preconfigure scripts like oh-my-zsh. This is my .zshrc.
command-line zsh prompt special-characters window-title
1
Looks like yourpreexec
is to blame.
â Stéphane Chazelas
Oct 14 '17 at 9:34
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I'm running non-GUI ArchLinux on VMWare 14.0. I installed a ssh server on it (by openssh) and connected to my virtual machine by using Kitty 0.70 on Windows 10 [Version 10.0.15063].
My problem is: When I use multiline command, the output of command in Kitty is really weird.
For example:
On Kitty ssh client:
[ddk@mylinux:~]
14:23:08 $ if [[ -o interactive ]]
if> then
then> echo 'inter'
then> fi
then # not my typing
echo 'inter' # not my typing
fi)inter # not my typing
[ddk@mylinux:~]
14:23:34 $
On terminal in my virtual machine:
[ddk@mylinux:~]
14:23:54 $ if [[ -o interactive ]]
if > then
then > echo interactive
then > fi
interactive
[ddk@mylinux:~]
14:24:37 $
So how do I fix improper output on my Kitty ssh client?
P/S: I am running zsh without any preconfigure scripts like oh-my-zsh. This is my .zshrc.
command-line zsh prompt special-characters window-title
I'm running non-GUI ArchLinux on VMWare 14.0. I installed a ssh server on it (by openssh) and connected to my virtual machine by using Kitty 0.70 on Windows 10 [Version 10.0.15063].
My problem is: When I use multiline command, the output of command in Kitty is really weird.
For example:
On Kitty ssh client:
[ddk@mylinux:~]
14:23:08 $ if [[ -o interactive ]]
if> then
then> echo 'inter'
then> fi
then # not my typing
echo 'inter' # not my typing
fi)inter # not my typing
[ddk@mylinux:~]
14:23:34 $
On terminal in my virtual machine:
[ddk@mylinux:~]
14:23:54 $ if [[ -o interactive ]]
if > then
then > echo interactive
then > fi
interactive
[ddk@mylinux:~]
14:24:37 $
So how do I fix improper output on my Kitty ssh client?
P/S: I am running zsh without any preconfigure scripts like oh-my-zsh. This is my .zshrc.
command-line zsh prompt special-characters window-title
edited Oct 14 '17 at 22:05
Gilles
508k12010041533
508k12010041533
asked Oct 14 '17 at 7:55
Mark J. Adams
252213
252213
1
Looks like yourpreexec
is to blame.
â Stéphane Chazelas
Oct 14 '17 at 9:34
add a comment |Â
1
Looks like yourpreexec
is to blame.
â Stéphane Chazelas
Oct 14 '17 at 9:34
1
1
Looks like your
preexec
is to blame.â Stéphane Chazelas
Oct 14 '17 at 9:34
Looks like your
preexec
is to blame.â Stéphane Chazelas
Oct 14 '17 at 9:34
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
As Stéphane Chazelas remarked, the problem is in your preexec
function. When you set the terminal title, you use the command without protecting its special characters. The first newline in the command terminates the escape sequence to set the title, and the other lines get printed.
You would also have a problem with backslashes and percent characters in the command, since print
performs backslash expansion and you're also performing prompt percent expansion on the command.
The solution is to remove or encode control characters, and to perform backslash expansion to get control characters separately from the characters in the prompt. For example:
set_title () print -rn $'e]0;'$$:-$(%):-$1$2//[^[:print:]]/_$'a'
precmd () set_title '[%n@%M:%~]' ''
preexec () set_title '[%n@%M:%~]' " ($1)"
I think we shall use a double quote ("
) in precmd and preexec.
â Mark J. Adams
Oct 18 '17 at 2:30
@DDK I fixedpreexec
.precmd
doesn't need double quotes.
â Gilles
Oct 18 '17 at 8:42
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
As Stéphane Chazelas remarked, the problem is in your preexec
function. When you set the terminal title, you use the command without protecting its special characters. The first newline in the command terminates the escape sequence to set the title, and the other lines get printed.
You would also have a problem with backslashes and percent characters in the command, since print
performs backslash expansion and you're also performing prompt percent expansion on the command.
The solution is to remove or encode control characters, and to perform backslash expansion to get control characters separately from the characters in the prompt. For example:
set_title () print -rn $'e]0;'$$:-$(%):-$1$2//[^[:print:]]/_$'a'
precmd () set_title '[%n@%M:%~]' ''
preexec () set_title '[%n@%M:%~]' " ($1)"
I think we shall use a double quote ("
) in precmd and preexec.
â Mark J. Adams
Oct 18 '17 at 2:30
@DDK I fixedpreexec
.precmd
doesn't need double quotes.
â Gilles
Oct 18 '17 at 8:42
add a comment |Â
up vote
2
down vote
accepted
As Stéphane Chazelas remarked, the problem is in your preexec
function. When you set the terminal title, you use the command without protecting its special characters. The first newline in the command terminates the escape sequence to set the title, and the other lines get printed.
You would also have a problem with backslashes and percent characters in the command, since print
performs backslash expansion and you're also performing prompt percent expansion on the command.
The solution is to remove or encode control characters, and to perform backslash expansion to get control characters separately from the characters in the prompt. For example:
set_title () print -rn $'e]0;'$$:-$(%):-$1$2//[^[:print:]]/_$'a'
precmd () set_title '[%n@%M:%~]' ''
preexec () set_title '[%n@%M:%~]' " ($1)"
I think we shall use a double quote ("
) in precmd and preexec.
â Mark J. Adams
Oct 18 '17 at 2:30
@DDK I fixedpreexec
.precmd
doesn't need double quotes.
â Gilles
Oct 18 '17 at 8:42
add a comment |Â
up vote
2
down vote
accepted
up vote
2
down vote
accepted
As Stéphane Chazelas remarked, the problem is in your preexec
function. When you set the terminal title, you use the command without protecting its special characters. The first newline in the command terminates the escape sequence to set the title, and the other lines get printed.
You would also have a problem with backslashes and percent characters in the command, since print
performs backslash expansion and you're also performing prompt percent expansion on the command.
The solution is to remove or encode control characters, and to perform backslash expansion to get control characters separately from the characters in the prompt. For example:
set_title () print -rn $'e]0;'$$:-$(%):-$1$2//[^[:print:]]/_$'a'
precmd () set_title '[%n@%M:%~]' ''
preexec () set_title '[%n@%M:%~]' " ($1)"
As Stéphane Chazelas remarked, the problem is in your preexec
function. When you set the terminal title, you use the command without protecting its special characters. The first newline in the command terminates the escape sequence to set the title, and the other lines get printed.
You would also have a problem with backslashes and percent characters in the command, since print
performs backslash expansion and you're also performing prompt percent expansion on the command.
The solution is to remove or encode control characters, and to perform backslash expansion to get control characters separately from the characters in the prompt. For example:
set_title () print -rn $'e]0;'$$:-$(%):-$1$2//[^[:print:]]/_$'a'
precmd () set_title '[%n@%M:%~]' ''
preexec () set_title '[%n@%M:%~]' " ($1)"
edited Oct 18 '17 at 8:42
answered Oct 14 '17 at 22:05
Gilles
508k12010041533
508k12010041533
I think we shall use a double quote ("
) in precmd and preexec.
â Mark J. Adams
Oct 18 '17 at 2:30
@DDK I fixedpreexec
.precmd
doesn't need double quotes.
â Gilles
Oct 18 '17 at 8:42
add a comment |Â
I think we shall use a double quote ("
) in precmd and preexec.
â Mark J. Adams
Oct 18 '17 at 2:30
@DDK I fixedpreexec
.precmd
doesn't need double quotes.
â Gilles
Oct 18 '17 at 8:42
I think we shall use a double quote (
"
) in precmd and preexec.â Mark J. Adams
Oct 18 '17 at 2:30
I think we shall use a double quote (
"
) in precmd and preexec.â Mark J. Adams
Oct 18 '17 at 2:30
@DDK I fixed
preexec
. precmd
doesn't need double quotes.â Gilles
Oct 18 '17 at 8:42
@DDK I fixed
preexec
. precmd
doesn't need double quotes.â Gilles
Oct 18 '17 at 8:42
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f398074%2fweird-output-on-multiline-command-in-kitty%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
Looks like your
preexec
is to blame.â Stéphane Chazelas
Oct 14 '17 at 9:34