From 1e6a3b81f3c8fd433403a6e36370ce1b6398a7e5 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Sun, 5 Jun 2016 15:46:19 +0200 Subject: [PATCH] Fix handling cursor move up with unique and empty lines --- ansi2html/converter.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ansi2html/converter.py b/ansi2html/converter.py index fefbff8..3016309 100755 --- a/ansi2html/converter.py +++ b/ansi2html/converter.py @@ -377,11 +377,11 @@ def _collapse_cursor(self, parts): # Go back, deleting every token in the last 'line' if part == CursorMoveUp: - final_parts.pop() - if final_parts: - while '\n' not in final_parts[-1]: - final_parts.pop() + final_parts.pop() + + while final_parts and '\n' not in final_parts[-1]: + final_parts.pop() continue