mirror of
https://github.com/tmux/tmux.git
synced 2024-11-17 18:08:51 +00:00
Sync OpenBSD patchset 619:
Hugely simplify window_copy_cursor_next_word, which was way overcomplicated.
This commit is contained in:
parent
22dd0beaa0
commit
1a6cb5fd54
@ -1,4 +1,4 @@
|
|||||||
/* $Id: window-copy.c,v 1.97 2010-01-28 22:42:36 tcunha Exp $ */
|
/* $Id: window-copy.c,v 1.98 2010-01-28 22:43:24 tcunha Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -1161,56 +1161,33 @@ void
|
|||||||
window_copy_cursor_next_word(struct window_pane *wp)
|
window_copy_cursor_next_word(struct window_pane *wp)
|
||||||
{
|
{
|
||||||
struct window_copy_mode_data *data = wp->modedata;
|
struct window_copy_mode_data *data = wp->modedata;
|
||||||
struct screen *s = &data->screen;
|
struct screen *base_s = &wp->base;
|
||||||
u_int px, py, xx, skip;
|
u_int px, py, xx, yy;
|
||||||
|
|
||||||
px = data->cx;
|
px = data->cx;
|
||||||
py = screen_hsize(&wp->base) + data->cy - data->oy;
|
py = screen_hsize(base_s) + data->cy - data->oy;
|
||||||
xx = window_copy_find_length(wp, py);
|
xx = window_copy_find_length(wp, py);
|
||||||
|
yy = screen_hsize(base_s) + screen_size_y(base_s) - 1;
|
||||||
|
|
||||||
skip = 1;
|
/* Are we on spaces? Skip 'em! */
|
||||||
if (px < xx) {
|
while (px > xx || window_copy_is_space(wp, px, py)) {
|
||||||
/* If currently on a space, skip space. */
|
/* Nothing but spaces past the end of the line, so move down. */
|
||||||
if (window_copy_is_space(wp, px, py))
|
if (px > xx) {
|
||||||
skip = 0;
|
if (py == yy)
|
||||||
} else
|
return;
|
||||||
skip = 0;
|
window_copy_cursor_down(wp, 0);
|
||||||
for (;;) {
|
px = 0;
|
||||||
if (px >= xx) {
|
|
||||||
if (skip) {
|
|
||||||
px = xx;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (px >= xx) {
|
py = screen_hsize(base_s) + data->cy - data->oy;
|
||||||
if (data->cy == screen_size_y(s) - 1) {
|
xx = window_copy_find_length(wp, py);
|
||||||
if (data->oy == 0)
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
px = 0;
|
|
||||||
window_copy_cursor_down(wp, 0);
|
|
||||||
|
|
||||||
py =screen_hsize(
|
|
||||||
&wp->base) + data->cy - data->oy;
|
|
||||||
xx = window_copy_find_length(wp, py);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skip) {
|
|
||||||
/* Currently skipping non-space (until space). */
|
|
||||||
if (window_copy_is_space(wp, px, py))
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
/* Currently skipping space (until non-space). */
|
|
||||||
if (!window_copy_is_space(wp, px, py))
|
|
||||||
skip = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
px++;
|
px++;
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
/* Find the end of this word. */
|
||||||
|
while (!window_copy_is_space(wp, px, py))
|
||||||
|
px++;
|
||||||
|
|
||||||
window_copy_update_cursor(wp, px, data->cy);
|
window_copy_update_cursor(wp, px, data->cy);
|
||||||
if (window_copy_update_selection(wp))
|
if (window_copy_update_selection(wp))
|
||||||
window_copy_redraw_lines(wp, data->cy, 1);
|
window_copy_redraw_lines(wp, data->cy, 1);
|
||||||
@ -1239,8 +1216,7 @@ window_copy_cursor_previous_word(struct window_pane *wp)
|
|||||||
goto out;
|
goto out;
|
||||||
window_copy_cursor_up(wp, 0);
|
window_copy_cursor_up(wp, 0);
|
||||||
|
|
||||||
py = screen_hsize(
|
py = screen_hsize(&wp->base) + data->cy - data->oy;
|
||||||
&wp->base) + data->cy - data->oy;
|
|
||||||
px = window_copy_find_length(wp, py);
|
px = window_copy_find_length(wp, py);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user