02d12538090a8ed74ccb15ef976fca46adcde37b

Author
Marc Cornellà <marc.cornella@live.com>
Committer
GitHub <noreply@github.com>
Date

Message

lib: clean up termsupport.zsh

Diff

 1diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh
 2index 4d6fb8c21d02f5e50ebac570bbe3d65d0ed17013..d67223caa45e9b30cd797a631d972846b4e22ace 100644
 3--- a/lib/termsupport.zsh
 4+++ b/lib/termsupport.zsh
 5@@ -32,10 +32,10 @@ function title {
 6         # Try to use terminfo to set the title
 7         # If the feature is available set title
 8         if [[ -n "$terminfo[fsl]" ]] && [[ -n "$terminfo[tsl]" ]]; then
 9-	  echoti tsl
10-	  print -Pn "$1"
11-	  echoti fsl
12-	fi
13+          echoti tsl
14+          print -Pn "$1"
15+          echoti fsl
16+        fi
17       fi
18       ;;
19   esac
20@@ -50,24 +50,17 @@ fi
21 
22 # Runs before showing the prompt
23 function omz_termsupport_precmd {
24-  emulate -L zsh
25-
26-  if [[ "$DISABLE_AUTO_TITLE" == true ]]; then
27-    return
28-  fi
29-
30+  [[ "$DISABLE_AUTO_TITLE" == true ]] && return
31   title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE
32 }
33 
34 # Runs before executing the command
35 function omz_termsupport_preexec {
36+  [[ "$DISABLE_AUTO_TITLE" == true ]] && return
37+
38   emulate -L zsh
39   setopt extended_glob
40 
41-  if [[ "$DISABLE_AUTO_TITLE" == true ]]; then
42-    return
43-  fi
44-
45   # split command into array of arguments
46   local -a cmdargs
47   cmdargs=("${(z)2}")
48@@ -99,10 +92,9 @@ function omz_termsupport_preexec {
49     esac
50 
51     # override preexec function arguments with job command
52-    local job_cmd="${jobtexts[$job_id]}"
53-    if [[ -n "$job_cmd" ]]; then
54-      1="$job_cmd"
55-      2="$job_cmd"
56+    if [[ -n "${jobtexts[$job_id]}" ]]; then
57+      1="${jobtexts[$job_id]}"
58+      2="${jobtexts[$job_id]}"
59     fi
60   fi
61