summaryrefslogtreecommitdiff
path: root/poezio/windows/inputs.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2019-09-22 17:35:07 +0200
committermathieui <mathieui@mathieui.net>2020-05-09 19:46:17 +0200
commit41127e50abc3e126f953af5ad638f92d0848f9f1 (patch)
treeebc7c7a4557e1d005f2bf5a52b84f460342dca63 /poezio/windows/inputs.py
parentd22b4b8c218cbbaee62002d751bd69bfe1d1deab (diff)
downloadpoezio-41127e50abc3e126f953af5ad638f92d0848f9f1.tar.gz
poezio-41127e50abc3e126f953af5ad638f92d0848f9f1.tar.bz2
poezio-41127e50abc3e126f953af5ad638f92d0848f9f1.tar.xz
poezio-41127e50abc3e126f953af5ad638f92d0848f9f1.zip
Move message rendering code to Message.render()
Also: - rename format_chars to FORMAT_CHARS because it’s static constant - move Line, Message, and a few funcs/consts to a new poezio.ui module
Diffstat (limited to 'poezio/windows/inputs.py')
-rw-r--r--poezio/windows/inputs.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/poezio/windows/inputs.py b/poezio/windows/inputs.py
index 84b95599..5cca8803 100644
--- a/poezio/windows/inputs.py
+++ b/poezio/windows/inputs.py
@@ -10,8 +10,9 @@ from typing import List, Dict, Callable, Optional
from poezio import keyboard
from poezio import common
from poezio import poopt
-from poezio.windows.base_wins import Win, format_chars
-from poezio.windows.funcs import find_first_format_char
+from poezio.windows.base_wins import Win
+from poezio.ui.consts import FORMAT_CHARS
+from poezio.ui.funcs import find_first_format_char
from poezio.config import config
from poezio.theming import to_curses_attr
@@ -487,7 +488,7 @@ class Input(Win):
(\x0E to \x19 instead of \x19 + attr). We do not use any }
char in this version
"""
- chars = format_chars + '\n'
+ chars = FORMAT_CHARS + '\n'
if y is not None and x is not None:
self.move(y, x)
format_char = find_first_format_char(text, chars)
@@ -497,7 +498,7 @@ class Input(Win):
if text[format_char] == '\n':
attr_char = '|'
else:
- attr_char = self.text_attributes[format_chars.index(
+ attr_char = self.text_attributes[FORMAT_CHARS.index(
text[format_char])]
self.addstr(text[:format_char])
self.addstr(attr_char, curses.A_REVERSE)
@@ -696,7 +697,7 @@ class MessageInput(HistoryInput):
def cb(attr_char):
if attr_char in self.text_attributes:
- char = format_chars[self.text_attributes.index(attr_char)]
+ char = FORMAT_CHARS[self.text_attributes.index(attr_char)]
self.do_command(char, False)
self.rewrite_text()