zshrc: fix urxvt multi-line issue
authorcantandwont <52587695+cantandwont@users.noreply.github.com>
Mon, 15 Jul 2019 09:42:36 +0000 (19:42 +1000)
committerMichael Prokop <mika@grml.org>
Wed, 21 Aug 2019 13:51:48 +0000 (15:51 +0200)
Quoting from #74:

| When running multiline commands in urxvt, parts of the command are re-echoed.
|
| Example:
|
| me@system ~/foo % ls \
| \`> -l
|
| -ltotal 0
| -rw-r--r-- 1 me users 0 Feb 27 20:36 bar1
| -rw-r--r-- 1 me users 0 Feb 27 20:36 bar2
|
| me@system ~/foo %
|
| Note the '-l' be re-echoed in front of 'total'.

Quoting from zshmisc(1):

| preexec
|
|     Executed just after a command has been read and is about to be
|     executed.  If the history mechanism is active (regardless of
|     whether the line was discarded from the  history  buffer),
|     the string that the user typed is passed as the first
|     argument, otherwise it is an empty string.  The actual command
|     that will be executed (including expanded aliases) is passed
|     in two different forms: the second argument is a
|     single-line, size-limited version of the command (with things
|     like function bodies elided); the third argument contains the
|     full text that is being executed.

Closes: #74

etc/zsh/zshrc

index 21db9e7..54e0649 100644 (file)
@@ -2525,7 +2525,7 @@ function grml_cmd_to_screen_title () {
 function grml_control_xterm_title () {
     case $TERM in
         (xterm*|rxvt*)
-            set_title "${(%):-"%n@%m:"}" "$1"
+            set_title "${(%):-"%n@%m:"}" "$2"
             ;;
     esac
 }