Applied, thanks.

On Sat, Jun 14, 2014 at 01:54:07PM +0100, Balazs Kezes wrote:
> And now I attach another followup patch for the vi mode. Can you
> consider/test this one as well? Thanks!
> 
> -- 
> Balazs

> From fb35bdaf02c7991510569abcfd690903558c9532 Mon Sep 17 00:00:00 2001
> From: Balazs Kezes <rlblas...@gmail.com>
> Date: Sat, 14 Jun 2014 13:45:06 +0100
> Subject: [PATCH] Copy newline when cursor at end in vi mode
> 
> More precisely when the cursor is *after* the last character on the line, the
> newline will be copied. Otherwise there is no difference between standing on 
> the
> last character and standing behind the last character in vi mode. This
> corresponds how vi/vim works which is what vi mode strives to emulate.
> ---
>  window-copy.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/window-copy.c b/window-copy.c
> index ac29e6d..143997f 100644
> --- a/window-copy.c
> +++ b/window-copy.c
> @@ -1360,7 +1360,7 @@ window_copy_get_selection(struct window_pane *wp, 
> size_t *len)
>       struct screen                   *s = &data->screen;
>       char                            *buf;
>       size_t                           off;
> -     u_int                            i, xx, yy, sx, sy, ex, ey;
> +     u_int                            i, xx, yy, sx, sy, ex, ey, ey_last;
>       u_int                            firstsx, lastex, restex, restsx;
>       int                              keys;
>  
> @@ -1389,9 +1389,9 @@ window_copy_get_selection(struct window_pane *wp, 
> size_t *len)
>       }
>  
>       /* Trim ex to end of line. */
> -     xx = window_copy_find_length(wp, ey);
> -     if (ex > xx)
> -             ex = xx;
> +     ey_last = window_copy_find_length(wp, ey);
> +     if (ex > ey_last)
> +             ex = ey_last;
>  
>       /*
>        * Deal with rectangle-copy if necessary; four situations: start of
> @@ -1460,7 +1460,9 @@ window_copy_get_selection(struct window_pane *wp, 
> size_t *len)
>               free(buf);
>               return (NULL);
>       }
> -     *len = off - 1; /* remove final \n */
> +     if (keys == MODEKEY_EMACS || lastex <= ey_last)
> +             off -= 1; /* remove final \n (unless at end in vi mode) */
> +     *len = off;
>       return (buf);
>  }
>  
> -- 
> 2.0.0.526.g5318336
> 


------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to