aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/screen.cpp
diff options
context:
space:
mode:
authorGravatar Tom Smeding <tomsmeding@users.noreply.github.com>2016-01-08 23:38:31 +0100
committerGravatar Tom Smeding <tomsmeding@users.noreply.github.com>2016-01-08 23:38:31 +0100
commit4417a6ee34e74362a8b95b1ac306bf965b565226 (patch)
tree12c4ac6b18678e36a5220e00f29ac1504adfb29c /src/screen.cpp
parent2a4f21cc9247968f81032b25f74143279e11ce57 (diff)
Prevent line-full-of-spaces in s_reset
If you have a prompt preceded by a new line, you'll get a line full of spaces instead of an empty line above your prompt. This doesn't make a difference in normal usage, but copying and pasting your terminal log becomes a pain. This commit clears that line, making it an actual empty line.
Diffstat (limited to 'src/screen.cpp')
-rw-r--r--src/screen.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/screen.cpp b/src/screen.cpp
index e248079a..dc78d227 100644
--- a/src/screen.cpp
+++ b/src/screen.cpp
@@ -1448,6 +1448,7 @@ void s_reset(screen_t *s, screen_reset_mode_t mode)
// now we are certainly on a new line. But we may have dropped the omitted newline char on it. So append enough spaces to overwrite the omitted newline char, and then
abandon_line_string.append(non_space_width, L' ');
abandon_line_string.push_back(L'\r');
+ abandon_line_string.append(L"\x1b[2K"); //clear all the spaces from the new line
const std::string narrow_abandon_line_string = wcs2string(abandon_line_string);
write_loop(STDOUT_FILENO, narrow_abandon_line_string.c_str(), narrow_abandon_line_string.size());