Merge branch 'master' into plugins
Conflicts: src/tabs.py src/xhtml.py
This commit is contained in:
commit
b3072bd261
2 changed files with 24 additions and 5 deletions
|
@ -44,6 +44,8 @@ static PyObject *poopt_cut_text(PyObject *self, PyObject *args)
|
||||||
int last_space = -1;
|
int last_space = -1;
|
||||||
int start_pos = 0;
|
int start_pos = 0;
|
||||||
|
|
||||||
|
int w = width; /* this is a width that increases to make the length of char
|
||||||
|
of colors attribute be ignored */
|
||||||
PyObject* retlist = PyList_New(0);
|
PyObject* retlist = PyList_New(0);
|
||||||
|
|
||||||
while (buffer[bpos])
|
while (buffer[bpos])
|
||||||
|
@ -57,7 +59,7 @@ static PyObject *poopt_cut_text(PyObject *self, PyObject *args)
|
||||||
start_pos = spos + 1;
|
start_pos = spos + 1;
|
||||||
last_space = -1;
|
last_space = -1;
|
||||||
}
|
}
|
||||||
else if ((spos - start_pos) >= width)
|
else if ((spos - start_pos) >= w)
|
||||||
{
|
{
|
||||||
if (last_space == -1)
|
if (last_space == -1)
|
||||||
{
|
{
|
||||||
|
@ -72,11 +74,24 @@ static PyObject *poopt_cut_text(PyObject *self, PyObject *args)
|
||||||
start_pos = last_space + 1;
|
start_pos = last_space + 1;
|
||||||
last_space = -1;
|
last_space = -1;
|
||||||
}
|
}
|
||||||
|
w = width;
|
||||||
}
|
}
|
||||||
if (buffer[bpos] == 25) /* \x19 */
|
if (buffer[bpos] == 25) /* \x19 */
|
||||||
{
|
{
|
||||||
spos++;
|
while (buffer[bpos] &&
|
||||||
bpos += 2;
|
buffer[bpos] != 'u' &&
|
||||||
|
buffer[bpos] != 'b' &&
|
||||||
|
buffer[bpos] != 'o' &&
|
||||||
|
buffer[bpos] != '}')
|
||||||
|
{
|
||||||
|
bpos++;
|
||||||
|
spos++;
|
||||||
|
w++;
|
||||||
|
}
|
||||||
|
bpos++;
|
||||||
|
spos++;
|
||||||
|
w++;
|
||||||
|
spos--;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (buffer[bpos] <= 127) /* ASCII char on one byte */
|
if (buffer[bpos] <= 127) /* ASCII char on one byte */
|
||||||
|
|
|
@ -16,7 +16,11 @@ import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import curses
|
import curses
|
||||||
from sleekxmpp.xmlstream import ET
|
from sleekxmpp.xmlstream import ET
|
||||||
|
|
||||||
|
import xml.sax.saxutils
|
||||||
|
|
||||||
from xml.etree.ElementTree import ElementTree
|
from xml.etree.ElementTree import ElementTree
|
||||||
|
|
||||||
from sys import version_info
|
from sys import version_info
|
||||||
|
|
||||||
from config import config
|
from config import config
|
||||||
|
@ -399,7 +403,7 @@ def poezio_colors_to_html(string):
|
||||||
while next_attr_char != -1:
|
while next_attr_char != -1:
|
||||||
attr_char = string[next_attr_char+1].lower()
|
attr_char = string[next_attr_char+1].lower()
|
||||||
if next_attr_char != 0:
|
if next_attr_char != 0:
|
||||||
res += string[:next_attr_char]
|
res += xml.sax.saxutils.escape(string[:next_attr_char])
|
||||||
if attr_char == 'o':
|
if attr_char == 'o':
|
||||||
for elem in opened_elements[::-1]:
|
for elem in opened_elements[::-1]:
|
||||||
res += '</%s>' % (elem,)
|
res += '</%s>' % (elem,)
|
||||||
|
@ -423,7 +427,7 @@ def poezio_colors_to_html(string):
|
||||||
else:
|
else:
|
||||||
string = string[next_attr_char+2:]
|
string = string[next_attr_char+2:]
|
||||||
next_attr_char = string.find('\x19')
|
next_attr_char = string.find('\x19')
|
||||||
res += string
|
res += xml.sax.saxutils.escape(string)
|
||||||
for elem in opened_elements[::-1]:
|
for elem in opened_elements[::-1]:
|
||||||
res += '</%s>' % (elem,)
|
res += '</%s>' % (elem,)
|
||||||
res += "</p></body>"
|
res += "</p></body>"
|
||||||
|
|
Loading…
Reference in a new issue