This is a code-only patch. I'll submit a separate one for the manual.
This patch eliminates "output" (or "more") mode, which is used to view
command output within an attached tmux client. It's the mode you use
when you type <prefix> ? to get a list of bindings.
Reasons behind this change:
- Now you can search and copy from the key-binding lists or option
settings (I've been wanting to do this).
- Ensures that "more" mode uses the {emacs,vi}-copy bindings, rather
than the {emacs,vi}-choice mode bindings, which seemed more natural
to me.
- Consolidates code. Less to maintain :)
Biggest changes in behavior
- If your copy-mode bindings differ from your choice-mode bindings,
you're now using the copy-mode ones.
- Output mode used to show how many lines from the top you are; copy
mode shows how many lines from the bottom (how far into "history").
- "Up" and "down" used to just scroll up and down; now they move the
cursor (and scroll if it's at the edges).
Application:
After applying the patch, please also remove (cvs remove) window-more.c,
which is no longer used.
Details:
The code for copy-mode in window-copy.c assumed everywhere that it was
"backed" by the window pane's "base" screen. This has been replaced by a
generic "backing" screen.
It's no longer enough to simply set a pane into "copy" mode. You also
then have to follow it with a call to window_copy_from_pane, which sets
things up to work like normal copy mode, or you have to call
window_copy_backing_init, which creates a fresh screen as the backing,
for writing to.
Places that used to set window_more_mode and call window_more_(v)add,
now set window_copy_mode, and call window_copy_backing_init, then
window_more_(v)add.
A new flag was added to the screen structure, "wrap", which is normally
set to true. It is set to false for the output-mode-style backing, so
that lines are written fully (but don't display fully), and are
available when you resize (enlarge) the pane (this mimics the behavior
of output mode). Allowing writes to a grid line past the actual width of
the grid necessitated the removal of all the grid_check_x invocations
(and so I also eliminated the function definition). These were never
really necessary anyway: grid lines longer than the grid width were
already possible (when you shrink a pane; this lets them remain
available for when you enlargen it again), but these checks merely
prevented one from writing/reading the rest of the data past the grid width.
--
Micah J. Cowan
http://micah.cowan.name/
Index: cmd-copy-mode.c
===================================================================
--- cmd-copy-mode.c.orig
+++ cmd-copy-mode.c
@@ -63,6 +63,7 @@
return (-1);
window_pane_set_mode(wp, &window_copy_mode);
+ window_copy_from_pane(wp);
if (wp->mode == &window_copy_mode && cmd_check_flag(data->chflags, 'u'))
window_copy_pageup(wp);
Index: tmux.h
===================================================================
--- tmux.h.orig
+++ tmux.h
@@ -700,6 +700,8 @@
int mode;
+ int wrap; /* whether lines wrap */
+
bitstr_t *tabs;
struct screen_sel sel;
@@ -1873,13 +1875,12 @@
/* window-copy.c */
extern const struct window_mode window_copy_mode;
+void window_copy_from_pane(struct window_pane *);
+void window_copy_backing_init(struct window_pane *);
+void window_copy_add(struct window_pane *, const char *, ...);
+void window_copy_vadd(struct window_pane *, const char *, va_list);
void window_copy_pageup(struct window_pane *);
-/* window-more.c */
-extern const struct window_mode window_more_mode;
-void window_more_add(struct window_pane *, const char *, ...);
-void window_more_vadd(struct window_pane *, const char *, va_list);
-
/* window-choose.c */
extern const struct window_mode window_choose_mode;
void window_choose_vadd(
Index: window-copy.c
===================================================================
--- window-copy.c.orig
+++ window-copy.c
@@ -88,6 +88,7 @@
struct window_copy_mode_data {
struct screen screen;
+ struct screen *backing;
struct mode_key_data mdata;
@@ -104,6 +105,9 @@
u_int lastcx; /* position in last line with content */
u_int lastsx; /* size of last line with content */
+ int backing_written; /* where to write next line
+ in backing */
+
enum window_copy_input_type inputtype;
const char *inputprompt;
char *inputstr;
@@ -117,18 +121,18 @@
{
struct window_copy_mode_data *data;
struct screen *s;
- struct screen_write_ctx ctx;
- u_int i;
int keys;
wp->modedata = data = xmalloc(sizeof *data);
data->oy = 0;
- data->cx = wp->base.cx;
- data->cy = wp->base.cy;
+ data->cx = 0;
+ data->cy = 0;
data->lastcx = 0;
data->lastsx = 0;
+ data->backing_written = 0;
+
data->rectflag = 0;
data->inputtype = WINDOW_COPY_OFF;
@@ -149,6 +153,29 @@
else
mode_key_init(&data->mdata, &mode_key_tree_vi_copy);
+ data->backing = NULL;
+
+ return (s);
+}
+
+void
+window_copy_from_pane(struct window_pane *wp)
+{
+ struct window_copy_mode_data *data;
+ struct screen *s;
+ struct screen_write_ctx ctx;
+ u_int i;
+
+ if (wp->mode != &window_copy_mode)
+ fatal("not in copy mode");
+
+ data = wp->modedata;
+ s = &data->screen;
+
+ data->backing = &wp->base;
+ data->cx = data->backing->cx;
+ data->cy = data->backing->cy;
+
s->cx = data->cx;
s->cy = data->cy;
@@ -157,8 +184,17 @@
window_copy_write_line(wp, &ctx, i);
screen_write_cursormove(&ctx, data->cx, data->cy);
screen_write_stop(&ctx);
+}
- return (s);
+void
+window_copy_backing_init(struct window_pane *wp)
+{
+ struct window_copy_mode_data *data = wp->modedata;
+
+ data->backing = xmalloc(sizeof *data->backing);
+ screen_init(data->backing, screen_size_x(&wp->base),
+ screen_size_y(&wp->base), UINT_MAX);
+ data->backing->wrap = 0;
}
void
@@ -170,12 +206,75 @@
xfree(data->searchstr);
xfree(data->inputstr);
+ if (data->backing != &wp->base) {
+ screen_free(data->backing);
+ xfree(data->backing);
+ }
screen_free(&data->screen);
xfree(data);
}
void
+window_copy_add(struct window_pane *wp, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ window_copy_vadd(wp, fmt, ap);
+ va_end(ap);
+}
+
+void
+window_copy_vadd(struct window_pane *wp, const char *fmt, va_list ap)
+{
+ struct window_copy_mode_data *data = wp->modedata;
+ struct screen *backing = data->backing;
+ struct screen_write_ctx back_ctx, ctx;
+ struct grid_cell gc;
+ char *msg;
+ int utf8flag;
+ u_int ox, oy;
+ u_int old_hsize, hist_diff;
+
+ utf8flag = options_get_number(&wp->window->options, "utf8");
+ memcpy(&gc, &grid_default_cell, sizeof gc);
+
+ xvasprintf(&msg, fmt, ap);
+
+ old_hsize = screen_hsize(data->backing);
+ screen_write_start(&back_ctx, NULL, backing);
+ if (data->backing_written) {
+ /* On the second or later line, do a CRLF before writing
+ * (so it's on a new line). */
+ screen_write_carriagereturn(&back_ctx);
+ screen_write_linefeed(&back_ctx, 0);
+ } else
+ data->backing_written++;
+ screen_write_vnputs(&back_ctx, 0, &gc, utf8flag, fmt, ap);
+ screen_write_stop(&back_ctx);
+
+ data->oy += screen_hsize(data->backing) - old_hsize;
+
+ screen_write_start(&ctx, wp, &data->screen);
+ ox = data->screen.cx;
+ oy = data->screen.cy;
+
+ /* If the history has changed, draw the top line.
+ * (If there's any history at all, it has changed.) */
+ if (screen_hsize(data->backing))
+ window_copy_write_line(wp, &ctx, 0);
+
+ /* Write the line, if it's visible. */
+ if (backing->cy + data->oy < screen_size_y(backing))
+ window_copy_write_line(wp, &ctx, backing->cy);
+
+ data->screen.cx = data->cx = ox;
+ data->screen.cy = data->cy = oy;
+ screen_write_stop(&ctx);
+}
+
+void
window_copy_pageup(struct window_pane *wp)
{
struct window_copy_mode_data *data = wp->modedata;
@@ -185,8 +284,8 @@
n = 1;
if (screen_size_y(s) > 2)
n = screen_size_y(s) - 2;
- if (data->oy + n > screen_hsize(&wp->base))
- data->oy = screen_hsize(&wp->base);
+ if (data->oy + n > screen_hsize(data->backing))
+ data->oy = screen_hsize(data->backing);
else
data->oy += n;
window_copy_update_selection(wp);
@@ -201,6 +300,8 @@
struct screen_write_ctx ctx;
screen_resize(s, sx, sy);
+ if (data->backing != &wp->base)
+ screen_resize(data->backing, sx, sy);
if (data->cy > sy - 1)
data->cy = sy - 1;
@@ -271,8 +372,8 @@
break;
case MODEKEYCOPY_HALFPAGEUP:
n = screen_size_y(s) / 2;
- if (data->oy + n > screen_hsize(&wp->base))
- data->oy = screen_hsize(&wp->base);
+ if (data->oy + n > screen_hsize(data->backing))
+ data->oy = screen_hsize(data->backing);
else
data->oy += n;
window_copy_update_selection(wp);
@@ -308,7 +409,7 @@
case MODEKEYCOPY_HISTORYTOP:
data->cx = 0;
data->cy = 0;
- data->oy = screen_hsize(&wp->base);
+ data->oy = screen_hsize(data->backing);
window_copy_update_selection(wp);
window_copy_redraw_screen(wp);
break;
@@ -504,8 +605,7 @@
window_copy_scroll_to(struct window_pane *wp, u_int px, u_int py)
{
struct window_copy_mode_data *data = wp->modedata;
- struct screen *s = &wp->base;
- struct grid *gd = s->grid;
+ struct grid *gd = data->backing->grid;
u_int offset, gap;
data->cx = px;
@@ -600,7 +700,7 @@
window_copy_search_up(struct window_pane *wp, const char *searchstr)
{
struct window_copy_mode_data *data = wp->modedata;
- struct screen *s = &wp->base, ss;
+ struct screen *s = data->backing, ss;
struct screen_write_ctx ctx;
struct grid *gd = s->grid, *sgd;
struct grid_cell gc;
@@ -657,7 +757,7 @@
window_copy_search_down(struct window_pane *wp, const char *searchstr)
{
struct window_copy_mode_data *data = wp->modedata;
- struct screen *s = &wp->base, ss;
+ struct screen *s = data->backing, ss;
struct screen_write_ctx ctx;
struct grid *gd = s->grid, *sgd;
struct grid_cell gc;
@@ -717,7 +817,7 @@
const char *errstr;
u_int lineno;
- lineno = strtonum(linestr, 0, screen_hsize(&wp->base), &errstr);
+ lineno = strtonum(linestr, 0, screen_hsize(data->backing), &errstr);
if (errstr != NULL)
return;
@@ -745,7 +845,7 @@
last = screen_size_y(s) - 1;
if (py == 0) {
size = xsnprintf(hdr, sizeof hdr,
- "[%u/%u]", data->oy, screen_hsize(&wp->base));
+ "[%u/%u]", data->oy, screen_hsize(data->backing));
screen_write_cursormove(ctx, screen_size_x(s) - size, 0);
screen_write_puts(ctx, &gc, "%s", hdr);
} else if (py == last && data->inputtype != WINDOW_COPY_OFF) {
@@ -757,8 +857,9 @@
size = 0;
screen_write_cursormove(ctx, xoff, py);
- screen_write_copy(ctx, &wp->base, xoff, (screen_hsize(&wp->base) -
- data->oy) + py, screen_size_x(s) - size, 1);
+ screen_write_copy(ctx, data->backing, xoff,
+ (screen_hsize(data->backing) - data->oy) + py,
+ screen_size_x(s) - size, 1);
if (py == data->cy && data->cx == screen_size_x(s)) {
memcpy(&gc, &grid_default_cell, sizeof gc);
@@ -827,7 +928,7 @@
struct screen *s = &data->screen;
data->selx = data->cx;
- data->sely = screen_hsize(&wp->base) + data->cy - data->oy;
+ data->sely = screen_hsize(data->backing) + data->cy - data->oy;
s->sel.flag = 1;
window_copy_update_selection(wp);
@@ -852,7 +953,7 @@
gc.attr |= options_get_number(oo, "mode-attr");
/* Find top of screen. */
- ty = screen_hsize(&wp->base) - data->oy;
+ ty = screen_hsize(data->backing) - data->oy;
/* Adjust the selection. */
sx = data->selx;
@@ -913,7 +1014,7 @@
/* Find start and end. */
xx = data->cx;
- yy = screen_hsize(&wp->base) + data->cy - data->oy;
+ yy = screen_hsize(data->backing) + data->cy - data->oy;
if (yy < data->sely || (yy == data->sely && xx < data->selx)) {
sx = xx; sy = yy;
ex = data->selx; ey = data->sely;
@@ -992,12 +1093,13 @@
window_copy_copy_line(struct window_pane *wp,
char **buf, size_t *off, u_int sy, u_int sx, u_int ex)
{
- struct grid *gd = wp->base.grid;
- const struct grid_cell *gc;
- const struct grid_utf8 *gu;
- struct grid_line *gl;
- u_int i, xx, wrapped = 0;
- size_t size;
+ struct window_copy_mode_data *data = wp->modedata;
+ struct grid *gd = data->backing->grid;
+ const struct grid_cell *gc;
+ const struct grid_utf8 *gu;
+ struct grid_line *gl;
+ u_int i, xx, wrapped = 0;
+ size_t size;
if (sx > ex)
return;
@@ -1047,9 +1149,10 @@
int
window_copy_in_set(struct window_pane *wp, u_int px, u_int py, const char *set)
{
- const struct grid_cell *gc;
+ struct window_copy_mode_data *data = wp->modedata;
+ const struct grid_cell *gc;
- gc = grid_peek_cell(wp->base.grid, px, py);
+ gc = grid_peek_cell(data->backing->grid, px, py);
if (gc->flags & (GRID_FLAG_PADDING|GRID_FLAG_UTF8))
return (0);
if (gc->data == 0x00 || gc->data == 0x7f)
@@ -1060,8 +1163,10 @@
u_int
window_copy_find_length(struct window_pane *wp, u_int py)
{
- const struct grid_cell *gc;
- u_int px;
+ struct window_copy_mode_data *data = wp->modedata;
+ struct screen *s = data->backing;
+ const struct grid_cell *gc;
+ u_int px;
/*
* If the pane has been resized, its grid can contain old overlong
@@ -1069,11 +1174,11 @@
* width of the grid, and screen_write_copy treats them as spaces, so
* ignore them here too.
*/
- px = wp->base.grid->linedata[py].cellsize;
- if (px > screen_size_x(&wp->base))
- px = screen_size_x(&wp->base);
+ px = s->grid->linedata[py].cellsize;
+ if (px > screen_size_x(s))
+ px = screen_size_x(s);
while (px > 0) {
- gc = grid_peek_cell(wp->base.grid, px - 1, py);
+ gc = grid_peek_cell(s->grid, px - 1, py);
if (gc->flags & GRID_FLAG_UTF8)
break;
if (gc->data != ' ')
@@ -1101,11 +1206,11 @@
const struct grid_cell *gc;
px = 0;
- py = screen_hsize(&wp->base) + data->cy - data->oy;
+ py = screen_hsize(data->backing) + data->cy - data->oy;
xx = window_copy_find_length(wp, py);
while (px < xx) {
- gc = grid_peek_cell(wp->base.grid, px, py);
+ gc = grid_peek_cell(data->backing->grid, px, py);
if (gc->flags & GRID_FLAG_UTF8)
break;
if (gc->data != ' ')
@@ -1124,7 +1229,7 @@
struct window_copy_mode_data *data = wp->modedata;
u_int px, py;
- py = screen_hsize(&wp->base) + data->cy - data->oy;
+ py = screen_hsize(data->backing) + data->cy - data->oy;
px = window_copy_find_length(wp, py);
window_copy_update_cursor(wp, px, data->cy);
@@ -1153,7 +1258,7 @@
struct window_copy_mode_data *data = wp->modedata;
u_int px, py;
- py = screen_hsize(&wp->base) + data->cy - data->oy;
+ py = screen_hsize(data->backing) + data->cy - data->oy;
px = window_copy_find_length(wp, py);
if (data->cx >= px) {
@@ -1173,7 +1278,7 @@
struct screen *s = &data->screen;
u_int ox, oy, px, py;
- oy = screen_hsize(&wp->base) + data->cy - data->oy;
+ oy = screen_hsize(data->backing) + data->cy - data->oy;
ox = window_copy_find_length(wp, oy);
if (ox != 0) {
data->lastcx = data->cx;
@@ -1199,7 +1304,7 @@
}
}
- py = screen_hsize(&wp->base) + data->cy - data->oy;
+ py = screen_hsize(data->backing) + data->cy - data->oy;
px = window_copy_find_length(wp, py);
if (data->cx >= data->lastsx || data->cx > px)
window_copy_cursor_end_of_line(wp);
@@ -1212,7 +1317,7 @@
struct screen *s = &data->screen;
u_int ox, oy, px, py;
- oy = screen_hsize(&wp->base) + data->cy - data->oy;
+ oy = screen_hsize(data->backing) + data->cy - data->oy;
ox = window_copy_find_length(wp, oy);
if (ox != 0) {
data->lastcx = data->cx;
@@ -1230,7 +1335,7 @@
window_copy_redraw_lines(wp, data->cy - 1, 2);
}
- py = screen_hsize(&wp->base) + data->cy - data->oy;
+ py = screen_hsize(data->backing) + data->cy - data->oy;
px = window_copy_find_length(wp, py);
if (data->cx >= data->lastsx || data->cx > px)
window_copy_cursor_end_of_line(wp);
@@ -1240,13 +1345,13 @@
window_copy_cursor_next_word(struct window_pane *wp, const char *separators)
{
struct window_copy_mode_data *data = wp->modedata;
- struct screen *base_s = &wp->base;
+ struct screen *back_s = data->backing;
u_int px, py, xx, yy;
px = data->cx;
- py = screen_hsize(base_s) + data->cy - data->oy;
+ py = screen_hsize(back_s) + data->cy - data->oy;
xx = window_copy_find_length(wp, py);
- yy = screen_hsize(base_s) + screen_size_y(base_s) - 1;
+ yy = screen_hsize(back_s) + screen_size_y(back_s) - 1;
/* Are we in a word? Skip it! */
while (!window_copy_in_set(wp, px, py, separators))
@@ -1261,7 +1366,7 @@
window_copy_cursor_down(wp, 0);
px = 0;
- py = screen_hsize(base_s) + data->cy - data->oy;
+ py = screen_hsize(back_s) + data->cy - data->oy;
xx = window_copy_find_length(wp, py);
}
px++;
@@ -1276,13 +1381,13 @@
window_copy_cursor_next_word_end(struct window_pane *wp, const char *separators)
{
struct window_copy_mode_data *data = wp->modedata;
- struct screen *base_s = &wp->base;
+ struct screen *back_s = data->backing;
u_int px, py, xx, yy;
px = data->cx;
- py = screen_hsize(base_s) + data->cy - data->oy;
+ py = screen_hsize(back_s) + data->cy - data->oy;
xx = window_copy_find_length(wp, py);
- yy = screen_hsize(base_s) + screen_size_y(base_s) - 1;
+ yy = screen_hsize(back_s) + screen_size_y(back_s) - 1;
/* Are we on spaces? Skip 'em! */
while (px > xx || window_copy_in_set(wp, px, py, separators)) {
@@ -1293,7 +1398,7 @@
window_copy_cursor_down(wp, 0);
px = 0;
- py = screen_hsize(base_s) + data->cy - data->oy;
+ py = screen_hsize(back_s) + data->cy - data->oy;
xx = window_copy_find_length(wp, py);
}
px++;
@@ -1316,7 +1421,7 @@
u_int px, py;
px = data->cx;
- py = screen_hsize(&wp->base) + data->cy - data->oy;
+ py = screen_hsize(data->backing) + data->cy - data->oy;
/* Move back to the previous word character. */
for (;;) {
@@ -1326,12 +1431,12 @@
break;
} else {
if (data->cy == 0 &&
- (screen_hsize(&wp->base) == 0 ||
- data->oy >= screen_hsize(&wp->base) - 1))
+ (screen_hsize(data->backing) == 0 ||
+ data->oy >= screen_hsize(data->backing) - 1))
goto out;
window_copy_cursor_up(wp, 0);
- py = screen_hsize(&wp->base) + data->cy - data->oy;
+ py = screen_hsize(data->backing) + data->cy - data->oy;
px = window_copy_find_length(wp, py);
}
}
@@ -1384,11 +1489,11 @@
struct screen *s = &data->screen;
struct screen_write_ctx ctx;
- if (ny > screen_hsize(&wp->base))
+ if (ny > screen_hsize(data->backing))
return;
- if (data->oy > screen_hsize(&wp->base) - ny)
- ny = screen_hsize(&wp->base) - data->oy;
+ if (data->oy > screen_hsize(data->backing) - ny)
+ ny = screen_hsize(data->backing) - data->oy;
if (ny == 0)
return;
data->oy += ny;
Index: screen-write.c
===================================================================
--- screen-write.c.orig
+++ screen-write.c
@@ -1009,13 +1009,14 @@
}
/* Check this will fit on the current line and wrap if not. */
- if (s->cx > screen_size_x(s) - width) {
+ if (s->wrap && s->cx > screen_size_x(s) - width) {
screen_write_linefeed(ctx, 1);
s->cx = 0; /* carriage return */
}
/* Sanity checks. */
- if (s->cx > screen_size_x(s) - 1 || s->cy > screen_size_y(s) - 1)
+ if ((s->wrap && s->cx > screen_size_x(s) - 1)
+ || s->cy > screen_size_y(s) - 1)
return;
/* Handle overwriting of UTF-8 characters. */
Index: screen.c
===================================================================
--- screen.c.orig
+++ screen.c
@@ -51,6 +51,8 @@
s->mode = MODE_CURSOR;
+ s->wrap = 1;
+
screen_reset_tabs(s);
grid_clear_lines(s->grid, s->grid->hsize, s->grid->sy);
Index: key-bindings.c
===================================================================
--- key-bindings.c.orig
+++ key-bindings.c
@@ -209,12 +209,14 @@
struct winlink *wl = ctx->curclient->session->curw;
va_list ap;
- if (wl->window->active->mode != &window_more_mode)
+ if (wl->window->active->mode != &window_copy_mode) {
window_pane_reset_mode(wl->window->active);
- window_pane_set_mode(wl->window->active, &window_more_mode);
+ window_pane_set_mode(wl->window->active, &window_copy_mode);
+ window_copy_backing_init(wl->window->active);
+ }
va_start(ap, fmt);
- window_more_vadd(wl->window->active, fmt, ap);
+ window_copy_vadd(wl->window->active, fmt, ap);
va_end(ap);
}
Index: cmd-new-session.c
===================================================================
--- cmd-new-session.c.orig
+++ cmd-new-session.c
@@ -287,10 +287,11 @@
*/
if (cfg_finished && !ARRAY_EMPTY(&cfg_causes)) {
wp = s->curw->window->active;
- window_pane_set_mode(wp, &window_more_mode);
+ window_pane_set_mode(wp, &window_copy_mode);
+ window_copy_backing_init(wp);
for (i = 0; i < ARRAY_LENGTH(&cfg_causes); i++) {
cause = ARRAY_ITEM(&cfg_causes, i);
- window_more_add(wp, "%s", cause);
+ window_copy_add(wp, "%s", cause);
xfree(cause);
}
ARRAY_FREE(&cfg_causes);
Index: server.c
===================================================================
--- server.c.orig
+++ server.c
@@ -201,10 +201,11 @@
*/
if (!ARRAY_EMPTY(&sessions) && !ARRAY_EMPTY(&cfg_causes)) {
wp = ARRAY_FIRST(&sessions)->curw->window->active;
- window_pane_set_mode(wp, &window_more_mode);
+ window_pane_set_mode(wp, &window_copy_mode);
+ window_copy_backing_init(wp);
for (i = 0; i < ARRAY_LENGTH(&cfg_causes); i++) {
cause = ARRAY_ITEM(&cfg_causes, i);
- window_more_add(wp, "%s", cause);
+ window_copy_add(wp, "%s", cause);
xfree(cause);
}
ARRAY_FREE(&cfg_causes);
Index: grid.c
===================================================================
--- grid.c.orig
+++ grid.c
@@ -46,19 +46,10 @@
gc, sizeof gd->linedata[py].utf8data[px]); \
} while (0)
-int grid_check_x(struct grid *, u_int);
int grid_check_y(struct grid *, u_int);
#ifdef DEBUG
int
-grid_check_x(struct grid *gd, u_int px)
-{
- if ((px) >= (gd)->sx)
- log_fatalx("x out of range: %u", px);
- return (0);
-}
-
-int
grid_check_y(struct grid *gd, u_int py)
{
if ((py) >= (gd)->hsize + (gd)->sy)
@@ -67,16 +58,6 @@
}
#else
int
-grid_check_x(struct grid *gd, u_int px)
-{
- if ((px) >= (gd)->sx) {
- log_debug("x out of range: %u", px);
- return (-1);
- }
- return (0);
-}
-
-int
grid_check_y(struct grid *gd, u_int py)
{
if ((py) >= (gd)->hsize + (gd)->sy) {
@@ -270,8 +251,6 @@
const struct grid_cell *
grid_peek_cell(struct grid *gd, u_int px, u_int py)
{
- if (grid_check_x(gd, px) != 0)
- return (&grid_default_cell);
if (grid_check_y(gd, py) != 0)
return (&grid_default_cell);
@@ -284,8 +263,6 @@
struct grid_cell *
grid_get_cell(struct grid *gd, u_int px, u_int py)
{
- if (grid_check_x(gd, px) != 0)
- return (NULL);
if (grid_check_y(gd, py) != 0)
return (NULL);
@@ -298,8 +275,6 @@
grid_set_cell(
struct grid *gd, u_int px, u_int py, const struct grid_cell *gc)
{
- if (grid_check_x(gd, px) != 0)
- return;
if (grid_check_y(gd, py) != 0)
return;
@@ -311,8 +286,6 @@
const struct grid_utf8 *
grid_peek_utf8(struct grid *gd, u_int px, u_int py)
{
- if (grid_check_x(gd, px) != 0)
- return (NULL);
if (grid_check_y(gd, py) != 0)
return (NULL);
@@ -325,8 +298,6 @@
struct grid_utf8 *
grid_get_utf8(struct grid *gd, u_int px, u_int py)
{
- if (grid_check_x(gd, px) != 0)
- return (NULL);
if (grid_check_y(gd, py) != 0)
return (NULL);
@@ -339,8 +310,6 @@
grid_set_utf8(
struct grid *gd, u_int px, u_int py, const struct grid_utf8 *gc)
{
- if (grid_check_x(gd, px) != 0)
- return;
if (grid_check_y(gd, py) != 0)
return;
@@ -364,10 +333,6 @@
return;
}
- if (grid_check_x(gd, px) != 0)
- return;
- if (grid_check_x(gd, px + nx - 1) != 0)
- return;
if (grid_check_y(gd, py) != 0)
return;
if (grid_check_y(gd, py + ny - 1) != 0)
@@ -465,12 +430,6 @@
if (nx == 0 || px == dx)
return;
- if (grid_check_x(gd, px) != 0)
- return;
- if (grid_check_x(gd, px + nx - 1) != 0)
- return;
- if (grid_check_x(gd, dx + nx - 1) != 0)
- return;
if (grid_check_y(gd, py) != 0)
return;
gl = &gd->linedata[py];
------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users