Update of /cvsroot/tmux/tmux
In directory vz-cvs-2.sog:/tmp/cvs-serv22136

Modified Files:
        window-copy.c 
Log Message:
Sync OpenBSD patchset 897:

Tweak copy behaviour slightly in vi mode to be closer to real vi. From
Tiago Resende.


Index: window-copy.c
===================================================================
RCS file: /cvsroot/tmux/tmux/window-copy.c,v
retrieving revision 1.129
retrieving revision 1.130
diff -u -d -r1.129 -r1.130
--- window-copy.c       25 Apr 2011 20:33:42 -0000      1.129
+++ window-copy.c       25 Apr 2011 20:34:26 -0000      1.130
@@ -1225,6 +1225,7 @@
        size_t                           off;
        u_int                            i, xx, yy, sx, sy, ex, ey, limit;
        u_int                            firstsx, lastex, restex, restsx;
+       int                              keys;
 
        if (!s->sel.flag)
                return;
@@ -1261,6 +1262,14 @@
         * end (restex) of all other lines.
         */
        xx = screen_size_x(s);
+
+       /*
+        * Behave according to mode-keys. If it is emacs, copy like emacs,
+        * keeping the top-left-most character, and dropping the
+        * bottom-right-most, regardless of copy direction. If it is vi, also
+        * keep bottom-right-most character.
+        */
+       keys = options_get_number(&wp->window->options, "mode-keys");
        if (data->rectflag) {
                /*
                 * Need to ignore the column with the cursor in it, which for
@@ -1268,8 +1277,14 @@
                 */
                if (data->selx < data->cx) {
                        /* Selection start is on the left. */
-                       lastex = data->cx;
-                       restex = data->cx;
+                       if (keys == MODEKEY_EMACS) {
+                               lastex = data->cx;
+                               restex = data->cx;
+                       }
+                       else {
+                               lastex = data->cx + 1;
+                               restex = data->cx + 1;
+                       }
                        firstsx = data->selx;
                        restsx = data->selx;
                } else {
@@ -1280,11 +1295,10 @@
                        restsx = data->cx;
                }
        } else {
-               /*
-                * Like emacs, keep the top-left-most character, and drop the
-                * bottom-right-most, regardless of copy direction.
-                */
-               lastex = ex;
+               if (keys == MODEKEY_EMACS)
+                       lastex = ex;
+               else    
+                       lastex = ex + 1;
                restex = xx;
                firstsx = sx;
                restsx = 0;


------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
tmux-cvs mailing list
tmux-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-cvs

Reply via email to