summaryrefslogtreecommitdiff
path: root/poezio
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2017-10-14 18:39:50 +0100
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2017-10-14 18:43:26 +0100
commit16bdfdfe8159f3813221b9023b5b49bd6c570863 (patch)
tree73e05dc25485531dd08ff35db3751a7c377f1f4f /poezio
parent256119a574fe37ba38a7aad0fd9952c9069ccfbf (diff)
downloadpoezio-16bdfdfe8159f3813221b9023b5b49bd6c570863.tar.gz
poezio-16bdfdfe8159f3813221b9023b5b49bd6c570863.tar.bz2
poezio-16bdfdfe8159f3813221b9023b5b49bd6c570863.tar.xz
poezio-16bdfdfe8159f3813221b9023b5b49bd6c570863.zip
Add support for italic on ^Ci.
Fixes #2722.
Diffstat (limited to 'poezio')
-rwxr-xr-xpoezio/theming.py2
-rw-r--r--poezio/windows/base_wins.py6
-rw-r--r--poezio/windows/funcs.py2
-rw-r--r--poezio/windows/inputs.py2
-rw-r--r--poezio/xhtml.py2
5 files changed, 13 insertions, 1 deletions
diff --git a/poezio/theming.py b/poezio/theming.py
index 8641ba94..813f8bc0 100755
--- a/poezio/theming.py
+++ b/poezio/theming.py
@@ -445,6 +445,8 @@ def to_curses_attr(color_tuple):
curses_pair = curses_pair | curses.A_BOLD
if 'u' in additional_val:
curses_pair = curses_pair | curses.A_UNDERLINE
+ if 'i' in additional_val:
+ curses_pair = curses_pair | curses.A_ITALIC
if 'a' in additional_val:
curses_pair = curses_pair | curses.A_BLINK
return curses_pair
diff --git a/poezio/windows/base_wins.py b/poezio/windows/base_wins.py
index a9229d32..a009c763 100644
--- a/poezio/windows/base_wins.py
+++ b/poezio/windows/base_wins.py
@@ -95,7 +95,7 @@ class Win(object):
\x191}Bonj\x192}our → 'Bonj' in red and 'our' in green
next_attr_char is the \x19 delimiter
attr_char is the char following it, it can be
- one of 'u', 'b', 'c[0-9]'
+ one of 'u', 'b', 'i', 'c[0-9]'
"""
if y is not None and x is not None:
self.move(y, x)
@@ -113,6 +113,8 @@ class Win(object):
self._win.attron(curses.A_UNDERLINE)
elif attr_char == 'b':
self._win.attron(curses.A_BOLD)
+ elif attr_char == 'i':
+ self._win.attron(curses.A_ITALIC)
if (attr_char in string.digits or attr_char == '-') and attr_char != '':
color_str = text[next_attr_char+1:text.find('}', next_attr_char)]
if ',' in color_str:
@@ -125,6 +127,8 @@ class Win(object):
self._win.attron(curses.A_UNDERLINE)
elif char == 'b':
self._win.attron(curses.A_BOLD)
+ elif char == 'i':
+ self._win.attron(curses.A_ITALIC)
else:
# this will reset previous bold/uderline sequences if any was used
self._win.attroff(curses.A_UNDERLINE)
diff --git a/poezio/windows/funcs.py b/poezio/windows/funcs.py
index 9d596bcc..ea2941c8 100644
--- a/poezio/windows/funcs.py
+++ b/poezio/windows/funcs.py
@@ -43,6 +43,8 @@ def parse_attrs(text, previous=None):
attrs.append('u')
elif attr_char == 'b':
attrs.append('b')
+ elif attr_char == 'i':
+ attrs.append('i')
if attr_char in DIGITS and attr_char:
color_str = text[next_attr_char+1:text.find('}', next_attr_char)]
if color_str:
diff --git a/poezio/windows/inputs.py b/poezio/windows/inputs.py
index ae1440b3..fca12e9d 100644
--- a/poezio/windows/inputs.py
+++ b/poezio/windows/inputs.py
@@ -482,6 +482,8 @@ class Input(Win):
self._win.attron(curses.A_UNDERLINE)
elif attr_char == 'b':
self._win.attron(curses.A_BOLD)
+ elif attr_char == 'i':
+ self._win.attron(curses.A_ITALIC)
elif attr_char in string.digits and attr_char != '':
self._win.attron(to_curses_attr((int(attr_char), -1)))
format_char = find_first_format_char(text, chars)
diff --git a/poezio/xhtml.py b/poezio/xhtml.py
index 836c3868..2f73cd3d 100644
--- a/poezio/xhtml.py
+++ b/poezio/xhtml.py
@@ -531,6 +531,8 @@ def poezio_colors_to_html(string):
check_property('font-weight', 'bold')
elif attr_char == 'u':
check_property('text-decoration', 'underline')
+ elif attr_char == 'i':
+ check_property('font-style', 'italic')
if attr_char in digits:
number_str = string[next_attr_char+1:string.find('}', next_attr_char)]