diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2008-06-27 17:41:48 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2008-06-27 17:41:48 +0000 |
commit | 09a4f6a62d6a2337fc0d801827385c2b13e691be (patch) | |
tree | b984b2cadae34a4216bdbb88dd838c41e593d9b4 /window-copy.c | |
parent | 9043fe891a3d81d5edcfe6f80986db98e8ab1985 (diff) |
Make previous-word stop at BOL.
Diffstat (limited to 'window-copy.c')
-rw-r--r-- | window-copy.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/window-copy.c b/window-copy.c index 1902ea92..26f3b2f4 100644 --- a/window-copy.c +++ b/window-copy.c @@ -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) { |