[openwrt/openwrt] ucode-mod-uline: fix prompt after set_hint with string bigger than the window size

LEDE Commits lede-commits at lists.infradead.org
Mon Feb 24 04:32:03 PST 2025


nbd pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/15c27ce9f0a86635ec336c89fcb11c1d02e46613

commit 15c27ce9f0a86635ec336c89fcb11c1d02e46613
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Mon Feb 24 13:30:36 2025 +0100

    ucode-mod-uline: fix prompt after set_hint with string bigger than the window size
    
    Redraw the prompt after the hint instead of trying to move backwards
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 package/utils/ucode-mod-uline/src/uline.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/package/utils/ucode-mod-uline/src/uline.c b/package/utils/ucode-mod-uline/src/uline.c
index 4bee2597c3..26cea6fa24 100644
--- a/package/utils/ucode-mod-uline/src/uline.c
+++ b/package/utils/ucode-mod-uline/src/uline.c
@@ -880,7 +880,14 @@ void uline_set_hint(struct uline_state *s, const char *str, size_t len)
 		pos_add_string(s, &s->cursor_pos, str, len);
 	}
 
-	set_cursor(s, prev_pos);
+	if (s->cursor_pos.y >= s->rows) {
+		if (s->cursor_pos.x > 0)
+			vt100_next_line(s->output);
+		s->cursor_pos = (struct pos){};
+		s->full_update = true;
+	} else {
+		set_cursor(s, prev_pos);
+	}
 	fflush(s->output);
 }
 




More information about the lede-commits mailing list