OSDN Git Service

1行全体を選択した状態でCOPYコマンドを実行した時にカーソルが下の行の先頭に移動するように。
authormogami <mogami@0568b783-4c39-0410-ac80-bf13821ea2a2>
Tue, 23 Dec 2003 06:26:47 +0000 (06:26 +0000)
committermogami <mogami@0568b783-4c39-0410-ac80-bf13821ea2a2>
Tue, 23 Dec 2003 06:26:47 +0000 (06:26 +0000)
src/autopick.c

index ac5a415..0ba5096 100644 (file)
@@ -5368,12 +5368,29 @@ static bool do_editor_command(text_body_type *tb, int com_id)
                /*
                 * Move cursor position to the end of the selection
                 *
-                * Pressing ^C ^V correctly results in duplication of
-                * the selection.
+                * Pressing ^C ^V correctly duplicates the selection.
                 */
                if (tb->my == tb->cy)
                {
                        tb->cx = MAX(tb->cx, tb->mx);
+
+                       /*
+                        * When whole line is selected, the end of
+                        * line code is also copyed.
+                        */
+                       if (!tb->lines_list[tb->cy][tb->cx])
+                       {
+                               /* Is this the last line? */
+                               if (!tb->lines_list[tb->cy + 1])
+                               {
+                                       /* Add one more empty line if possible */
+                                       if (!add_empty_line(tb)) break;
+                               }
+
+                               /* Go to the beginning of next line */
+                               tb->cy++;
+                               tb->cx = 0;
+                       }
                }
                else
                {