From 09a4f6a62d6a2337fc0d801827385c2b13e691be Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Fri, 27 Jun 2008 17:41:48 +0000 Subject: [PATCH] Make previous-word stop at BOL. --- window-copy.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 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 @@ -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) - goto out; - } + if (px == 0) { + if (ox != 0) + break; - 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; + 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); + } + goto out; } if (skip) {