aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2018-12-09 17:46:14 +0100
committerBoris Faure <billiob@gmail.com>2018-12-27 22:14:44 +0100
commitfeb7495fbb9a221367d77f39da3557dd74fa1d14 (patch)
tree9545327c894749d3b7b7782c8908e31a900f2b53 /src
parenttermptyesc: act like xterm, do not report title/icon-name (diff)
downloadterminology-feb7495fbb9a221367d77f39da3557dd74fa1d14.tar.gz
termptyesc: DSR-CPR takes cursor restriction into account + test
Diffstat (limited to 'src')
-rw-r--r--src/bin/termptyesc.c58
1 files changed, 33 insertions, 25 deletions
diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c
index fb78cc5..23adab5 100644
--- a/src/bin/termptyesc.c
+++ b/src/bin/termptyesc.c
@@ -956,6 +956,7 @@ _handle_esc_csi_dsr(Termpty *ty, Eina_Unicode *b)
{
int arg, len;
char bf[32];
+ Eina_Bool question_mark = EINA_FALSE;
if (*b == '>')
{
@@ -964,35 +965,42 @@ _handle_esc_csi_dsr(Termpty *ty, Eina_Unicode *b)
}
if (*b == '?')
{
+ question_mark = EINA_TRUE;
b++;
- arg = _csi_arg_get(&b);
- switch (arg)
- {
- case 6:
- len = snprintf(bf, sizeof(bf), "\033[?%d;%d;1R",
- ty->cursor_state.cy + 1,
- ty->cursor_state.cx + 1);
- termpty_write(ty, bf, len);
- break;
- default:
- WRN("unhandled DSR (dec specific) %d", arg);
- break;
- }
}
- else
+ arg = _csi_arg_get(&b);
+ switch (arg)
{
- arg = _csi_arg_get(&b);
- switch (arg)
- {
- case 6:
- len = snprintf(bf, sizeof(bf), "\033[%d;%dR",
- ty->cursor_state.cy + 1, ty->cursor_state.cx + 1);
+ case 6:
+ {
+ int cx = ty->cursor_state.cx,
+ cy = ty->cursor_state.cy;
+ if (ty->termstate.restrict_cursor)
+ {
+ if (ty->termstate.top_margin)
+ cy -= ty->termstate.top_margin;
+ if (ty->termstate.left_margin)
+ cx -= ty->termstate.left_margin;
+ }
+ if (question_mark)
+ {
+ len = snprintf(bf, sizeof(bf), "\033[?%d;%d;1R",
+ cy + 1,
+ cx + 1);
+ }
+ else
+ {
+ len = snprintf(bf, sizeof(bf), "\033[%d;%dR",
+ cy + 1,
+ cx + 1);
+ }
termpty_write(ty, bf, len);
- break;
- default:
- WRN("unhandled DSR %d", arg);
- break;
- }
+ }
+ break;
+ default:
+ WRN("unhandled DSR (dec specific: %s) %d",
+ (question_mark)? "yes": "no", arg);
+ break;
}
}