From 289a08c539f61af24bd13eb631f1a26ac1c0db31 Mon Sep 17 00:00:00 2001 From: ZyX Date: Wed, 27 Aug 2014 22:04:48 +0400 Subject: [PATCH] Replace .replace(' ', NBSP) call with self.escape call Dividers need to be escaped as well. Fixes #1027 --- powerline/renderer.py | 2 +- tests/test_shells/bash.daemon.ok | 3 ++- tests/test_shells/bash.nodaemon.ok | 3 ++- tests/test_shells/busybox.daemon.ok | 3 ++- tests/test_shells/busybox.nodaemon.ok | 3 ++- tests/test_shells/dash.daemon.ok | 3 ++- tests/test_shells/dash.nodaemon.ok | 3 ++- tests/test_shells/input.bash | 1 + tests/test_shells/input.busybox | 1 + tests/test_shells/input.dash | 1 + tests/test_shells/input.mksh | 1 + tests/test_shells/input.zsh | 1 + tests/test_shells/ipython.ok | 20 ++++++++++---------- tests/test_shells/mksh.daemon.ok | 3 ++- tests/test_shells/mksh.nodaemon.ok | 3 ++- tests/test_shells/zsh.daemon.ok | 3 ++- tests/test_shells/zsh.nodaemon.ok | 3 ++- 17 files changed, 36 insertions(+), 21 deletions(-) diff --git a/powerline/renderer.py b/powerline/renderer.py index b129a710..b4a3e9a6 100644 --- a/powerline/renderer.py +++ b/powerline/renderer.py @@ -385,7 +385,7 @@ class Renderer(object): # Pad segments first if draw_divider: - divider_raw = theme.get_divider(side, divider_type).replace(' ', NBSP) + divider_raw = self.escape(theme.get_divider(side, divider_type)) if side == 'left': contents_raw = ( outer_padding + (segment['_space_left'] * ' ') diff --git a/tests/test_shells/bash.daemon.ok b/tests/test_shells/bash.daemon.ok index 1354b641..e9132e60 100644 --- a/tests/test_shells/bash.daemon.ok +++ b/tests/test_shells/bash.daemon.ok @@ -25,4 +25,5 @@ def   BRANCH  ⋯  shell  3rd  #[bold]  cd ../'(echo)'   BRANCH  ⋯  shell  3rd  (echo)  cd ../'$(echo)'   BRANCH  ⋯  shell  3rd  $(echo)  cd ../'`echo`' -  BRANCH  ⋯  shell  3rd  `echo`  false +  BRANCH  ⋯  shell  3rd  `echo`  POWERLINE_COMMAND="$POWERLINE_COMMAND -t default_leftonly.dividers.left.hard=\$ABC" +  BRANCH $ABC⋯  shell  3rd  `echo` $ABCfalse diff --git a/tests/test_shells/bash.nodaemon.ok b/tests/test_shells/bash.nodaemon.ok index cb0f6b6d..09b21b5c 100644 --- a/tests/test_shells/bash.nodaemon.ok +++ b/tests/test_shells/bash.nodaemon.ok @@ -25,4 +25,5 @@ def   BRANCH  ⋯  shell  3rd  #[bold]  cd ../'(echo)'   BRANCH  ⋯  shell  3rd  (echo)  cd ../'$(echo)'   BRANCH  ⋯  shell  3rd  $(echo)  cd ../'`echo`' -  BRANCH  ⋯  shell  3rd  `echo`  false +  BRANCH  ⋯  shell  3rd  `echo`  POWERLINE_COMMAND="$POWERLINE_COMMAND -t default_leftonly.dividers.left.hard=\$ABC" +  BRANCH $ABC⋯  shell  3rd  `echo` $ABCfalse diff --git a/tests/test_shells/busybox.daemon.ok b/tests/test_shells/busybox.daemon.ok index 4a5bf072..60939a71 100644 --- a/tests/test_shells/busybox.daemon.ok +++ b/tests/test_shells/busybox.daemon.ok @@ -24,4 +24,5 @@ def   BRANCH  ⋯  shell  3rd  #[bold]  cd ../'(echo)'   BRANCH  ⋯  shell  3rd  (echo)  cd ../'$(echo)'   BRANCH  ⋯  shell  3rd  $(echo)  cd ../'`echo`' -  BRANCH  ⋯  shell  3rd  `echo`  false +  BRANCH  ⋯  shell  3rd  `echo`  POWERLINE_COMMAND="$POWERLINE_COMMAND -t default_leftonly.dividers.left.hard=\$ABC" +  BRANCH $ABC⋯  shell  3rd  `echo` $ABCfalse diff --git a/tests/test_shells/busybox.nodaemon.ok b/tests/test_shells/busybox.nodaemon.ok index 1f6f7449..b3a90542 100644 --- a/tests/test_shells/busybox.nodaemon.ok +++ b/tests/test_shells/busybox.nodaemon.ok @@ -24,4 +24,5 @@ def   BRANCH  ⋯  shell  3rd  #[bold]  cd ../'(echo)'   BRANCH  ⋯  shell  3rd  (echo)  cd ../'$(echo)'   BRANCH  ⋯  shell  3rd  $(echo)  cd ../'`echo`' -  BRANCH  ⋯  shell  3rd  `echo`  false +  BRANCH  ⋯  shell  3rd  `echo`  POWERLINE_COMMAND="$POWERLINE_COMMAND -t default_leftonly.dividers.left.hard=\$ABC" +  BRANCH $ABC⋯  shell  3rd  `echo` $ABCfalse diff --git a/tests/test_shells/dash.daemon.ok b/tests/test_shells/dash.daemon.ok index bbf3de59..93b364ed 100644 --- a/tests/test_shells/dash.daemon.ok +++ b/tests/test_shells/dash.daemon.ok @@ -23,4 +23,5 @@ def   BRANCH  ⋯  shell  3rd  #[bold]  cd ../'(echo)'   BRANCH  ⋯  shell  3rd  (echo)  cd ../'$(echo)'   BRANCH  ⋯  shell  3rd  $(echo)  cd ../'`echo`' -  BRANCH  ⋯  shell  3rd  `echo`  false +  BRANCH  ⋯  shell  3rd  `echo`  POWERLINE_COMMAND="$POWERLINE_COMMAND -t default_leftonly.dividers.left.hard=\$ABC" +  BRANCH $ABC⋯  shell  3rd  `echo` $ABCfalse diff --git a/tests/test_shells/dash.nodaemon.ok b/tests/test_shells/dash.nodaemon.ok index 3a81cfcc..79770982 100644 --- a/tests/test_shells/dash.nodaemon.ok +++ b/tests/test_shells/dash.nodaemon.ok @@ -23,4 +23,5 @@ def   BRANCH  ⋯  shell  3rd  #[bold]  cd ../'(echo)'   BRANCH  ⋯  shell  3rd  (echo)  cd ../'$(echo)'   BRANCH  ⋯  shell  3rd  $(echo)  cd ../'`echo`' -  BRANCH  ⋯  shell  3rd  `echo`  false +  BRANCH  ⋯  shell  3rd  `echo`  POWERLINE_COMMAND="$POWERLINE_COMMAND -t default_leftonly.dividers.left.hard=\$ABC" +  BRANCH $ABC⋯  shell  3rd  `echo` $ABCfalse diff --git a/tests/test_shells/input.bash b/tests/test_shells/input.bash index e2d69dfa..7e503679 100644 --- a/tests/test_shells/input.bash +++ b/tests/test_shells/input.bash @@ -25,6 +25,7 @@ cd ../'#[bold]' cd ../'(echo)' cd ../'$(echo)' cd ../'`echo`' +POWERLINE_COMMAND="$POWERLINE_COMMAND -t default_leftonly.dividers.left.hard=\$ABC" false true is the last line exit diff --git a/tests/test_shells/input.busybox b/tests/test_shells/input.busybox index b5e94004..803bd5c1 100644 --- a/tests/test_shells/input.busybox +++ b/tests/test_shells/input.busybox @@ -25,6 +25,7 @@ cd ../'#[bold]' cd ../'(echo)' cd ../'$(echo)' cd ../'`echo`' +POWERLINE_COMMAND="$POWERLINE_COMMAND -t default_leftonly.dividers.left.hard=\$ABC" false true is the last line exit diff --git a/tests/test_shells/input.dash b/tests/test_shells/input.dash index b5e94004..803bd5c1 100644 --- a/tests/test_shells/input.dash +++ b/tests/test_shells/input.dash @@ -25,6 +25,7 @@ cd ../'#[bold]' cd ../'(echo)' cd ../'$(echo)' cd ../'`echo`' +POWERLINE_COMMAND="$POWERLINE_COMMAND -t default_leftonly.dividers.left.hard=\$ABC" false true is the last line exit diff --git a/tests/test_shells/input.mksh b/tests/test_shells/input.mksh index 4ac08441..ae6bc326 100644 --- a/tests/test_shells/input.mksh +++ b/tests/test_shells/input.mksh @@ -26,6 +26,7 @@ cd ../'#[bold]' cd ../'(echo)' cd ../'$(echo)' cd ../'`echo`' +POWERLINE_COMMAND="$POWERLINE_COMMAND -t default_leftonly.dividers.left.hard=\$ABC" false true is the last line exit diff --git a/tests/test_shells/input.zsh b/tests/test_shells/input.zsh index f31af608..56bbfc49 100644 --- a/tests/test_shells/input.zsh +++ b/tests/test_shells/input.zsh @@ -40,6 +40,7 @@ do done 1 hash -d foo=$PWD:h ; cd . +POWERLINE_COMMAND=( $POWERLINE_COMMAND -t default.dividers.left.hard=\$ABC ) true true is the last line exit diff --git a/tests/test_shells/ipython.ok b/tests/test_shells/ipython.ok index 2de654fc..166604df 100644 --- a/tests/test_shells/ipython.ok +++ b/tests/test_shells/ipython.ok @@ -1,14 +1,14 @@ - In [2]  bool 42 - 2>  bool(42) - Out[2]  True + In [2]  bool 42 + 2>  bool(42) + Out[2]  True - In [3]  bool 44 - 3>  bool(44) - Out[3]  True + In [3]  bool 44 + 3>  bool(44) + Out[3]  True - In [4]  class Test(object): -   pass -   + In [4]  class Test(object): +   pass +   - In [5]  exit + In [5]  exit diff --git a/tests/test_shells/mksh.daemon.ok b/tests/test_shells/mksh.daemon.ok index 569a62e2..be403a46 100644 --- a/tests/test_shells/mksh.daemon.ok +++ b/tests/test_shells/mksh.daemon.ok @@ -27,4 +27,5 @@ def   BRANCH  ⋯  shell  3rd  #[bold]  cd ../'(echo)'   BRANCH  ⋯  shell  3rd  (echo)  cd ../'$(echo)'   BRANCH  ⋯  shell  3rd  $(echo)  cd ../'`echo`' -  BRANCH  ⋯  shell  3rd  `echo`  false +  BRANCH  ⋯  shell  3rd  `echo`  POWERLINE_COMMAND="$POWERLINE_COMMAND -t default_leftonly.dividers.left.hard=\$ABC" +  BRANCH $ABC⋯  shell  3rd  `echo` $ABCfalse diff --git a/tests/test_shells/mksh.nodaemon.ok b/tests/test_shells/mksh.nodaemon.ok index a6d94036..d152cde7 100644 --- a/tests/test_shells/mksh.nodaemon.ok +++ b/tests/test_shells/mksh.nodaemon.ok @@ -27,4 +27,5 @@ def   BRANCH  ⋯  shell  3rd  #[bold]  cd ../'(echo)'   BRANCH  ⋯  shell  3rd  (echo)  cd ../'$(echo)'   BRANCH  ⋯  shell  3rd  $(echo)  cd ../'`echo`' -  BRANCH  ⋯  shell  3rd  `echo`  false +  BRANCH  ⋯  shell  3rd  `echo`  POWERLINE_COMMAND="$POWERLINE_COMMAND -t default_leftonly.dividers.left.hard=\$ABC" +  BRANCH $ABC⋯  shell  3rd  `echo` $ABCfalse diff --git a/tests/test_shells/zsh.daemon.ok b/tests/test_shells/zsh.daemon.ok index 277e4ca5..2e5d05d9 100644 --- a/tests/test_shells/zsh.daemon.ok +++ b/tests/test_shells/zsh.daemon.ok @@ -34,4 +34,5 @@ abc                    Select variant  1 def  INSERT  ⋯  tests  shell  3rd  hash -d foo=$PWD:h ; cd . - INSERT  ~foo  3rd  true + INSERT  ~foo  3rd  POWERLINE_COMMAND=( $POWERLINE_COMMAND -t default.dividers.left.hard=\$ABC ) + INSERT $ABC~foo  3rd $ABCtrue diff --git a/tests/test_shells/zsh.nodaemon.ok b/tests/test_shells/zsh.nodaemon.ok index 9853d9b6..27a734a3 100644 --- a/tests/test_shells/zsh.nodaemon.ok +++ b/tests/test_shells/zsh.nodaemon.ok @@ -34,4 +34,5 @@ abc  Select variant  1 def  INSERT  ⋯  tests  shell  3rd  hash -d foo=$PWD:h ; cd . - INSERT  ~foo  3rd  true + INSERT  ~foo  3rd  POWERLINE_COMMAND=( $POWERLINE_COMMAND -t default.dividers.left.hard=\$ABC ) + INSERT $ABC~foo  3rd $ABCtrue