diff --git a/user/ansi_parser_callbacks.c b/user/ansi_parser_callbacks.c index ec74486..3d8028e 100644 --- a/user/ansi_parser_callbacks.c +++ b/user/ansi_parser_callbacks.c @@ -261,6 +261,9 @@ apars_handle_CSI(char leadchar, int *params, int count, char keychar) if (n == 4) { screen_set_insert_mode(yn); } + else if (n == 20) { + screen_set_newline_mode(yn); + } else { // ansi_warn("NOIMPL flag %d", n); } diff --git a/user/screen.c b/user/screen.c index 29a101b..e74aa64 100644 --- a/user/screen.c +++ b/user/screen.c @@ -39,6 +39,8 @@ static struct { bool numpad_alt_mode; //!< Application Mode - affects how user input of control keys is sent bool cursors_alt_mode; //!< Application mode for cursor keys + bool newline_mode; + char charset0; char charset1; } scr; @@ -194,6 +196,7 @@ screen_reset(void) scr.numpad_alt_mode = false; scr.cursors_alt_mode = false; + scr.newline_mode = false; scr.charset0 = 'B'; scr.charset1 = '0'; @@ -701,6 +704,13 @@ screen_set_cursors_alt_mode(bool alt_mode) scr.cursors_alt_mode = alt_mode; NOTIFY_DONE(); } + +void ICACHE_FLASH_ATTR +screen_set_newline_mode(bool nlm) +{ + scr.newline_mode = nlm; +} + //endregion //region --- Printing --- @@ -720,6 +730,10 @@ screen_putchar(const char *ch) switch (ch[0]) { case '\r': screen_cursor_set_x(0); + if (scr.newline_mode) { + // like LF + screen_cursor_move(1, 0, true); + } goto done; case '\n': diff --git a/user/screen.h b/user/screen.h index b174af2..467cd0b 100644 --- a/user/screen.h +++ b/user/screen.h @@ -167,6 +167,8 @@ void screen_cursor_restore(bool withAttrs); void screen_cursor_visible(bool visible); /** Enable auto wrap */ void screen_wrap_enable(bool enable); +/** Enable CR auto */ +void screen_set_newline_mode(bool nlm); // --- Colors ---