Draw vertical line on the right when window size is limited.

This commit is contained in:
Nicholas Marriott 2009-03-31 18:39:45 +00:00
parent 9bdba2e84f
commit 6c27f1c335
4 changed files with 44 additions and 13 deletions

10
CHANGES
View File

@ -1,3 +1,11 @@
31 March 2009
* Draw a vertical line on the right when the window size is less than the
terminal size. This is partly to shake out any horizontal limit bugs on the
way to horizontal splitting/pane tiling. Currently a bit slow since it has to
do a lot of redrawing but hopefully that will improve as I get some better
ideas for how to do it.
28 March 2009
* Better UTF-8 support, including combined characters. Unicode data is now
@ -1160,7 +1168,7 @@
(including mutt, emacs). No status bar yet and no key remapping or other
customisation.
$Id: CHANGES,v 1.263 2009-03-28 20:17:29 nicm Exp $
$Id: CHANGES,v 1.264 2009-03-31 18:39:45 nicm Exp $
LocalWords: showw utf UTF fulvio ciriaco joshe OSC APC gettime abc DEF OA clr
LocalWords: rivo nurges lscm Erdely eol smysession mysession ek dstname RB ms

2
TODO
View File

@ -83,6 +83,8 @@
- better support for stupid margin terminals. strcmp for cons25 sucks, how can
these be autodetected?
- refer to windows by name etc (duplicates? fnmatch?)
- the output code (tty.c) could do with optimisation depending on term capibilities
- find a better way to emulate scroll region/redraw < full screen etc
(hopefully) for 0.8, in no particular order:
- swap-pane-up, swap-pane-down (maybe move-pane-*)

View File

@ -1,4 +1,4 @@
/* $Id: screen-redraw.c,v 1.29 2009-03-28 10:15:01 nicm Exp $ */
/* $Id: screen-redraw.c,v 1.30 2009-03-31 18:39:45 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -73,6 +73,14 @@ screen_redraw_screen(struct client *c, struct screen *s)
if (w->sy < c->tty.sy - status)
screen_redraw_blanky(c, w->sy, c->tty.sy - status - w->sy, '=');
/* Draw right border line. */
if (w->sx < c->tty.sx) {
for (i = 0; i < c->tty.sy; i++) {
tty_putcode2(&c->tty, TTYC_CUP, i, w->sx);
tty_putc(&c->tty, '|');
}
}
/* Draw the status line. */
screen_redraw_status(c);
}

35
tty.c
View File

@ -1,4 +1,4 @@
/* $Id: tty.c,v 1.87 2009-03-30 20:14:50 nicm Exp $ */
/* $Id: tty.c,v 1.88 2009-03-31 18:39:45 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -413,7 +413,7 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int py, u_int oy)
tty_reset(tty);
tty_cursor(tty, sx, py, oy);
if (tty_term_has(tty->term, TTYC_EL))
if (screen_size_x(s) >= tty->sx && tty_term_has(tty->term, TTYC_EL))
tty_putcode(tty, TTYC_EL);
else {
for (i = sx; i < screen_size_x(s); i++)
@ -447,6 +447,11 @@ tty_cmd_insertcharacter(struct tty *tty, struct window_pane *wp, va_list ap)
struct screen *s = wp->screen;
u_int ua;
if (screen_size_x(s) < tty->sx) {
tty_draw_line(tty, wp->screen, s->old_cy, wp->yoff);
return;
}
ua = va_arg(ap, u_int);
tty_reset(tty);
@ -469,6 +474,11 @@ tty_cmd_deletecharacter(struct tty *tty, struct window_pane *wp, va_list ap)
struct screen *s = wp->screen;
u_int ua;
if (screen_size_x(s) < tty->sx) {
tty_draw_line(tty, wp->screen, s->old_cy, wp->yoff);
return;
}
ua = va_arg(ap, u_int);
tty_reset(tty);
@ -483,7 +493,7 @@ tty_cmd_insertline(struct tty *tty, struct window_pane *wp, va_list ap)
struct screen *s = wp->screen;
u_int ua, i;
if (!tty_term_has(tty->term, TTYC_CSR)) {
if (screen_size_x(s) < tty->sx || !tty_term_has(tty->term, TTYC_CSR)) {
/*
* Scroll region unsupported. Redraw using data from screen
* (already updated).
@ -514,7 +524,7 @@ tty_cmd_deleteline(struct tty *tty, struct window_pane *wp, va_list ap)
struct screen *s = wp->screen;
u_int ua, i;
if (!tty_term_has(tty->term, TTYC_CSR)) {
if (screen_size_x(s) < tty->sx || !tty_term_has(tty->term, TTYC_CSR)) {
/*
* Scroll region unsupported. Redraw using data from screen
* (already updated).
@ -548,7 +558,7 @@ tty_cmd_clearline(struct tty *tty, struct window_pane *wp, unused va_list ap)
tty_reset(tty);
tty_cursor(tty, 0, s->old_cy, wp->yoff);
if (tty_term_has(tty->term, TTYC_EL)) {
if (screen_size_x(s) >= tty->sx && tty_term_has(tty->term, TTYC_EL)) {
tty_putcode(tty, TTYC_EL);
} else {
for (i = 0; i < screen_size_x(s); i++)
@ -566,7 +576,7 @@ tty_cmd_clearendofline(
tty_reset(tty);
tty_cursor(tty, s->old_cx, s->old_cy, wp->yoff);
if (tty_term_has(tty->term, TTYC_EL))
if (screen_size_x(s) >= tty->sx && tty_term_has(tty->term, TTYC_EL))
tty_putcode(tty, TTYC_EL);
else {
for (i = s->old_cx; i < screen_size_x(s); i++)
@ -599,7 +609,7 @@ tty_cmd_reverseindex(struct tty *tty, struct window_pane *wp, unused va_list ap)
struct screen *s = wp->screen;
u_int i;
if (!tty_term_has(tty->term, TTYC_CSR)) {
if (screen_size_x(s) < tty->sx || !tty_term_has(tty->term, TTYC_CSR)) {
/*
* Scroll region unsupported. If would have scrolled, redraw
* scroll region from already updated window screen.
@ -627,7 +637,7 @@ tty_cmd_linefeed(struct tty *tty, struct window_pane *wp, unused va_list ap)
struct screen *s = wp->screen;
u_int i;
if (!tty_term_has(tty->term, TTYC_CSR)) {
if (screen_size_x(s) < tty->sx || !tty_term_has(tty->term, TTYC_CSR)) {
/*
* Scroll region unsupported. If would have scrolled, redraw
* scroll region from already updated window screen.
@ -662,7 +672,7 @@ tty_cmd_clearendofscreen(
tty_cursor(tty, s->old_cx, s->old_cy, wp->yoff);
tty_region(tty, 0, screen_size_y(s) - 1, wp->yoff);
if (tty_term_has(tty->term, TTYC_EL)) {
if (screen_size_x(s) >= tty->sx && tty_term_has(tty->term, TTYC_EL)) {
tty_putcode(tty, TTYC_EL);
if (s->old_cy != screen_size_y(s) - 1) {
tty_cursor(tty, 0, s->old_cy + 1, wp->yoff);
@ -678,6 +688,7 @@ tty_cmd_clearendofscreen(
for (i = s->old_cx; i < screen_size_x(s); i++)
tty_putc(tty, ' ');
for (j = s->old_cy; j < screen_size_y(s); j++) {
tty_cursor(tty, 0, j, wp->yoff);
for (i = 0; i < screen_size_x(s); i++)
tty_putc(tty, ' ');
}
@ -695,7 +706,7 @@ tty_cmd_clearstartofscreen(
tty_cursor(tty, 0, 0, wp->yoff);
tty_region(tty, 0, screen_size_y(s) - 1, wp->yoff);
if (tty_term_has(tty->term, TTYC_EL)) {
if (screen_size_x(s) >= tty->sx && tty_term_has(tty->term, TTYC_EL)) {
for (i = 0; i < s->old_cy; i++) {
tty_putcode(tty, TTYC_EL);
tty_emulate_repeat(tty, TTYC_CUD, TTYC_CUD1, 1);
@ -703,6 +714,7 @@ tty_cmd_clearstartofscreen(
}
} else {
for (j = 0; j < s->old_cy; j++) {
tty_cursor(tty, 0, j, wp->yoff);
for (i = 0; i < screen_size_x(s); i++)
tty_putc(tty, ' ');
}
@ -722,7 +734,7 @@ tty_cmd_clearscreen(
tty_cursor(tty, 0, 0, wp->yoff);
tty_region(tty, 0, screen_size_y(s) - 1, wp->yoff);
if (tty_term_has(tty->term, TTYC_EL)) {
if (screen_size_x(s) >= tty->sx && tty_term_has(tty->term, TTYC_EL)) {
for (i = 0; i < screen_size_y(s); i++) {
tty_putcode(tty, TTYC_EL);
if (i != screen_size_y(s) - 1) {
@ -732,6 +744,7 @@ tty_cmd_clearscreen(
}
} else {
for (j = 0; j < screen_size_y(s); j++) {
tty_cursor(tty, 0, j, wp->yoff);
for (i = 0; i < screen_size_x(s); i++)
tty_putc(tty, ' ');
}