Make previous-word stop at BOL.

This commit is contained in:
Nicholas Marriott 2008-06-27 17:41:48 +00:00
parent 9043fe891a
commit 09a4f6a62d

View File

@ -1,4 +1,4 @@
/* $Id: window-copy.c,v 1.24 2008-06-25 07:30:08 nicm Exp $ */
/* $Id: window-copy.c,v 1.25 2008-06-27 17:41:48 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -717,9 +717,9 @@ window_copy_cursor_previous_word(struct window *w)
{
struct window_copy_mode_data *data = w->modedata;
struct screen *s = &data->screen;
u_int px, py, skip;
u_int ox, px, py, skip;
px = data->ox + data->cx;
ox = px = data->ox + data->cx;
py = screen_y(&w->base, data->cy) - data->oy;
skip = 1;
@ -729,19 +729,21 @@ window_copy_cursor_previous_word(struct window *w)
skip = 0;
}
for (;;) {
while (px == 0) {
if (data->cy == 0) {
if (w->base.hsize == 0 ||
data->oy >= w->base.hsize - 1)
if (px == 0) {
if (ox != 0)
break;
while (px == 0) {
if (data->cy == 0 && (w->base.hsize == 0 ||
data->oy >= w->base.hsize - 1))
goto out;
window_copy_cursor_up(w);
py = screen_y(&w->base, data->cy) - data->oy;
px = window_copy_find_length(w, py);
}
window_copy_cursor_up(w);
py = screen_y(&w->base, data->cy) - data->oy;
px = window_copy_find_length(w, py);
if (px != 0)
goto out;
goto out;
}
if (skip) {