home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / old / 5.5.011 < prev    next >
Encoding:
Internet Message Format  |  1999-09-29  |  3.1 KB

  1. To: vim-dev@vim.org
  2. Subject: patch 5.5.011
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. ------------
  6.  
  7. Patch 5.5.011
  8. Problem:    After "CTRL-V s", the cursor jumps back to the start, while all
  9.             other operators leave the cursor on the last changed character.
  10.             (Xiangjiang Ma)
  11. Solution:   Position cursor on last changed character, if possible.
  12. Files:      src/ops.c 
  13.  
  14.  
  15. *** ../vim-5.5.10/src/ops.c    Wed Sep 22 10:06:29 1999
  16. --- src/ops.c    Thu Sep 30 19:26:47 1999
  17. ***************
  18. *** 1978,1984 ****
  19.        * In Visual block mode, handle copying the next text to all lines of the
  20.        * block.
  21.        */
  22. !     if (oap->block_mode)
  23.       {
  24.       firstline = ml_get(oap->start.lnum);
  25.       /*
  26. --- 1978,1984 ----
  27.        * In Visual block mode, handle copying the next text to all lines of the
  28.        * block.
  29.        */
  30. !     if (oap->block_mode && oap->start.lnum != oap->end.lnum)
  31.       {
  32.       firstline = ml_get(oap->start.lnum);
  33.       /*
  34. ***************
  35. *** 1989,1994 ****
  36. --- 1989,1997 ----
  37.       {
  38.           if ((ins_text = alloc_check((unsigned)(ins_len + 1))) != 0)
  39.           {
  40. +         /* put cursor at end of changed text */
  41. +         curwin->w_cursor = oap->end;
  42.           STRNCPY(ins_text, firstline + bd.textcol, ins_len);
  43.           *(ins_text + ins_len) = NUL;
  44.           for (linenr = oap->start.lnum + 1;
  45. ***************
  46. *** 2005,2026 ****
  47.                   continue;
  48.               /* copy up to block start */
  49.               mch_memmove(newp, oldp, (size_t)bd.textcol);
  50. !             for (offset = 0; offset < ins_len ; offset++)
  51.                   *(newp + bd.textcol + offset) = *(ins_text
  52.                                       + offset);
  53.               oldp += bd.textcol;
  54.               mch_memmove(newp + bd.textcol + offset, oldp,
  55.                                   STRLEN(oldp) + 1);
  56.               ml_replace(linenr, newp, FALSE);
  57.               }
  58.           }
  59. !         curwin->w_cursor.col = oap->start.col;
  60. !         changed_cline_bef_curs();    /* recompute cursor posn. */
  61.           approximate_botline();        /* w_botline may be wrong now */
  62.           adjust_cursor();
  63.   
  64.           changed();
  65. !         update_screen(VALID_TO_CURSCHAR);
  66.           }
  67.           vim_free(ins_text);
  68.       }
  69. --- 2008,2030 ----
  70.                   continue;
  71.               /* copy up to block start */
  72.               mch_memmove(newp, oldp, (size_t)bd.textcol);
  73. !             for (offset = 0; offset < ins_len; offset++)
  74.                   *(newp + bd.textcol + offset) = *(ins_text
  75.                                       + offset);
  76.               oldp += bd.textcol;
  77.               mch_memmove(newp + bd.textcol + offset, oldp,
  78.                                   STRLEN(oldp) + 1);
  79.               ml_replace(linenr, newp, FALSE);
  80. +             if (linenr == oap->end.lnum)
  81. +                 curwin->w_cursor.col = bd.textcol + ins_len - 1;
  82.               }
  83.           }
  84. !         changed_line_abv_curs();    /* recompute cursor posn. */
  85.           approximate_botline();        /* w_botline may be wrong now */
  86.           adjust_cursor();
  87.   
  88.           changed();
  89. !         update_screen(NOT_VALID);
  90.           }
  91.           vim_free(ins_text);
  92.       }
  93. *** ../vim-5.5.10/src/version.c    Wed Sep 29 22:31:20 1999
  94. --- src/version.c    Thu Sep 30 19:31:34 1999
  95. ***************
  96. *** 420,420 ****
  97. --- 420,421 ----
  98.   {   /* Add new patch number below this line */
  99. +     11,
  100.  
  101. --
  102. hundred-and-one symptoms of being an internet addict:
  103. 233. You start dreaming about web pages...in html.
  104.  
  105. --/-/---- Bram Moolenaar ---- Bram@moolenaar.net ---- Bram@vim.org ---\-\--
  106.   \ \    www.vim.org/iccf      www.moolenaar.net       www.vim.org    / /
  107.