summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Ritter <dritter03@googlemail.com>2019-02-02 01:52:56 +0300
committerGitHub <noreply@github.com>2019-02-02 01:52:56 +0300
commit08798d12ad0b7e32423c0eb8623189db180fd094 (patch)
tree641e0d3bd16ec4faaa87d3dbbfed09deafbdb760
parent5c7d1009de08caf7297c099f4ec0cf6d03ae8e6a (diff)
parentf42214e44b8fa00b766ea2839b79160f0e804a34 (diff)
Merge pull request #1147 from dritter/fix_newlines_in_zsh57
Fix newlines in ZSH 5.7
-rwxr-xr-xpowerlevel9k.zsh-theme3
-rwxr-xr-xtest/segments/newline.spec42
2 files changed, 44 insertions, 1 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index 63724823..8cdde608 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -363,7 +363,8 @@ prompt_newline() {
"$1_prompt_segment" \
"$0" \
"$2" \
- "NONE" "NONE" "${newline}"
+ "" "" "${newline}"
+ CURRENT_BG='NONE'
POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS=$lws
}
diff --git a/test/segments/newline.spec b/test/segments/newline.spec
new file mode 100755
index 00000000..7cd00a89
--- /dev/null
+++ b/test/segments/newline.spec
@@ -0,0 +1,42 @@
+#!/usr/bin/env zsh
+#vim:ft=zsh ts=2 sw=2 sts=2 et fenc=utf-8
+
+# Required for shunit2 to run correctly
+setopt shwordsplit
+SHUNIT_PARENT=$0
+
+function setUp() {
+ export TERM="xterm-256color"
+
+ P9K_HOME=$(pwd)
+ ### Test specific
+}
+
+function testNewlineDoesNotCreateExtraSegmentSeparator() {
+ local POWERLEVEL9K_CUSTOM_WORLD1="echo world1"
+ local POWERLEVEL9K_CUSTOM_WORLD2="echo world2"
+ local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world1 newline newline newline custom_world2)
+
+ # Load Powerlevel9k
+ source ${P9K_HOME}/powerlevel9k.zsh-theme
+ local OS="OSX" # Fake OSX
+
+ local newline=$'\n'
+
+ assertEquals "%K{007} %F{000}world1 %k%F{007}%f${newline}%k%f${newline}%k%f${newline}%K{007} %F{000}world2 %k%F{007}%f " "$(build_left_prompt)"
+}
+
+function testNewlineMakesPreviousSegmentEndWell() {
+ local POWERLEVEL9K_CUSTOM_WORLD1="echo world1"
+ local -a POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_world1 newline)
+
+ # Load Powerlevel9k
+ source ${P9K_HOME}/powerlevel9k.zsh-theme
+ local OS="OSX" # Fake OSX
+
+ local newline=$'\n'
+
+ assertEquals "%K{007} %F{000}world1 %k%F{007}%f${newline}%k%F{none}%f " "$(build_left_prompt)"
+}
+
+source shunit2/shunit2 \ No newline at end of file