summaryrefslogtreecommitdiffstats
path: root/src/edit.c
AgeCommit message (Collapse)Author
2024-03-28patch 9.1.0218: Unnecessary multiplications in backspace codev9.1.0218zeertzjq
Problem: Unnecessary multiplications in backspace code, as "col / ts * ts" is the same as "col - col % ts". Solution: Change "col / ts * ts" to "col - col % ts". Adjust the loop and the comments ins_bs() to be easier to understand. Update tests to reset 'smarttab' properly. (zeertzjq) closes: #14308 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-28patch 9.1.0215: Half-page scrolling does not support smooth-scrollingv9.1.0215Luuk van Baal
Problem: Page-wise scrolling with Ctrl-D/Ctrl-U implements it's own logic to change the topline and cursor. More logic than necessary for scrolling with Ctrl-F/Ctrl-B was removed in patch 9.1.0211. Solution: Re-use the logic from Ctrl-E/Ctrl-Y/Ctrl-F/Ctrl-B while staying backward compatible as much as possible. Restore some of the logic that determined how many lines will be scrolled (Luuk van Baal) closes: #14316 Signed-off-by: Luuk van Baal <luukvbaal@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-25patch 9.1.0204: Backspace inserts spaces with virtual text and 'smarttab'v9.1.0204zeertzjq
Problem: Backspace inserts spaces with virtual text and 'smarttab'. Solution: Ignore virtual text and wrapping when backspacing. (zeertzjq) related: neovim/neovim#28005 closes: #14296 Co-authored-by: VanaIgr <vanaigranov@gmail.com> Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-12patch 9.1.0172: More code can use ml_get_buf_len() instead of STRLEN()v9.1.0172zeertzjq
Problem: More code can use ml_get_buf_len() instead of STRLEN(). Solution: Change more STRLEN() calls to ml_get_buf_len(). Also do not set ml_line_textlen in ml_replace_len() if "has_props" is set, because "len_arg" also includes the size of text properties in that case. (zeertzjq) closes: #14183 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-11patch 9.1.0168: too many STRLEN() callsv9.1.0168John Marriott
Problem: too many STRLEN() calls Solution: Make use of ml_get_len() calls instead (John Marriott) closes: #14123 Signed-off-by: John Marriott <basilisk@internode.on.net> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-10patch 9.1.0163: Calling STRLEN() to compute ml_line_textlen when not neededv9.1.0163zeertzjq
Problem: Calling STRLEN() to compute ml_line_textlen when not needed. Solution: Use 0 when STRLEN() will be required and call STRLEN() later. (zeertzjq) closes: #14155 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-06patch 9.1.0153: Text properties corrupted with fo+=aw and backspacev9.1.0153zeertzjq
Problem: Text properties corrupted with fo+=aw and backspace Solution: Allocate line and move text properties (zeertzjq) closes: #14147 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-05patch 9.1.0151: ml_get_buf_len() does not consider text propertiesv9.1.0151Christian Brabandt
Problem: ml_get_buf_len() does not consider text properties (zeertzj) Solution: Store text length excluding text properties length in addition in the memline related #14123 closes: #14133 Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-02-09patch 9.1.0088: TextChanged not triggered for :norm! commandsv9.1.0088Christian Brabandt
Problem: TextChanged not triggered for :norm! commands (machakann, after v9.0.2031) Solution: Only reset curbuf->b_last_changedtick if TextChangedI was triggered in insert mode (and not blocked) Note: for unknown reasons, the test fails on Windows (but seems to work fine when running interactively) fixes: #13967 closes: #13984 Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-01-25patch 9.1.0058: Cannot map Super Keys in GTK UIv9.1.0058Casey Tucker
Problem: Cannot map Super Keys in GTK UI (Casey Tucker) Solution: Enable Super Key mappings in GTK using <D-Key> (Casey Tucker) As a developer who works in both Mac and Linux using the same keyboard, it can be frustrating having to remember different key combinations or having to rely on system utilities to remap keys. This change allows `<D-z>` `<D-x>` `<D-c>` `<D-v>` etc. to be recognized by the `map` commands, along with the `<D-S-...>` shifted variants. ```vimrc if has('gui_gtk') nnoremap <D-z> u nnoremap <D-S-Z> <C-r> vnoremap <D-x> "+d vnoremap <D-c> "+y cnoremap <D-v> <C-R>+ inoremap <D-v> <C-o>"+gP nnoremap <D-v> "+P vnoremap <D-v> "-d"+P nnoremap <D-s> :w<CR> inoremap <D-s> <C-o>:w<CR> nnoremap <D-w> :q<CR> nnoremap <D-q> :qa<CR> nnoremap <D-t> :tabe<CR> nnoremap <D-S-T> :vs#<CR><C-w>T nnoremap <D-a> ggVG vnoremap <D-a> <ESC>ggVG inoremap <D-a> <ESC>ggVG nnoremap <D-f> / nnoremap <D-g> n nnoremap <D-S-G> N vnoremap <D-x> "+x endif ``` closes: #12698 Signed-off-by: Casey Tucker <dctucker@hotmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-01-16patch 9.1.0035: i_CTRL-] triggers InsertCharPrev9.1.0035altermo
Problem: i_CTRL-] triggers InsertCharPre Solution: Return if CTRL-] is received. InsertCharPre is supposed to be only used for chars to be inserted but i_CTRL-] triggers expansion and is not inserted into the buffer (altermo) closes: #13853 closes: #13864 Signed-off-by: altermo Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-01-05patch 9.1.0014: incorrect use of W_WINROW in edit.cv9.1.0014zeertzjq
Problem: incorrect use of W_WINROW in edit.c Solution: compare against curwin->w_height instead Remove incorrect use of W_WINROW In structs.h it is mentioned that w_wrow is relative to w_winrow, so using W_WINROW doesn't make sense when comparing with window height. This change won't lead to any observable behavior change: The condition intends to check if there are 'scrolloff' lines between the current cursor when the bottom of the window. When W_WINROW(curwin) is added to curwin->w_height - 1 - get_scrolloff_value(), the condition is instead satisfied when the cursor is on some screen line below that position. However, - If 'scrolloff' is smaller than half the window height, this condition can only be satisfied when W_WINROW(curwin) == 0. And if it is not satisfied, update_topline() does the actual scrolling. - If 'scrolloff' is larger than half the window height, update_topline() will put the cursor at the center of the window soon afterwards anyway, because set_topline() now unsets VALID_TOPLINE flag starting from https://github.com/vim/vim-history/commit/7db7bb45b0f919ff0615d463ebd4fde881c69d1f. To put it in another way, https://github.com/vim/vim-history/commit/7db7bb45b0f919ff0615d463ebd4fde881c69d1f makes the update_topline() just below correct the mistakes made in this block, so this incorrect use of W_WINROW() no longer affects observable behavior. closes: #12331 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-01-04patch 9.1.0006: is*() and to*() function may be unsafev9.1.0006Keith Thompson
Problem: is*() and to*() function may be unsafe Solution: Add SAFE_* macros and start using those instead (Keith Thompson) Use SAFE_() macros for is*() and to*() functions The standard is*() and to*() functions declared in <ctype.h> have undefined behavior for negative arguments other than EOF. If plain char is signed, passing an unchecked value from argv for from user input to one of these functions has undefined behavior. Solution: Add SAFE_*() macros that cast the argument to unsigned char. Most implementations behave sanely for negative arguments, and most character values in practice are non-negative, but it's still best to avoid undefined behavior. The change from #13347 has been omitted, as this has already been separately fixed in commit ac709e2fc0db6d31abb7da96f743c40956b60c3a (v9.0.2054) fixes: #13332 closes: #13347 Signed-off-by: Keith Thompson <Keith.S.Thompson@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-12-03patch 9.0.2145: wrong scrolling in insert mode with smoothscrollv9.0.2145zeertzjq
Problem: Wrong scrolling in Insert mode with 'smoothscroll' at the bottom of the window. Solution: Don't use set_topline() when 'smoothscroll' is set. fixes: #13612 closes: #13613 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-10-27patch 9.0.2075: TextChangedI may not always triggerv9.0.2075Christian Brabandt
Problem: TextChangedI may not always trigger Solution: trigger it in more cases: for insert/ append/change operations, and when opening a new line, fixes: #13367 closes: #13375 Signed-off-by: Christian Brabandt <cb@256bit.org> Signed-off-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com>
2023-10-15patch 9.0.2031: TextChangedI may be triggered by non-insert mode changev9.0.2031Evgeni Chasnovski
Problem: `TextChangedI` can trigger on entering Insert mode if there was previously a change not in Insert mode. Solution: Make it trigger only when text is actually changed in Insert mode. closes: #13265 closes: #13338 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com>
2023-09-02patch 9.0.1852: i_CTRL-O does not reset Select Modev9.0.1852pierreganty
Problem: i_CTRL-O does not reset Select Mode Solution: Reset select mode on CTRL-O in insert mode closes: #13001 closes: #12115 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-08-22patch 9.0.1783: Display issues with virt text smoothscroll and showbreakv9.0.1783zeertzjq
Problem: Wrong display with wrapping virtual text or unprintable chars, 'showbreak' and 'smoothscroll'. Solution: Don't skip cells taken by 'showbreak' in screen lines before "w_skipcol". Combined "n_skip" and "skip_cells". closes: #12597 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2023-06-02patch 9.0.1599: Cursor not adjusted when 'splitkeep' is not "cursor"v9.0.1599Luuk van Baal
Problem: Cursor not adjusted when near top or bottom of window and 'splitkeep' is not "cursor". Solution: Move boundary checks to outer cursor move functions, inner functions should only return valid cursor positions. (Luuk van Baal, closes #12480)
2023-05-20patch 9.0.1571: RedrawingDisabled not used consistentlyv9.0.1571Bram Moolenaar
Problem: RedrawingDisabled not used consistently. Solution: Avoid RedrawingDisabled going negative. Set RedrawingDisabled in win_split_ins(). (closes #11961)
2023-05-12patch 9.0.1545: text not scrolled when cursor moved with "g0" and "h"v9.0.1545Luuk van Baal
Problem: Text not scrolled when cursor moved with "g0" and "h". Solution: Adjust w_skipcol when needed. (Luuk van Baal, closes #12387)
2023-03-26patch 9.0.1429: invalid memory access when ending insert modev9.0.1429Bram Moolenaar
Problem: Invalid memory access when ending insert mode. Solution: Check if the insert_skip value is valid.
2023-03-25patch 9.0.1428: cursor in wrong position when leaving insert modev9.0.1428Bram Moolenaar
Problem: Cursor in wrong position when leaving insert mode. Solution: Update the w_valid flags. Position the cursor also when not redrawing. (closes #12137)
2023-02-26patch 9.0.1356: cannot cancel "gr" with Escv9.0.1356zeertzjq
Problem: Cannot cancel "gr" with Esc. Solution: Make "gr<Esc>" do nothing. (closes #12064)
2023-02-25patch 9.0.1354: "gr CTRL-G" stays in virtual replace modev9.0.1354Bram Moolenaar
Problem: "gr CTRL-G" stays in virtual replace mode. (Pierre Ganty) Solution: Prepend CTRL-V before control characters. (closes #12045)
2023-02-23patch 9.0.1349: "gr" with a count failsv9.0.1349Bram Moolenaar
Problem: "gr" with a count fails. Solution: Break out of the loop only after using the count.
2023-02-23patch 9.0.1347: "gr CTRL-O" stays in Insert modev9.0.1347Bram Moolenaar
Problem: "gr CTRL-O" stays in Insert mode. (Pierre Ganty) Solution: Do not set restart_edit when "cmdchar" is 'v'. (closes #12045)
2023-02-21patch 9.0.1336: functions without arguments are not always declared properlyv9.0.1336Yegappan Lakshmanan
Problem: Functions without arguments are not always declared properly. Solution: Use "(void)" instead of "()". (Yegappan Lakshmanan, closes #12031)
2023-01-09patch 9.0.1166: code is indented more than necessaryv9.0.1166Yegappan Lakshmanan
Problem: Code is indented more than necessary. Solution: Use an early return where it makes sense. (Yegappan Lakshmanan, closes #11792)
2023-01-01patch 9.0.1126: bracketed paste can be enabled when it is not recognizedv9.0.1126Bram Moolenaar
Problem: Bracketed paste can be enabled when pasted text is not recognized. Solution: Output t_BE only when t_PS and t_PE are set.
2022-12-27patch 9.0.1105: code is indented too muchv9.0.1105Yegappan Lakshmanan
Problem: Code is indented too much. Solution: Use an early return. (Yegappan Lakshmanan, closes #11756)
2022-12-08patch 9.0.1036: undo misbehaves when writing from an insert mode mappingv9.0.1036Bram Moolenaar
Problem: Undo misbehaves when writing from an insert mode mapping. Solution: Sync undo when writing. (closes #11674)
2022-12-01patch 9.0.0980: the keyboard state response may end up in a shell commandv9.0.0980Bram Moolenaar
Problem: The keyboard state response may end up in a shell command. Solution: Only request the keyboard protocol state when the typeahead is empty, no more commands are following and not exiting. Add the t_RK termcap entry for this.
2022-11-23patch 9.0.0930: cannot debug the Kitty keyboard protocol with TermDebugv9.0.0930Bram Moolenaar
Problem: Cannot debug the Kitty keyboard protocol with TermDebug. Solution: Add Kitty keyboard protocol support to the libvterm fork. Recognize the escape sequences that the protocol generates. Add the 'keyprotocol' option to allow the user to specify for which terminal what protocol is to be used, instead of hard-coding this. Add recognizing the kitty keyboard protocol status.
2022-11-22patch 9.0.0917: the WinScrolled autocommand event is not enoughv9.0.0917Bram Moolenaar
Problem: The WinScrolled autocommand event is not enough. Solution: Add WinResized and provide information about what changed. (closes #11576)
2022-11-15patch 9.0.0886: horizontal mouse scroll only works in the GUIv9.0.0886Christopher Plewright
Problem: Horizontal mouse scroll only works in the GUI. Solution: Make horizontal mouse scroll also work in a terminal. (Christopher Plewright, closes #11448)
2022-10-14patch 9.0.0751: 'scrolloff' does not work well with 'smoothscroll'v9.0.0751Bram Moolenaar
Problem: 'scrolloff' does not work well with 'smoothscroll'. Solution: Make positioning the cursor a bit better. Rename functions.
2022-10-13patch 9.0.0747: too many #ifdefsv9.0.0747Martin Tournoij
Problem: Too many #ifdefs. Solution: Gradudate the +cmdline_info feature. (Martin Tournoij, closes #11330)
2022-10-12patch 9.0.0734: cursor position invalid when scrolling with 'smoothscroll'v9.0.0734Bram Moolenaar
Problem: Cursor position invalid when scrolling with 'smoothscroll' set. (Ernie Rael) Solution: Add w_valid_skipcol and clear flags when it changes. Adjust w_skipcol after moving the cursor.
2022-10-05patch 9.0.0664: bad redrawing with spell checking, using "C" and "$" in 'cpo'v9.0.0664Bram Moolenaar
Problem: Bad redrawing with spell checking, using "C" and "$" in 'cpo'. Solution: Do not redraw the next line when "$" is in 'cpo'. (closes #11285)
2022-10-04patch 9.0.0657: too many #ifdefsv9.0.0657Martin Tournoij
Problem: Too many #ifdefs. Solution: Graduate the +cmdwin feature. Now the tiny and small builds are equal, drop the small build. (Martin Tournoij, closes #11268)
2022-09-27patch 9.0.0608: with spelling, deleting a full stop does not update next linev9.0.0608Bram Moolenaar
Problem: With spell checking, deleting a full stop at the end of a line does not update SpellCap at the start of the next line. Solution: Update the next line when characters have been deleted. Also when using undo.
2022-09-27patch 9.0.0603: with 'nosplitscroll' folds are not handled correctlyv9.0.0603Luuk van Baal
Problem: With 'nosplitscroll' folds are not handled correctly. Solution: Take care of closed folds when moving the cursor. (Luuk van Baal, closes #11234)
2022-09-25patch 9.0.0590: after exiting Insert mode spelling not checked in next linev9.0.0590Bram Moolenaar
Problem: After exiting Insert mode spelling is not checked in the next line. Solution: When spelling is enabled redraw the next line after exiting Insert mode in case the spell highlight needs updating.
2022-08-16patch 9.0.0218: reading before the start of the linev9.0.0218Bram Moolenaar
Problem: Reading before the start of the line. Solution: When displaying "$" check the column is not negative.
2022-08-14patch 9.0.0206: redraw flags are not named specificallyv9.0.0206Bram Moolenaar
Problem: Redraw flags are not named specifically. Solution: Prefix "UPD_" to the flags, for UPDate_screen().
2022-08-01patch 9.0.0130: cursor position wrong when inserting around virtual textv9.0.0130Bram Moolenaar
Problem: Cursor position wrong when inserting around virtual text. Solution: Update the cursor position properly.
2022-07-31patch 9.0.0124: code has more indent than neededv9.0.0124zeertzjq
Problem: Code has more indent than needed. Solution: Use continue and return statements. (closes #10824)
2022-07-25patch 9.0.0067: cannot show virtual textv9.0.0067Bram Moolenaar
Problem: Cannot show virtual text. Solution: Initial changes for virtual text support, using text properties.
2022-06-30patch 9.0.0013: reproducing memory access errors can be difficultv9.0.0013Bram Moolenaar
Problem: Reproducing memory access errors can be difficult. Solution: When testing, copy each line to allocated memory, so that valgrind can detect accessing memory before and/or after it. Fix uncovered problems.