Move IPython prompt and rcsh renderers into a separate module

Some applications that use readline use same variants of telling it where
highlighting starts and ends. This module will also be used for pdb.
This commit is contained in:
ZyX 2015-01-27 20:13:19 +03:00
parent cddfc364c1
commit f5d96743fe
4 changed files with 20 additions and 11 deletions

View File

@ -15,7 +15,7 @@ fn _powerline_continuation_prompt {
_powerline_prompt --renderer-arg 'local_theme=continuation' $*
}
fn _powerline_prompt {
$POWERLINE_COMMAND $POWERLINE_COMMAND_ARGS shell aboveleft -r.rcsh --last-pipe-status $^_POWERLINE_STATUS --last-exit-code $_POWERLINE_STATUS($#_POWERLINE_STATUS) --jobnum $_POWERLINE_JOBNUM --renderer-arg 'client_id='$pid $*
$POWERLINE_COMMAND $POWERLINE_COMMAND_ARGS shell aboveleft -r.readline --last-pipe-status $^_POWERLINE_STATUS --last-exit-code $_POWERLINE_STATUS($#_POWERLINE_STATUS) --jobnum $_POWERLINE_JOBNUM --renderer-arg 'client_id='$pid $*
}
fn _powerline_set_prompt {
_POWERLINE_STATUS = ( $status )

View File

@ -2,6 +2,7 @@
from __future__ import (unicode_literals, division, absolute_import, print_function)
from powerline.renderers.shell import ShellRenderer
from powerline.renderers.shell.readline import ReadlineRenderer
from powerline.theme import Theme
@ -45,10 +46,9 @@ class IPythonRenderer(ShellRenderer):
)
class IPythonPromptRenderer(IPythonRenderer):
class IPythonPromptRenderer(IPythonRenderer, ReadlineRenderer):
'''Powerline ipython prompt (in and in2) renderer'''
escape_hl_start = '\x01'
escape_hl_end = '\x02'
pass
class IPythonNonPromptRenderer(IPythonRenderer):

View File

@ -1,12 +1,7 @@
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
from powerline.renderers.shell import ShellRenderer
from powerline.renderers.shell.readline import ReadlineRenderer
class RcshRenderer(ShellRenderer):
'''Powerline rcsh prompt renderer'''
escape_hl_start = '\x01'
escape_hl_end = '\x02'
renderer = RcshRenderer
renderer = ReadlineRenderer

View File

@ -0,0 +1,14 @@
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
from powerline.renderers.shell import ShellRenderer
class ReadlineRenderer(ShellRenderer):
'''Renderer useful for some applications that use readline
'''
escape_hl_start = '\x01'
escape_hl_end = '\x02'
renderer = ReadlineRenderer