---
Feedback rightfully indicated I should use strlen() rather than sizeof()
to avoid writing an unintentional null byte to the tty.
st.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/st.c b/st.c
index 34c27ad..603cf95 100644
--- a/st.c
+++ b/st.c
_AT_@ -1769,11 +1769,18 @@ csihandle(void)
case 'm': /* SGR -- Terminal attribute (color) */
tsetattr(csiescseq.arg, csiescseq.narg);
break;
- case 'n': /* DSR – Device Status Report (cursor position) */
- if (csiescseq.arg[0] == 6) {
+ case 'n': /* DSR – Device Status Report */
+ switch (csiescseq.arg[0]) {
+ case 5: /* Status Report "OK" `0n` */
+ ttywrite("\033[0n", strlen("\033[0n"), 0);
+ break;
+ case 6: /* Report Cursor Position (CPR) `<row>;<column>R` */
len = snprintf(buf, sizeof(buf), "\033[%i;%iR",
term.c.y+1, term.c.x+1);
ttywrite(buf, len, 0);
+ break;
+ default:
+ goto unknown;
}
break;
case 'r': /* DECSTBM -- Set Scrolling Region */
--
2.39.1
Received on Tue Feb 07 2023 - 17:02:28 CET
This archive was generated by hypermail 2.3.0 : Wed Feb 08 2023 - 20:24:35 CET