On Sun, Jan 24, 2010 at 11:35:34AM -0800, Micah Cowan wrote:
> Nicholas Marriott wrote:
> > Ugh, another copy mode bug.
> > 
> > Thanks for your diff.
> > 
> > We need to redraw two lines because if the $ is at the end of the line it 
> > will
> > have been scrolled.
> > 
> > I think it is enough just to change window_copy_write_line, although I'll 
> > move
> > the check up a bit I think.
> 
> It is, of course, but the advantage to changing it in
> window_copy_redraw_lines() as well, is if ny is, say, 10, and we're at
> the second-to-last line, then it won't make a series of useless calls to
> window_copy_write_line()... though maybe window_copy_redraw_lines() is
> never called with so many, without knowing what the proper number should be.

I don't think it will ever be called with sufficient lines that that would make
a difference, but it may actually be better to actually fix the callers
instead.

The other cases look okay to me.

Index: window-copy.c
===================================================================
RCS file: /cvsroot/tmux/tmux/window-copy.c,v
retrieving revision 1.94
diff -u -p -r1.94 window-copy.c
--- window-copy.c       4 Dec 2009 22:14:47 -0000       1.94
+++ window-copy.c       24 Jan 2010 20:33:31 -0000
@@ -1075,6 +1075,7 @@ void
 window_copy_cursor_up(struct window_pane *wp, int scroll_only)
 {
        struct window_copy_mode_data    *data = wp->modedata;
+       struct screen                   *s = &data->screen;
        u_int                            ox, oy, px, py;
 
        oy = screen_hsize(&wp->base) + data->cy - data->oy;
@@ -1087,12 +1088,20 @@ window_copy_cursor_up(struct window_pane
        data->cx = data->lastcx;
        if (scroll_only || data->cy == 0) {
                window_copy_scroll_down(wp, 1);
-               if (scroll_only)
-                       window_copy_redraw_lines(wp, data->cy, 2);
+               if (scroll_only) {
+                       if (data->cy == screen_size_y(s) - 1)
+                               window_copy_redraw_lines(wp, data->cy, 1);
+                       else
+                               window_copy_redraw_lines(wp, data->cy, 2);
+               }
        } else {
                window_copy_update_cursor(wp, data->cx, data->cy - 1);
-               if (window_copy_update_selection(wp))
-                       window_copy_redraw_lines(wp, data->cy, 2);
+               if (window_copy_update_selection(wp)) {
+                       if (data->cy == screen_size_y(s) - 1)
+                               window_copy_redraw_lines(wp, data->cy, 1);
+                       else
+                               window_copy_redraw_lines(wp, data->cy, 2);
+               }
        }
 
        py = screen_hsize(&wp->base) + data->cy - data->oy;

------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to