Add zsh prompt renderer

Zsh can use regular escape sequences in the prompt, but they must be
wrapped in %{...%} to work correctly.

Refs #84.
This commit is contained in:
Kim Silkebækken 2013-01-21 10:49:03 +01:00
parent 0b385a11e0
commit 2eb07e894e
1 changed files with 14 additions and 0 deletions

View File

@ -0,0 +1,14 @@
# -*- coding: utf-8 -*-
from powerline.renderers.shell import ShellRenderer
class ZshPromptRenderer(ShellRenderer):
'''Powerline zsh prompt segment renderer.'''
def hl(self, fg=None, bg=None, attr=None):
'''Highlight a segment.
Returns the default ShellRenderer escape sequence with %{...%} wrapped
around it (required in zsh prompts).
'''
return '%{' + super(ZshPromptRenderer, self).hl(fg, bg, attr) + '%}'