Flush draw buf at end of each parse call
This commit is contained in:
@@ -70,7 +70,12 @@ class Boss(Thread):
|
||||
def dump_commands(self, *a):
|
||||
if a:
|
||||
if a[0] == 'draw':
|
||||
self.draw_dump_buf.append(a[1])
|
||||
if a[1] is None:
|
||||
if self.draw_dump_buf:
|
||||
print('draw', ''.join(self.draw_dump_buf))
|
||||
self.draw_dump_buf = []
|
||||
else:
|
||||
self.draw_dump_buf.append(a[1])
|
||||
else:
|
||||
if self.draw_dump_buf:
|
||||
print('draw', ''.join(self.draw_dump_buf))
|
||||
|
||||
@@ -69,6 +69,9 @@ static void _report_error(PyObject *dump_callback, const char *fmt, ...) {
|
||||
#define REPORT_DRAW(ch) \
|
||||
Py_XDECREF(PyObject_CallFunction(dump_callback, "sC", "draw", ch)); PyErr_Clear();
|
||||
|
||||
#define FLUSH_DRAW \
|
||||
Py_XDECREF(PyObject_CallFunction(dump_callback, "sO", "draw", Py_None)); PyErr_Clear();
|
||||
|
||||
#define REPORT_OSC(name, string) \
|
||||
Py_XDECREF(PyObject_CallFunction(dump_callback, "sO", #name, string)); PyErr_Clear();
|
||||
|
||||
@@ -80,6 +83,7 @@ static void _report_error(PyObject *dump_callback, const char *fmt, ...) {
|
||||
|
||||
#define REPORT_COMMAND(...)
|
||||
#define REPORT_DRAW(ch)
|
||||
#define FLUSH_DRAW
|
||||
#define REPORT_OSC(name, string)
|
||||
|
||||
#endif
|
||||
@@ -562,6 +566,7 @@ _parse_bytes(Screen *screen, uint8_t *buf, Py_ssize_t len, PyObject DUMP_UNUSED
|
||||
break;
|
||||
}
|
||||
}
|
||||
FLUSH_DRAW;
|
||||
#undef HANDLE
|
||||
}
|
||||
// }}}
|
||||
|
||||
@@ -52,7 +52,8 @@ class TestParser(BaseTest):
|
||||
q = []
|
||||
for args in cd:
|
||||
if args[0] == 'draw':
|
||||
current += args[1]
|
||||
if args[1] is not None:
|
||||
current += args[1]
|
||||
else:
|
||||
if current:
|
||||
q.append(('draw', current))
|
||||
|
||||
Reference in New Issue
Block a user