Hi. What's the behaviour here before and after?

On Wed, Jun 12, 2013 at 02:17:57AM -0400, Ben Boeckel wrote:
> Because we first move to the first column, then down, on the last line,
> the first column is to "the right" of the last column. To fix this, the
> current line is checked and if it changed, *then* the start of the line
> motion is used. Similar logic is done for the first line.
> ---
>  window-copy.c | 17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/window-copy.c b/window-copy.c
> index b8286e8..325c29f 100644
> --- a/window-copy.c
> +++ b/window-copy.c
> @@ -1622,10 +1622,16 @@ void
>  window_copy_cursor_left(struct window_pane *wp)
>  {
>       struct window_copy_mode_data    *data = wp->modedata;
> +     u_int                            py;
>  
>       if (data->cx == 0) {
> +             /* Remember the current line. */
> +             py = data->cy;
> +
>               window_copy_cursor_up(wp, 0);
> -             window_copy_cursor_end_of_line(wp);
> +
> +             if (data->cy != py)
> +                     window_copy_cursor_end_of_line(wp);
>       } else {
>               window_copy_update_cursor(wp, data->cx - 1, data->cy);
>               if (window_copy_update_selection(wp))
> @@ -1647,8 +1653,15 @@ window_copy_cursor_right(struct window_pane *wp)
>       }
>  
>       if (data->cx >= px) {
> -             window_copy_cursor_start_of_line(wp);
> +             /* Remember the current line. */
> +             py = data->cy;
> +
>               window_copy_cursor_down(wp, 0);
> +
> +             /* If there is no line after the current line, there
> +              * is no need to move to the start of the line. */
> +             if (data->cy != py)
> +                     window_copy_cursor_start_of_line(wp);
>       } else {
>               window_copy_update_cursor(wp, data->cx + 1, data->cy);
>               if (window_copy_update_selection(wp))
> -- 
> 1.8.2.1
> 
> 
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
> 
> Build for Windows Store.
> 
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> tmux-users mailing list
> tmux-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tmux-users

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to