aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ops.c
Commit message (Collapse)AuthorAge
* vim-patch:8.2.4649: various formatting problemszeertzjq2022-03-30
| | | | | | Problem: Various formatting problems. Solution: Improve the code formatting. https://github.com/vim/vim/commit/b4ad3b0deac12674a7773311890b48fd39c6807c
* fix(PVS/V1019): compound assignment expression is used inside conditionDundar Göc2022-03-24
|
* vim-patch:8.2.4593: unnecessary call to redraw_later() (#17775)zeertzjq2022-03-19
| | | | | Problem: Unnecessary call to redraw_later(). Solution: Remove the call to redraw_later() in op_yank(). (closes vim/vim#9971) https://github.com/vim/vim/commit/95d2e7634ccd8e0da78086002509a856999e180c
* Merge pull request #17653 from dundargoc/chore/lgtmzeertzjq2022-03-10
|\ | | | | fix lgtm warnings
| * chore(lgtm): fix "empty block without comment" warningsDundar Göc2022-03-09
| |
* | vim-patch:8.1.0999: use register one too often and not properly testedzeertzjq2022-03-09
| | | | | | | | | | | | | | Problem: Use register one too often and not properly tested. Solution: Do not always use register one when specifying a register. (closes vim/vim#4085) Add more tests. https://github.com/vim/vim/commit/9d7fdd403a3a9ee0d008b6dcbcd2ecc9ec0f57b7
* | refactor(ops): use op_yank_reg() instead of op_yank() when deletingzeertzjq2022-03-09
|/ | | | Needed for Vim patch 8.1.0999.
* vim-patch:8.2.0997: cannot execute a register containing line continuationzeertzjq2022-03-09
| | | | | | | | | | Problem: Cannot execute a register containing line continuation. Solution: Concatenate lines where needed. (Yegappan Lakshmanan, closes vim/vim#6272) https://github.com/vim/vim/commit/856c1110c1cf0d6e44e387b70732ca4b4c8ef0f2 According to #2542 the "Future:" part was removed intentionally. Use size_t in more places to reduce type casts.
* vim-patch:8.2.3601: check for overflow in put count does not work wellSean Dewar2022-02-17
| | | | | | | | | | | | | | | Problem: Check for overflow in put count does not work well. Solution: Improve the overflow check. (Ozaki Kiichi, closes vim/vim#9102) https://github.com/vim/vim/commit/fa53722367c3793fda95dac665af74b8651065e9 Add some casts as Nvim uses size_t variables in some places. We could technically adjust the logic to check for overflow outside of size_t's range, but it's much easier to just port the patch exactly (also means we can use the same tests). v:sizeoflong is N/A, so convert the 64-bit tests to Lua and use the FFI to check long's size.
* fix(ops): str_to_reg passing NULL to memcpySean Dewar2022-02-17
| | | | | | | Required for the tests introduced in v8.2.3601 to pass ASAN when running test_alot.vim. Co-authored-by: erw7 <erw7.github@gmail.com>
* vim-patch:8.2.3575: overflow check still fails when sizeof(int) == sizeof(long)Sean Dewar2022-02-17
| | | | | | | | | | Problem: Overflow check still fails when sizeof(int) == sizeof(long). Solution: Use a float to check the result. https://github.com/vim/vim/commit/e551ccfb9311eea5252d1c3106ff7a53c762d994 This approach is... interesting... Tests fail.
* vim-patch:8.2.3574: divide by zeroSean Dewar2022-02-17
| | | | | | Problem: Divide by zero. Solution: Don't check for overflow if multiplicand is zero. https://github.com/vim/vim/commit/8a1962d1355096af55e84b1ea2f0baf5f1c5a5bc
* vim-patch:8.2.3573: cannot decide whether to skip test that fails with 64 bitSean Dewar2022-02-17
| | | | | | | | | | Problem: Cannot decide whether to skip test that fails with 64 bit ints. (closes vim/vim#9072) Solution: Add v:sizeofint, v:sizeoflong and v:sizeofpointer. Improve the check for multiply overflow. https://github.com/vim/vim/commit/69b3072d984480935ec412b32b97fea974d2b689 Omit v:sizeof{int,long,pointer} as they're only really used for tests.
* vim-patch:8.2.3492: crash when pasting too many timesSean Dewar2022-02-17
| | | | | | | | | | | | | | | | | | | Problem: Crash when pasting too many times. Solution: Limit the size to what fits in an int. (closes vim/vim#8962) https://github.com/vim/vim/commit/eeed1c7ae090c17f4df51cf97b2a9e4d8b4f4dc7 Note that this overflow check pretty bad. It also doesn't work well on Windows (where sizeof(int) == sizeof(long)). This is all temporary; everything here is rewritten in future patches anyway. e_resulting_text_too_long was already cherry-picked. totlen is size_t in Nvim, but is int in Vim. This means we'll need some casts. We could technically adjust the logic in do_put to use the entire range of size_t in stuff like totlen, but there's not much gain, and it's much easier to just port the patch like Vim as was done before (also allows us to use the same tests).
* vim-patch:8.2.4388: dead code in op_insert()zeertzjq2022-02-15
| | | | | | Problem: Dead code in op_insert(). Solution: Remove condition and else block. (closes vim/vim#9782) https://github.com/vim/vim/commit/7745f14ef324a7134b2f26a47451cf5032f44b89
* vim-patch:8.2.3820: "vrc" does not replace composing characterszeertzjq2022-02-15
| | | | | | | | | | | | | Problem: "vrc" does not replace composing characters, while "rc" does. Solution: Check the byte length including composing characters. (closes vim/vim#9351) https://github.com/vim/vim/commit/8ee6028de3daa9af9e5f90fa9e583ff407bee04f vim-patch:8.2.3823: test for visual replace is in wrong function Problem: Test for visual replace is in wrong function. Solution: Move it to another function. https://github.com/vim/vim/commit/6ecf58b0d7d9b8fbba780d19d2e6c0f227df715b
* vim-patch:8.2.4151: reading beyond the end of a lineSean Dewar2022-02-14
| | | | | | Problem: Reading beyond the end of a line. Solution: For block insert only use the offset for correcting the length. https://github.com/vim/vim/commit/57df9e8a9f9ae1aafdde9b86b10ad907627a87dc
* vim-patch:8.2.4120: block insert goes over the end of the lineSean Dewar2022-02-14
| | | | | | Problem: Block insert goes over the end of the line. Solution: Handle invalid byte better. Fix inserting the wrong text. https://github.com/vim/vim/commit/9f8c304c8a390ade133bac29963dc8e56ab14cbc
* vim-patch:8.2.3073: when cursor is move for block append wrong text is insertedSean Dewar2022-02-14
| | | | | | | Problem: When cursor is move for block append wrong text is inserted. Solution: Calculate an offset. (Christian Brabandt, closes vim/vim#8433, closes vim/vim#8288) https://github.com/vim/vim/commit/4067bd3604215b48e4b4201e28f9e401b08418e4
* vim-patch:8.1.2221: cannot filter :disp outputzeertzjq2022-02-10
| | | | | | Problem: Cannot filter :disp output. Solution: Support filtereing :disp output. (Andi Massimino, closes vim/vim#5117) https://github.com/vim/vim/commit/8fc42964363087025a27e8c80276c706536fc4e3
* Merge pull request #17342 from zeertzjq/mbyte-constzeertzjq2022-02-10
|\ | | | | refactor(mbyte.c): add const qualifiers
| * refactor(mbyte.c): add const qualifierszeertzjq2022-02-09
| | | | | | | | | | This only touches functions that do not return a pointer. Also add a note about the differences between mb_head_off() and utf_head_off().
* | vim-patch:8.2.4242: put in Visual mode cannot be repeatedzeertzjq2022-02-09
|/ | | | | | | | | | Problem: Put in Visual mode cannot be repeated. Solution: Use "P" to put without yanking the deleted text into the unnamed register. (Shougo Matsushita, closes vim/vim#9591) https://github.com/vim/vim/commit/fb55207ed17918c8a2a6cadf5ad9d5fcf686a7ab Cherry-pick get_y_previous() and set_y_previous() from patch 8.1.1736. Nvim has removed y_current, so code related to it is N/A.
* Merge pull request #16818 from zeertzjq/vim-8.2.3454zeertzjq2022-02-03
|\ | | | | vim-patch:8.2.{3454,3455,3497,3540,3581,3678}: some "p" and "gp" patches
| * vim-patch:8.2.3678: illegal memory accesszeertzjq2022-01-29
| | | | | | | | | | | | Problem: Illegal memory access. Solution: Ignore changed indent when computing byte offset. https://github.com/vim/vim/commit/85be8563fe5aff686e9e30d6afff401ccd976f2a
| * vim-patch:8.2.3540: the mark '] is wrong after put with a countzeertzjq2022-01-29
| | | | | | | | | | | | Problem: The mark '] is wrong after put with a count. (Naohiro Ono) Solution: Use the right line number. (closes vim/vim#8956) https://github.com/vim/vim/commit/f47ebf1e1a0a6473b10fb4c92c9c6427aab4dc91
| * vim-patch:8.2.3455: using a count with "gp" leaves '] in wrong positionzeertzjq2022-01-29
| | | | | | | | | | | | Problem: Using a count with "gp" leaves '] in wrong position. (Naohiro Ono) Solution: Correct the mark position. (closes vim/vim#8899) https://github.com/vim/vim/commit/56858e4ed4e338e15821767b8303b06099e40384
| * vim-patch:8.2.3454: using a count with "gp" leave cursor in wrong positionzeertzjq2022-01-29
| | | | | | | | | | | | | | Problem: Using a count with "gp" leave cursor in wrong position. (Naohiro Ono) Solution: Count the inserted lines. (closes vim/vim#8899) https://github.com/vim/vim/commit/23003e51e18371afda4420d9e171a3dcba5a31cc
* | Merge pull request #17226 from dundargoc/refactor/remove-redundant-codezeertzjq2022-02-03
|\ \ | | | | | | vim-patch:8.2.4241: some type casts are redundant
| * | vim-patch:8.2.4241: some type casts are redundantDundar Göc2022-01-30
| |/ | | | | | | | | | | | | | | Problem: Some type casts are redundant. Solution: Remove the type casts. (closes vim/vim#9643) https://github.com/vim/vim/commit/420fabcd4ffeaf79082a6e43db91e1d363f88f27 This is not a literal port but an equivalent one.
* / vim-patch:8.2.3932: C line comment not formatted properlyzeertzjq2022-01-31
|/ | | | | | | Problem: C line comment not formatted properly. Solution: If a line comment follows after "#if" the next line is not the end of a paragraph. https://github.com/vim/vim/commit/264d3ddac0f9474816c20a0e92014d6f7f4b08ac
* vim-patch:8.1.2302: :lockmarks does not work for '[ and ']Sean Dewar2022-01-27
| | | | | | | | | Problem: :lockmarks does not work for '[ and ']. Solution: save and restore '[ and '] marks. (James McCoy, closes vim/vim#5222) https://github.com/vim/vim/commit/f4a1d1c0542df151bc59ac3b798ed198b5c71ccc Test_diff_maintains_change_mark doesn't actually fail without these changes. This is fixed in v8.2.3936.
* Merge pull request #17166 from Shougo/vim-8.2.4160bfredl2022-01-27
|\ | | | | vim-patch:8.2.4160: cannot change the register used for Select mode d…
| * vim-patch:8.2.4160: cannot change the register used for Select mode deleteShougo Matsushita2022-01-22
| | | | | | | | | | | | | | Problem: Cannot change the register used for Select mode delete. Solution: Make CTRL-R set the register to be used when deleting text for Select mode. (Shougo Matsushita, closes vim/vim#9531) https://github.com/vim/vim/commit/4ede01f18884961f2e008880b4964e5d61ea5c36
* | Merge pull request #17095 from zeertzjq/vim-8.2.3227bfredl2022-01-27
|\ \ | | | | | | vim-patch:8.2.{3227,3280,4094}: global-local 'virtualedit'
| * | vim-patch:8.2.3280: 'virtualedit' local to buffer is not the best solutionzeertzjq2022-01-15
| | | | | | | | | | | | | | | | | | Problem: 'virtualedit' local to buffer is not the best solution. Solution: Make it window-local. (Gary Johnson, closes vim/vim#8685) https://github.com/vim/vim/commit/51ad850f5fbafa7aa3f60affa74ec9c9f992c6cc
| * | vim-patch:8.2.3227: 'virtualedit' can only be set globallyzeertzjq2022-01-15
| |/ | | | | | | | | | | | | | | Problem: 'virtualedit' can only be set globally. Solution: Make 'virtualedit' global-local. (Gary Johnson, closes vim/vim#8638) https://github.com/vim/vim/commit/53ba05b09075f14227f9be831a22ed16f7cc26b2 I changed some macros to unsigned integer literals to avoid compiler warnings.
* | vim-patch:8.2.4219: reading before the start of the lineChristian Clason2022-01-26
| | | | | | | | | | | | Problem: Reading before the start of the line. Solution: Check boundary before trying to read the character. https://github.com/vim/vim/commit/44db8213d38c39877d2148eff6a72f4beccfb94e
* | refactor: remove CSI unescaping and clean up related names and commentszeertzjq2022-01-21
|/
* vim-patch:8.1.2375: no suffucient testing for registerszeertzjq2022-01-14
| | | | | | | | | | | | Problem: No suffucient testing for registers. Solution: Add more test cases. (Yegappan Lakshmanan, closes vim/vim#5296) Fix that "p" on last virtual column of tab inserts spaces. https://github.com/vim/vim/commit/6f1f0ca3edf395102ff3109c998d81300c8be3c9 This patch doesn't actually change any behavior in Nvim, because Nvim always has vartabs feature. I modified a line in the test because of #6137.
* feat(autocmd): populate v:event in RecordingLeave (#16828)Axel Dahlberg2022-01-04
|
* vim-patch:8.2.3914 (#16808)dundargoc2021-12-28
| | | | | | | | | * vim-patch:8.2.3914: various spelling mistakes in comments Problem: Various spelling mistakes in comments. Solution: Fix the mistakes. (Dominique Pellé, closes vim/vim#9416) https://github.com/vim/vim/commit/af4a61a85d6e8cacc35324f266934bc463a21673 Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* feat(autocmd): add Recording autocmdsThomas Vigouroux2021-12-18
| | | | | | | | | | | | | | feat(eval): add reg_recorded() This function is used the get the last recorded register. style(Recording): rename handler to match suggestions fix(RecordingLeave): send autocommand earlier This makes the autocommand fire just before setting reg_recorded to reg_recording, this way we clearly show that we are actually just before actually quitting the recording mode.
* refactor(misc1): move out high-level input functions to a new file: input.cBjörn Linse2021-12-10
| | | | | Possibly dialog code is messages.c could be moved here as well. misc1.c is now empty, so delete it.
* vim-patch:8.1.2104: the normal.c file is too big (#16389)Volodymyr Kot2021-12-06
| | | | | | Problem: The normal.c file is too big. Solution: Move do_pending_operator() to ops.c. (Yegappan Lakshmanan, closes vim/vim#4999). https://github.com/vim/vim/commit/792cf5e1bec04c6d6d70cfbb9ef24c798b469731
* Merge pull request #15840 from vimpostor/vim-8.2.3430Jan Edmund Lazo2021-11-30
|\ | | | | vim-patch:8.2.{3430,3434,3462,3463,3555,3609,3610}: ModeChanged autocmd
| * vim-patch:8.2.3609: internal error when ModeChanged is triggered recursivelyMagnus Groß2021-11-18
| | | | | | | | | | | | | | | | | | | | | | | | Problem: Internal error when ModeChanged is triggered when v:event is already in use. Solution: Save and restore v:event if needed. https://github.com/vim/vim/commit/3075a45592fe76f2febb6321632a23e352efe949 In the vim codebase there is no occurrence of get_vim_var_dict(VV_EVENT) after the above patch, so in order to hold the same invariant in the neovim codebase we needed to replace more occurrences than the related vim patch.
* | vim-patch:8.2.3687: blockwise insert does not handle autoindent properlyChristian Clason2021-11-28
| | | | | | | | | | | | | | | | Problem: Blockwise insert does not handle autoindent properly when tab is inserted. Solution: Adjust text column for indent before computing column. (closes vim/vim#9229) https://github.com/vim/vim/commit/59f4f9505ae7ca2499904b94100db103e5ada5a6
* | vim-patch:8.2.3684: blockwise insert does not handle autoindent properlyChristian Clason2021-11-27
| | | | | | | | | | | | Problem: Blockwise insert does not handle autoindent properly. Solution: Adjust text column for indent. (closes vim/vim#9229) https://github.com/vim/vim/commit/e9b0b40b7978f683977922233b42dd439ef31920
* | vim-patch:8.2.3677: after a put the '] mark is on the last byte (#16442)Christian Clason2021-11-26
| | | | | | | | | | | | Problem: After a put the '] mark is on the last byte of a multi-byte character. Solution: Move it to the first byte. (closes vim/vim#9047) https://github.com/vim/vim/commit/4d07253a485819b3a9fd923d263e722ea2109c12