This change broke it by accident because it worked by accident... you
can see the same problem if you have the text below, go to the second
line column 0, press C-e and then press up. The cursor will stay at
column 0:

aaaaaaaaaa
aaaaaaaaaaaaaaaaa

The logic is right for up and down, we need to replace the last cursor
position only if we are not at the EOL. But this fails if we explicitly
move to the end of the line.

Maybe this. Although I suspect there are other cases we also need to do
the same:

Index: window-copy.c
===================================================================
RCS file: /cvs/src/usr.bin/tmux/window-copy.c,v
retrieving revision 1.80
diff -u -p -r1.80 window-copy.c
--- window-copy.c       1 Apr 2012 20:53:47 -0000       1.80
+++ window-copy.c       29 May 2012 08:58:37 -0000
@@ -1578,6 +1578,7 @@ window_copy_cursor_end_of_line(struct wi
                }
        }
        window_copy_update_cursor(wp, px, data->cy);
+       data->lastsx = 0;
 
        if (window_copy_update_selection(wp))
                window_copy_redraw_lines(wp, data->cy, 1);
@@ -1630,7 +1631,7 @@ window_copy_cursor_up(struct window_pane
 
        oy = screen_hsize(data->backing) + data->cy - data->oy;
        ox = window_copy_find_length(wp, oy);
-       if (data->cx != ox) {
+       if (data->lastsx == 0 || data->cx != ox) {
                data->lastcx = data->cx;
                data->lastsx = ox;
        }
@@ -1672,7 +1673,7 @@ window_copy_cursor_down(struct window_pa
 
        oy = screen_hsize(data->backing) + data->cy - data->oy;
        ox = window_copy_find_length(wp, oy);
-       if (data->cx != ox) {
+       if (data->lastsx == 0 || data->cx != ox) {
                data->lastcx = data->cx;
                data->lastsx = ox;
        }




On Fri, May 25, 2012 at 12:41:59PM +0100, Thomas Adam wrote:
> Hi,
> 
> On Wed, May 23, 2012 at 11:34:52AM -0400, Ben Boeckel wrote:
> > Hi,
> > 
> > When making a block selection, it appears as though the x position is
> > not properly remembered when '$' is used.
> 
> This is related to this change:
> 
> commit c87e6bb9218cabee91cbc58be850f56bd65e11af
> Author: tcunha <tcunha@303bd1e2-03bb-47f1-b221-2a0928954661>
> Date:   Sun Mar 18 01:35:39 2012 +0000
> 
>     Sync OpenBSD patchset 1046:
> 
> diff --git a/trunk/window-copy.c b/trunk/window-copy.c
> index a8b7d25..3ba650e 100644
> --- a/trunk/window-copy.c
> +++ b/trunk/window-copy.c
> @@ -1629,7 +1629,7 @@ window_copy_cursor_up(struct window_pane *wp, int 
> scroll_only)
> 
>         oy = screen_hsize(data->backing) + data->cy - data->oy;
>         ox = window_copy_find_length(wp, oy);
> -       if (ox != 0) {
> +       if (data->cx != ox) {
>                 data->lastcx = data->cx;
>                 data->lastsx = ox;
>         }
> @@ -1671,7 +1671,7 @@ window_copy_cursor_down(struct window_pane *wp, int 
> scroll_only)
> 
>         oy = screen_hsize(data->backing) + data->cy - data->oy;
>         ox = window_copy_find_length(wp, oy);
> -       if (ox != 0) {
> +       if (data->cx != ox) {
>                 data->lastcx = data->cx;
>                 data->lastsx = ox;
>         }
> 
> Does reverting this fix it for you?  (I'm only reading the code here; not
> actually tried this.)
> 
> It might be worthwhile checking data->rectflag or somesuch, and
> conditionally only turn on the feature this patch addresses if _not_ in
> rectangle mode.  Not sure.
> 
> -- Thomas Adam
> 
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> tmux-users mailing list
> tmux-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tmux-users

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to