billiob pushed a commit to branch master.
commit 0b6e44bbd6197f52c3cab9e6e9004c5d75bed47d
Author: Boris Faure <[email protected]>
Date: Mon Apr 22 22:27:52 2013 +0200
compat: add margin top support on Origin mode
---
src/bin/termpty.h | 1 +
src/bin/termptyesc.c | 20 +++++++++++++++++---
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/src/bin/termpty.h b/src/bin/termpty.h
index 99b46fa..c0cd9fe 100644
--- a/src/bin/termpty.h
+++ b/src/bin/termpty.h
@@ -78,6 +78,7 @@ struct _Termstate
unsigned char chset[4];
int scroll_y1, scroll_y2;
int had_cr_x, had_cr_y;
+ int margin_top; // soon, more to come...
unsigned int multibyte : 1;
unsigned int alt_kp : 1;
unsigned int insert : 1;
diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c
index aa5ffd7..b08b41a 100644
--- a/src/bin/termptyesc.c
+++ b/src/bin/termptyesc.c
@@ -361,9 +361,9 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c,
Eina_Unicode *ce)
arg--;
if (arg < 0) arg = 0;
else if (arg >= ty->h) arg = ty->h - 1;
- if (b) ty->state.cy = arg;
if (b)
{
+ ty->state.cy = arg;
arg = _csi_arg_get(&b);
if (arg < 1) arg = 1;
arg--;
@@ -373,6 +373,7 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c,
Eina_Unicode *ce)
else if (arg >= ty->w) arg = ty->w - 1;
if (b) ty->state.cx = arg;
}
+ ty->state.cy += ty->state.margin_top;
break;
case 'G': // to column N
arg = _csi_arg_get(&b);
@@ -566,6 +567,8 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c,
Eina_Unicode *ce)
4 + (mode ? 132 : 80)
* w,
4 + 24 * h);
termpty_resize(ty, mode ? 132 : 80, 24);
+ _termpty_reset_state(ty);
+ _termpty_clear_screen(ty,
TERMPTY_CLR_ALL);
}
#endif
break;
@@ -579,9 +582,20 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c,
Eina_Unicode *ce)
break;
case 6:
handled = 1;
- ERR("TODO: origin mode: cursor is at 0,0"
+ if (mode)
+ {
+ ty->state.margin_top = ty->state.cy;
+ ty->state.cx = 0;
+ }
+ else
+ {
+ ty->state.cx = 0;
+ ty->state.margin_top = 0;
+ }
+ DBG("XXX: origin mode (%d): cursor is at 0,0"
"cursor limited to screen/start point"
- " for line #'s depends on top margin");
+ " for line #'s depends on top margin",
+ mode);
break;
case 7:
handled = 1;
--
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev