diff options
| author | _ov4 <ov4@ov4.org> | 2026-09-22 02:00:52 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-09-22 02:00:52 +0000 |
| commit | ab02942670f37520833bc7dc8d0ff55d94eda7d7 (patch) | |
| tree | b958654b064e6a9fdaafbd27639169d88caf15bb /src/line | |
| parent | a025219a21254c8970e19a90bf31148d351f6579 (diff) | |
add print_override
Diffstat (limited to 'src/line')
| -rw-r--r-- | src/line/mode.cc | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/line/mode.cc b/src/line/mode.cc index 83eda67..9eb54b1 100644 --- a/src/line/mode.cc +++ b/src/line/mode.cc @@ -71,7 +71,7 @@ string readline() { clear_below(); } - else if (c == 'R') + else if (c == 'P') { get_cursor_position(); } @@ -87,9 +87,14 @@ string readline() } else { - print("{}", c); buffer += c; - fflush(stdout); + print_override(buffer); + + // esc sequence + if (buffer.size() <= 2 && buffer[0] == '\x1b' && buffer[1] == '[') + { + ; + } } } return buffer; @@ -127,4 +132,12 @@ T_position get_cursor_position() return pos; } +void print_override(const std::string &s) +{ + print("\r"); + fflush(stdout); + print("{}", s); + fflush(stdout); +} + } |
