Hi

There is no way we are adding an option for this, sorry. Does the
current behaviour match vi(1)?



On Sun, Jan 18, 2015 at 01:50:18AM +0100, Thomas Egerer wrote:
> 
> Signed-off-by: Thomas Egerer <hakke[underscore]double-oh-seven[at]gmx.de>
> ---
> Hello *,
> 
> the changes introduced in git-commit
>    00ac1af Copy newline when at EOL in vi(1) mode, from Balazs Kezes.
> have been driving me up and down the wall during the last couple of
> days. I often use the 'copy-line' command to copy command line
> statements. When such a buffer is then pasted the statement is
> immediately executed. This is very unpleasant.
> It might be just me, but if you too think the attached patch is worth
> applying to your repository, I would be thrilled if you did.
> 
> Regards,
> Thomas
> 
>  options-table.c |    5 +++++
>  tmux.1          |    7 +++++++
>  window-copy.c   |    3 ++-
>  3 files changed, 14 insertions(+), 1 deletion(-)
> 
> 

> diff --git a/options-table.c b/options-table.c
> index 2b12324..c4731f5 100644
> --- a/options-table.c
> +++ b/options-table.c
> @@ -556,6 +556,11 @@ const struct options_table_entry window_options_table[] 
> = {
>         .default_num = 1
>       },
>  
> +     { .name = "copy-newline",
> +       .type = OPTIONS_TABLE_FLAG,
> +       .default_num = 1
> +     },
> +
>       { .name = "force-height",
>         .type = OPTIONS_TABLE_NUMBER,
>         .minimum = 0,
> diff --git a/tmux.1 b/tmux.1
> index a277248..c0d3d9f 100644
> --- a/tmux.1
> +++ b/tmux.1
> @@ -2813,6 +2813,13 @@ Set clock colour.
>  .Xc
>  Set clock hour format.
>  .Pp
> +.It Xo Ic copy-newline
> +.Op Ic on | off
> +.Xc
> +With vi key bindings defines whether the last selected newline is copied. The
> +default is
> +.Ic on .
> +.Pp
>  .It Ic force-height Ar height
>  .It Ic force-width Ar width
>  Prevent
> diff --git a/window-copy.c b/window-copy.c
> index 6447a2d..4050f48 100644
> --- a/window-copy.c
> +++ b/window-copy.c
> @@ -1475,7 +1475,8 @@ window_copy_get_selection(struct window_pane *wp, 
> size_t *len)
>               free(buf);
>               return (NULL);
>       }
> -     if (keys == MODEKEY_EMACS || lastex <= ey_last)
> +     if (keys == MODEKEY_EMACS || lastex <= ey_last ||
> +             !options_get_number(&wp->window->options, "copy-newline"))
>               off -= 1; /* remove final \n (unless at end in vi mode) */
>       *len = off;
>       return (buf);
> 

> ------------------------------------------------------------------------------
> New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
> GigeNET is offering a free month of service with a new server in Ashburn.
> Choose from 2 high performing configs, both with 100TB of bandwidth.
> Higher redundancy.Lower latency.Increased capacity.Completely compliant.
> http://p.sf.net/sfu/gigenet

> _______________________________________________
> tmux-users mailing list
> tmux-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tmux-users


------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to