Mercurial > vim
comparison src/ops.c @ 15987:29de75f53b1a v8.1.0999
patch 8.1.0999: use register one too often and not properly tested
commit https://github.com/vim/vim/commit/9d7fdd403a3a9ee0d008b6dcbcd2ecc9ec0f57b7
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Mar 8 09:50:52 2019 +0100
patch 8.1.0999: use register one too often and not properly tested
Problem: Use register one too often and not properly tested.
Solution: Do not always use register one when specifying a register.
(closes #4085) Add more tests.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 08 Mar 2019 10:00:07 +0100 |
parents | ddd82b1c9e9d |
children | a14d8b4ef2b0 |
comparison
equal
deleted
inserted
replaced
15986:77b7032bb373 | 15987:29de75f53b1a |
---|---|
1745 char_u *ptr; | 1745 char_u *ptr; |
1746 char_u *newp, *oldp; | 1746 char_u *newp, *oldp; |
1747 struct block_def bd; | 1747 struct block_def bd; |
1748 linenr_T old_lcount = curbuf->b_ml.ml_line_count; | 1748 linenr_T old_lcount = curbuf->b_ml.ml_line_count; |
1749 int did_yank = FALSE; | 1749 int did_yank = FALSE; |
1750 int orig_regname = oap->regname; | |
1751 | 1750 |
1752 if (curbuf->b_ml.ml_flags & ML_EMPTY) /* nothing to do */ | 1751 if (curbuf->b_ml.ml_flags & ML_EMPTY) /* nothing to do */ |
1753 return OK; | 1752 return OK; |
1754 | 1753 |
1755 /* Nothing to delete, return here. Do prepare undo, for op_change(). */ | 1754 /* Nothing to delete, return here. Do prepare undo, for op_change(). */ |
1831 did_yank = TRUE; | 1830 did_yank = TRUE; |
1832 } | 1831 } |
1833 | 1832 |
1834 /* | 1833 /* |
1835 * Put deleted text into register 1 and shift number registers if the | 1834 * Put deleted text into register 1 and shift number registers if the |
1836 * delete contains a line break, or when a regname has been specified. | 1835 * delete contains a line break, or when using a specific operator (Vi |
1836 * compatible) | |
1837 * Use the register name from before adjust_clip_reg() may have | 1837 * Use the register name from before adjust_clip_reg() may have |
1838 * changed it. | 1838 * changed it. |
1839 */ | 1839 */ |
1840 if (orig_regname != 0 || oap->motion_type == MLINE | 1840 if (oap->motion_type == MLINE || oap->line_count > 1 |
1841 || oap->line_count > 1 || oap->use_reg_one) | 1841 || oap->use_reg_one) |
1842 { | 1842 { |
1843 shift_delete_registers(); | 1843 shift_delete_registers(); |
1844 if (op_yank(oap, TRUE, FALSE) == OK) | 1844 if (op_yank(oap, TRUE, FALSE) == OK) |
1845 did_yank = TRUE; | 1845 did_yank = TRUE; |
1846 } | 1846 } |