aboutsummaryrefslogtreecommitdiff
path: root/screen-write.c
diff options
context:
space:
mode:
Diffstat (limited to 'screen-write.c')
-rw-r--r--screen-write.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/screen-write.c b/screen-write.c
index 5010e4fd..11b387a6 100644
--- a/screen-write.c
+++ b/screen-write.c
@@ -1,4 +1,4 @@
-/* $Id: screen-write.c,v 1.75 2009-10-15 01:35:35 tcunha Exp $ */
+/* $Id: screen-write.c,v 1.76 2009-10-15 01:39:30 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -513,6 +513,25 @@ screen_write_cursorleft(struct screen_write_ctx *ctx, u_int nx)
s->cx -= nx;
}
+/* Backspace; cursor left unless at start of wrapped line when can move up. */
+void
+screen_write_backspace(struct screen_write_ctx *ctx)
+{
+ struct screen *s = ctx->s;
+ struct grid_line *gl;
+
+ if (s->cx == 0) {
+ if (s->cy == 0)
+ return;
+ gl = &s->grid->linedata[s->grid->hsize + s->cy - 1];
+ if (gl->flags & GRID_LINE_WRAPPED) {
+ s->cy--;
+ s->cx = screen_size_x(s) - 1;
+ }
+ } else
+ s->cx--;
+}
+
/* VT100 alignment test. */
void
screen_write_alignmenttest(struct screen_write_ctx *ctx)
@@ -536,6 +555,7 @@ screen_write_alignmenttest(struct screen_write_ctx *ctx)
s->cy = 0;
s->rupper = 0;
+
s->rlower = screen_size_y(s) - 1;
tty_write(tty_cmd_alignmenttest, &ttyctx);