diff options
author | mathieui <mathieui@mathieui.net> | 2014-04-15 22:57:44 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2014-04-15 22:57:44 +0200 |
commit | a784216196df764e2bb790efe7a799e9cad5588b (patch) | |
tree | 8c5f1a4c013b92cc1f21ad1341055c3eecc1a759 /src/tabs | |
parent | 80ebe9edc041f7950c8858cd6176830c62b11ada (diff) | |
download | poezio-a784216196df764e2bb790efe7a799e9cad5588b.tar.gz poezio-a784216196df764e2bb790efe7a799e9cad5588b.tar.bz2 poezio-a784216196df764e2bb790efe7a799e9cad5588b.tar.xz poezio-a784216196df764e2bb790efe7a799e9cad5588b.zip |
Fix #2440 (highlight composing tabs)
- add a show_composing_tabs option, default value: "direct"
- todo: find a nice different color for this
Diffstat (limited to 'src/tabs')
-rw-r--r-- | src/tabs/basetabs.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/tabs/basetabs.py b/src/tabs/basetabs.py index d4704b79..94b38062 100644 --- a/src/tabs/basetabs.py +++ b/src/tabs/basetabs.py @@ -47,6 +47,7 @@ STATE_COLORS = { 'nonempty': lambda: get_theme().COLOR_TAB_NONEMPTY, 'joined': lambda: get_theme().COLOR_TAB_JOINED, 'message': lambda: get_theme().COLOR_TAB_NEW_MESSAGE, + 'composing': lambda: get_theme().COLOR_TAB_COMPOSING, 'highlight': lambda: get_theme().COLOR_TAB_HIGHLIGHT, 'private': lambda: get_theme().COLOR_TAB_PRIVATE, 'normal': lambda: get_theme().COLOR_TAB_NORMAL, @@ -59,6 +60,7 @@ VERTICAL_STATE_COLORS = { 'nonempty': lambda: get_theme().COLOR_VERTICAL_TAB_NONEMPTY, 'joined': lambda: get_theme().COLOR_VERTICAL_TAB_JOINED, 'message': lambda: get_theme().COLOR_VERTICAL_TAB_NEW_MESSAGE, + 'composing': lambda: get_theme().COLOR_VERTICAL_TAB_COMPOSING, 'highlight': lambda: get_theme().COLOR_VERTICAL_TAB_HIGHLIGHT, 'private': lambda: get_theme().COLOR_VERTICAL_TAB_PRIVATE, 'normal': lambda: get_theme().COLOR_VERTICAL_TAB_NORMAL, @@ -75,6 +77,7 @@ STATE_PRIORITY = { 'disconnected': 0, 'nonempty': 0.1, 'scrolled': 0.5, + 'composing': 0.9, 'message': 1, 'joined': 1, 'highlight': 2, @@ -90,9 +93,9 @@ class Tab(object): def __init__(self): self.input = None self._state = 'normal' + self._prev_state = None self.need_resize = False - self.need_resize = False self.key_func = {} # each tab should add their keys in there # and use them in on_input self.commands = {} # and their own commands @@ -161,6 +164,19 @@ class Tab(object): log.debug('Did not set state because disconnected tabs remain visible') else: self._state = value + if self._state == 'current': + self._prev_state = None + + def save_state(self): + if self._state != 'composing': + self._prev_state = self._state + + def restore_state(self): + if self.state == 'composing' and self._prev_state: + self._state = self._prev_state + self._prev_state = None + elif not self._prev_state: + self._state = 'normal' @staticmethod def resize(scr): |