mirror of
https://github.com/tmux/tmux.git
synced 2024-11-05 02:18:47 +00:00
Implement DECAWM (SM/RM 7) using existing MODE_WRAP flag.
This commit is contained in:
parent
ba3b8ccc1d
commit
a6c4c2cca0
1
TODO
1
TODO
@ -171,7 +171,6 @@ TERMINAL ISSUES
|
|||||||
- support for bce
|
- support for bce
|
||||||
- use screen-256color when started on 256 colour terminal??
|
- use screen-256color when started on 256 colour terminal??
|
||||||
- if-shell/run-shell should block further command execution in the same command
|
- if-shell/run-shell should block further command execution in the same command
|
||||||
- wrap/no wrap esc seq DEC CSI ? 7 h/l
|
|
||||||
* We need a tmux terminfo entry to document the extensions we are using in
|
* We need a tmux terminfo entry to document the extensions we are using in
|
||||||
upstream terminfo. Must NOT change (only add or remove) anything from
|
upstream terminfo. Must NOT change (only add or remove) anything from
|
||||||
TERM=screen so we can fallback!
|
TERM=screen so we can fallback!
|
||||||
|
6
input.c
6
input.c
@ -1248,6 +1248,9 @@ input_csi_dispatch(struct input_ctx *ictx)
|
|||||||
screen_write_cursormove(&ictx->ctx, 0, 0);
|
screen_write_cursormove(&ictx->ctx, 0, 0);
|
||||||
screen_write_clearscreen(&ictx->ctx);
|
screen_write_clearscreen(&ictx->ctx);
|
||||||
break;
|
break;
|
||||||
|
case 7: /* DECAWM */
|
||||||
|
screen_write_mode_clear(&ictx->ctx, MODE_WRAP);
|
||||||
|
break;
|
||||||
case 25: /* TCEM */
|
case 25: /* TCEM */
|
||||||
screen_write_mode_clear(&ictx->ctx, MODE_CURSOR);
|
screen_write_mode_clear(&ictx->ctx, MODE_CURSOR);
|
||||||
break;
|
break;
|
||||||
@ -1305,6 +1308,9 @@ input_csi_dispatch(struct input_ctx *ictx)
|
|||||||
screen_write_cursormove(&ictx->ctx, 0, 0);
|
screen_write_cursormove(&ictx->ctx, 0, 0);
|
||||||
screen_write_clearscreen(&ictx->ctx);
|
screen_write_clearscreen(&ictx->ctx);
|
||||||
break;
|
break;
|
||||||
|
case 7: /* DECAWM */
|
||||||
|
screen_write_mode_set(&ictx->ctx, MODE_WRAP);
|
||||||
|
break;
|
||||||
case 25: /* TCEM */
|
case 25: /* TCEM */
|
||||||
screen_write_mode_set(&ictx->ctx, MODE_CURSOR);
|
screen_write_mode_set(&ictx->ctx, MODE_CURSOR);
|
||||||
break;
|
break;
|
||||||
|
@ -979,10 +979,10 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
|
|||||||
struct screen *s = ctx->s;
|
struct screen *s = ctx->s;
|
||||||
struct grid *gd = s->grid;
|
struct grid *gd = s->grid;
|
||||||
struct tty_ctx ttyctx;
|
struct tty_ctx ttyctx;
|
||||||
u_int width, xx;
|
u_int width, xx, last;
|
||||||
struct grid_cell tmp_gc, *tmp_gcp;
|
struct grid_cell tmp_gc, *tmp_gcp;
|
||||||
struct utf8_data ud;
|
struct utf8_data ud;
|
||||||
int insert = 0;
|
int insert;
|
||||||
|
|
||||||
/* Ignore padding. */
|
/* Ignore padding. */
|
||||||
if (gc->flags & GRID_FLAG_PADDING)
|
if (gc->flags & GRID_FLAG_PADDING)
|
||||||
@ -1020,7 +1020,8 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
|
|||||||
xx = screen_size_x(s) - s->cx - width;
|
xx = screen_size_x(s) - s->cx - width;
|
||||||
grid_move_cells(s->grid, s->cx + width, s->cx, s->cy, xx);
|
grid_move_cells(s->grid, s->cx + width, s->cx, s->cy, xx);
|
||||||
insert = 1;
|
insert = 1;
|
||||||
}
|
} else
|
||||||
|
insert = 0;
|
||||||
|
|
||||||
/* Check this will fit on the current line and wrap if not. */
|
/* Check this will fit on the current line and wrap if not. */
|
||||||
if ((s->mode & MODE_WRAP) && s->cx > screen_size_x(s) - width) {
|
if ((s->mode & MODE_WRAP) && s->cx > screen_size_x(s) - width) {
|
||||||
@ -1028,9 +1029,8 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
|
|||||||
s->cx = 0; /* carriage return */
|
s->cx = 0; /* carriage return */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sanity checks. */
|
/* Sanity check cursor position. */
|
||||||
if (((s->mode & MODE_WRAP) && s->cx > screen_size_x(s) - width)
|
if (s->cx > screen_size_x(s) - width || s->cy > screen_size_y(s) - 1)
|
||||||
|| s->cy > screen_size_y(s) - 1)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Handle overwriting of UTF-8 characters. */
|
/* Handle overwriting of UTF-8 characters. */
|
||||||
@ -1049,8 +1049,15 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
|
|||||||
/* Set the cell. */
|
/* Set the cell. */
|
||||||
grid_view_set_cell(gd, s->cx, s->cy, gc);
|
grid_view_set_cell(gd, s->cx, s->cy, gc);
|
||||||
|
|
||||||
/* Move the cursor. */
|
/*
|
||||||
s->cx += width;
|
* Move the cursor. If not wrapping, stick at the last character and
|
||||||
|
* replace it.
|
||||||
|
*/
|
||||||
|
last = !!(s->mode & MODE_WRAP);
|
||||||
|
if (s->cx <= screen_size_x(s) - last - width)
|
||||||
|
s->cx += width;
|
||||||
|
else
|
||||||
|
s->cx = screen_size_x(s) - last;
|
||||||
|
|
||||||
/* Draw to the screen if necessary. */
|
/* Draw to the screen if necessary. */
|
||||||
if (insert) {
|
if (insert) {
|
||||||
|
Loading…
Reference in New Issue
Block a user