summaryrefslogtreecommitdiff
path: root/src/windows/inputs.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/windows/inputs.py')
-rw-r--r--src/windows/inputs.py51
1 files changed, 26 insertions, 25 deletions
diff --git a/src/windows/inputs.py b/src/windows/inputs.py
index 8e1673e1..d345443b 100644
--- a/src/windows/inputs.py
+++ b/src/windows/inputs.py
@@ -8,9 +8,10 @@ log = logging.getLogger(__name__)
import curses
import string
+import keyboard
import common
import poopt
-from . import Win, g_lock
+from . import Win
from . base_wins import format_chars
from . funcs import find_first_format_char
from config import config
@@ -494,25 +495,24 @@ class Input(Win):
length of text to display, and the position of the cursor.
"""
self.adjust_view_pos()
- with g_lock:
- text = self.text
- self._win.erase()
- if self.color:
- self._win.attron(to_curses_attr(self.color))
- displayed_text = text[self.view_pos:self.view_pos+self.width-1].replace('\t', '\x18')
- self._win.attrset(0)
- self.addstr_colored_lite(displayed_text)
- # Fill the rest of the line with the input color
- if self.color:
- (_, x) = self._win.getyx()
- size = self.width - x
- self.addnstr(' ' * size, size, to_curses_attr(self.color))
- self.addstr(0,
- poopt.wcswidth(displayed_text[:self.pos-self.view_pos]), '')
- if self.color:
- self._win.attroff(to_curses_attr(self.color))
- curses.curs_set(1)
- self._refresh()
+ text = self.text
+ self._win.erase()
+ if self.color:
+ self._win.attron(to_curses_attr(self.color))
+ displayed_text = text[self.view_pos:self.view_pos+self.width-1].replace('\t', '\x18')
+ self._win.attrset(0)
+ self.addstr_colored_lite(displayed_text)
+ # Fill the rest of the line with the input color
+ if self.color:
+ (_, x) = self._win.getyx()
+ size = self.width - x
+ self.addnstr(' ' * size, size, to_curses_attr(self.color))
+ self.addstr(0,
+ poopt.wcswidth(displayed_text[:self.pos-self.view_pos]), '')
+ if self.color:
+ self._win.attroff(to_curses_attr(self.color))
+ curses.curs_set(1)
+ self._refresh()
def adjust_view_pos(self):
"""
@@ -656,11 +656,12 @@ class MessageInput(HistoryInput):
"""
Read one more char (c), add the corresponding char from formats_char to the text string
"""
- attr_char = self.core.read_keyboard()[0]
- if attr_char in self.text_attributes:
- char = format_chars[self.text_attributes.index(attr_char)]
- self.do_command(char, False)
- self.rewrite_text()
+ def cb(attr_char):
+ if attr_char in self.text_attributes:
+ char = format_chars[self.text_attributes.index(attr_char)]
+ self.do_command(char, False)
+ self.rewrite_text()
+ keyboard.continuation_keys_callback = cb
def key_enter(self):
if self.history_enter():