summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2014-02-03 23:57:18 +0100
committermathieui <mathieui@mathieui.net>2014-02-03 23:57:18 +0100
commit2b9fb90ca72c7bccf3313949e60cb3727447a40c (patch)
tree2770a279d2aa2f09dc8630c52391284e4e7015d2 /src
parent199ac46d90576062ae21e49cc266d53d1ede8689 (diff)
downloadpoezio-2b9fb90ca72c7bccf3313949e60cb3727447a40c.tar.gz
poezio-2b9fb90ca72c7bccf3313949e60cb3727447a40c.tar.bz2
poezio-2b9fb90ca72c7bccf3313949e60cb3727447a40c.tar.xz
poezio-2b9fb90ca72c7bccf3313949e60cb3727447a40c.zip
Fix #2418 (Wrong character count in input with copy/pasted tabulations)
- Replace tabulations in the input by highlighted “t”s - More readable, and less messy to deal with.
Diffstat (limited to 'src')
-rw-r--r--src/windows.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/windows.py b/src/windows.py
index ff145d13..2c9872e6 100644
--- a/src/windows.py
+++ b/src/windows.py
@@ -43,7 +43,7 @@ from theming import get_theme, to_curses_attr, read_tuple, dump_tuple
FORMAT_CHAR = '\x19'
# These are non-printable chars, so they should never appear in the input, I
# guess. But maybe we can find better chars that are even less reasky.
-format_chars = ['\x0E', '\x0F', '\x10', '\x11', '\x12','\x13', '\x14', '\x15','\x16', '\x17']
+format_chars = ['\x0E', '\x0F', '\x10', '\x11', '\x12','\x13', '\x14', '\x15','\x16', '\x17', '\x18']
allowed_color_digits = ('0', '1', '2', '3', '4', '5', '6', '7')
# msg is a reference to the corresponding Message tuple. text_start and text_end are the position
@@ -1602,7 +1602,7 @@ class Input(Win):
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]
+ 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
@@ -1738,7 +1738,7 @@ class MessageInput(HistoryInput):
Also letting the user enter colors or other text markups
"""
history = list() # The history is common to all MessageInput
- text_attributes = ['b', 'o', 'u', '1', '2', '3', '4', '5', '6', '7']
+ text_attributes = ['b', 'o', 'u', '1', '2', '3', '4', '5', '6', '7', 't']
def __init__(self):
HistoryInput.__init__(self)