From a234636982349a82ab6c7f0674f3ff884acddc94 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Wed, 12 Jul 2017 03:29:31 +0200 Subject: [PATCH 1/5] Fix empty delimiter Even if the delimiter is empty, the min length should be 1. This fixes #558 --- functions/utilities.zsh | 2 +- test/segments/dir.spec | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/functions/utilities.zsh b/functions/utilities.zsh index 86e5ba0e..39c5ecae 100644 --- a/functions/utilities.zsh +++ b/functions/utilities.zsh @@ -212,7 +212,7 @@ function segmentShouldBeJoined() { # Given a directory path, truncate it according to the settings for # `truncate_from_right` function truncatePathFromRight() { - local delim_len=${#POWERLEVEL9K_SHORTEN_DELIMITER} + local delim_len=${#POWERLEVEL9K_SHORTEN_DELIMITER:-1} echo $1 | sed $SED_EXTENDED_REGEX_PARAMETER \ "s@(([^/]{$((POWERLEVEL9K_SHORTEN_DIR_LENGTH))})([^/]{$delim_len}))[^/]+/@\2$POWERLEVEL9K_SHORTEN_DELIMITER/@g" } diff --git a/test/segments/dir.spec b/test/segments/dir.spec index b2991175..3a6af649 100755 --- a/test/segments/dir.spec +++ b/test/segments/dir.spec @@ -72,6 +72,26 @@ function testTruncationFromRightWorks() { unset POWERLEVEL9K_SHORTEN_STRATEGY } +function testTruncationFromRightWithEmptyDelimiter() { + POWERLEVEL9K_SHORTEN_DIR_LENGTH=2 + POWERLEVEL9K_SHORTEN_DELIMITER="" + POWERLEVEL9K_SHORTEN_STRATEGY='truncate_from_right' + + FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789 + mkdir -p $FOLDER + cd $FOLDER + + assertEquals "%K{blue} %F{black}/tmp/po/1/12/123/12/12/12/12/12/123456789 %k%F{blue}%f " "$(build_left_prompt)" + + cd - + rm -fr /tmp/powerlevel9k-test + + unset FOLDER + unset POWERLEVEL9K_SHORTEN_DIR_LENGTH + unset POWERLEVEL9K_SHORTEN_DELIMITER + unset POWERLEVEL9K_SHORTEN_STRATEGY +} + function testTruncateWithFolderMarkerWorks() { POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir) POWERLEVEL9K_SHORTEN_STRATEGY="truncate_with_folder_marker" From e3530de3dc2afc56836f3f2113734e3b42b15f1b Mon Sep 17 00:00:00 2001 From: Diego Rabatone Oliveira Date: Sat, 22 Jul 2017 12:51:39 -0300 Subject: [PATCH 2/5] Fix reference for python icon. While using awesome-terminal-fonts it is recommended to use `\ue63c` to reference python icon instead of `\U1F40D` (that wasn't even working). Ref: https://github.com/gabrielelana/awesome-terminal-fonts/issues/38#issuecomment-302939451 --- functions/icons.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functions/icons.zsh b/functions/icons.zsh index 5e719be1..272de840 100644 --- a/functions/icons.zsh +++ b/functions/icons.zsh @@ -76,7 +76,7 @@ case $POWERLEVEL9K_MODE in VCS_HG_ICON $'\uE1C3 ' #  VCS_SVN_ICON '(svn) ' RUST_ICON '' - PYTHON_ICON $'\U1F40D' # 🐍 + PYTHON_ICON $'\ue63c' #  SWIFT_ICON '' GO_ICON '' PUBLIC_IP_ICON '' @@ -143,7 +143,7 @@ case $POWERLEVEL9K_MODE in VCS_HG_ICON $'\uF0C3 ' #  VCS_SVN_ICON '(svn) ' RUST_ICON $'\uE6A8' #  - PYTHON_ICON $'\U1F40D' # 🐍 + PYTHON_ICON $'\ue63c' #  SWIFT_ICON '' GO_ICON '' PUBLIC_IP_ICON '' From 1ded7c2c902536eb9582cad08b4b69b15d8761a5 Mon Sep 17 00:00:00 2001 From: Giorgi Gzirishvili Date: Fri, 28 Jul 2017 02:50:31 +0400 Subject: [PATCH 3/5] Update OK_ICON weight to march FAIL_ICON Fixes #576. --- functions/icons.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/icons.zsh b/functions/icons.zsh index 272de840..ab4d2bac 100644 --- a/functions/icons.zsh +++ b/functions/icons.zsh @@ -35,7 +35,7 @@ case $POWERLEVEL9K_MODE in TODO_ICON $'\u2611' # ☑ BATTERY_ICON $'\uE894' #  DISK_ICON $'\uE1AE ' #  - OK_ICON $'\u2713' # ✓ + OK_ICON $'\u2714' # ✔ FAIL_ICON $'\u2718' # ✘ SYMFONY_ICON 'SF' NODE_ICON $'\u2B22' # ⬢ @@ -106,7 +106,7 @@ case $POWERLEVEL9K_MODE in TODO_ICON $'\u2611' # ☑ BATTERY_ICON $'\U1F50B' # 🔋 DISK_ICON $'\uF0A0 ' #  - OK_ICON $'\u2713' # ✓ + OK_ICON $'\u2714' # ✔ FAIL_ICON $'\u2718' # ✘ SYMFONY_ICON 'SF' NODE_ICON $'\u2B22' # ⬢ @@ -240,7 +240,7 @@ case $POWERLEVEL9K_MODE in TODO_ICON $'\u2611' # ☑ BATTERY_ICON $'\U1F50B' # 🔋 DISK_ICON $'hdd ' - OK_ICON $'\u2713' # ✓ + OK_ICON $'\u2714' # ✔ FAIL_ICON $'\u2718' # ✘ SYMFONY_ICON 'SF' NODE_ICON $'\u2B22' # ⬢ From 0b298e7df423882ba797b80a4e4b5a9a0546b666 Mon Sep 17 00:00:00 2001 From: Seong Yong-ju Date: Tue, 27 Jun 2017 19:32:24 +0900 Subject: [PATCH 4/5] Fixed an issue of indicator of Vi mode Fixed an issue that the indicator of Vi mode won't appear correctly at first. --- powerlevel9k.zsh-theme | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 26ab9cd5..015fa41e 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -1192,12 +1192,12 @@ set_default POWERLEVEL9K_VI_INSERT_MODE_STRING "INSERT" set_default POWERLEVEL9K_VI_COMMAND_MODE_STRING "NORMAL" prompt_vi_mode() { case ${KEYMAP} in - main|viins) - "$1_prompt_segment" "$0_INSERT" "$2" "$DEFAULT_COLOR" "blue" "$POWERLEVEL9K_VI_INSERT_MODE_STRING" - ;; vicmd) "$1_prompt_segment" "$0_NORMAL" "$2" "$DEFAULT_COLOR" "default" "$POWERLEVEL9K_VI_COMMAND_MODE_STRING" ;; + main|viins|*) + "$1_prompt_segment" "$0_INSERT" "$2" "$DEFAULT_COLOR" "blue" "$POWERLEVEL9K_VI_INSERT_MODE_STRING" + ;; esac } From 99b7ec26b24418329d0ab81f0c649037cc399254 Mon Sep 17 00:00:00 2001 From: Kaleb Elwert Date: Thu, 10 Aug 2017 11:56:12 -0700 Subject: [PATCH 5/5] Add back the prompt_sp option for zsh >= 5.4.1 In 5.4.1, this option was reset between prompts, so to retain the previous default behavior, this should be added back. --- powerlevel9k.zsh-theme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 5bd5f586..b21e2ff4 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -1341,11 +1341,11 @@ prompt_powerlevel9k_setup() { # returns. We need prompt_subst so we can safely run commands in the prompt # without them being double expanded and we need prompt_percent to expand the # common percent escape sequences. - prompt_opts=(subst percent cr) + prompt_opts=(cr percent sp subst) # Borrowed from promptinit, sets the prompt options in case the theme was # not initialized via promptinit. - setopt noprompt{bang,cr,percent,subst} "prompt${^prompt_opts[@]}" + setopt noprompt{bang,cr,percent,sp,subst} "prompt${^prompt_opts[@]}" # Display a warning if the terminal does not support 256 colors local term_colors