Change (inspired by an IRC discussion with Nicholas):

Typing the end-of-line key once will bring you to the end of the textual
content of the current row on the screen.
If the current row contains only a portion of a line had wrapped onto
the next row, then typing the end-of-line key again will bring you to
the end of the complete, wrapped line.
When a rectangular selection is active, typing it the second time will
bring you to the right edge of the screen (even if it's past the end of
the line of text), and doesn't do anything special with wrapped lines.

-- 
Micah J. Cowan
http://micah.cowan.name/
Index: sf/window-copy.c
===================================================================
--- sf.orig/window-copy.c	2010-02-18 18:20:20.000000000 -0800
+++ sf/window-copy.c	2010-02-18 20:08:47.000000000 -0800
@@ -1304,12 +1304,28 @@ void
 window_copy_cursor_end_of_line(struct window_pane *wp)
 {
 	struct window_copy_mode_data	*data = wp->modedata;
+	struct screen			*base_s = &wp->base;
+	struct grid			*gd = base_s->grid;
 	u_int				 px, py;
 
-	py = screen_hsize(&wp->base) + data->cy - data->oy;
+	py = screen_hsize(base_s) + data->cy - data->oy;
 	px = window_copy_find_length(wp, py);
 
+	if (data->cx == px) {
+		if (data->screen.sel.flag && data->rectflag)
+			px = screen_size_x(&wp->base);
+		if (gd->linedata[py].flags & GRID_LINE_WRAPPED) {
+			while (py < gd->sy + gd->hsize
+			       && gd->linedata[py].flags & GRID_LINE_WRAPPED) {
+				window_copy_cursor_down(wp, 0);
+				py = screen_hsize(&wp->base)
+				     + data->cy - data->oy;
+			}
+			px = window_copy_find_length(wp, py);
+		}
+	}
 	window_copy_update_cursor(wp, px, data->cy);
+
 	if (window_copy_update_selection(wp))
 		window_copy_redraw_lines(wp, data->cy, 1);
 }
@@ -1388,7 +1404,8 @@ window_copy_cursor_up(struct window_pane
 	if (!data->screen.sel.flag || !data->rectflag) {
 		py = screen_hsize(&wp->base) + data->cy - data->oy;
 		px = window_copy_find_length(wp, py);
-		if (data->cx >= data->lastsx || data->cx > px)
+		if ((data->cx >= data->lastsx && data->cx != px)
+		    || data->cx > px)
 			window_copy_cursor_end_of_line(wp);
 	}
 }
@@ -1421,7 +1438,8 @@ window_copy_cursor_down(struct window_pa
 	if (!data->screen.sel.flag || !data->rectflag) {
 		py = screen_hsize(&wp->base) + data->cy - data->oy;
 		px = window_copy_find_length(wp, py);
-		if (data->cx >= data->lastsx || data->cx > px)
+		if ((data->cx >= data->lastsx && data->cx != px)
+		    || data->cx > px)
 			window_copy_cursor_end_of_line(wp);
 	}
 }
Index: sf/tmux.1
===================================================================
--- sf.orig/tmux.1	2010-02-18 20:12:34.000000000 -0800
+++ sf/tmux.1	2010-02-18 20:21:40.000000000 -0800
@@ -679,6 +679,15 @@ in emacs mode, and
 .Ql 10w
 in vi.
 .Pp
+Typing the end-of-line key once will bring you to the end of the textual
+content of the current row on the screen.
+If the current row contains only a portion of a line had wrapped onto
+the next row, then typing the end-of-line key again will bring you to
+the end of the complete, wrapped line.
+When a rectangular selection is active, typing it the second time will
+bring you to the right edge of the screen (even if it's past the end of
+the line of text), and doesn't do anything special with wrapped lines.
+.Pp
 These key bindings are defined in a set of named tables:
 .Em vi-edit
 and
------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to