aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/edit.c
Commit message (Collapse)AuthorAge
...
* vim-patch:8.2.0674: some source files are too big (#19959)zeertzjq2022-08-26
| | | | | | | | | Problem: Some source files are too big. Solution: Move text formatting functions to a new file. (Yegappan Lakshmanan, closes vim/vim#6021) https://github.com/vim/vim/commit/11abd095210fc84e5dcee87b9baed86061caefe4 Cherry-pick set_can_cindent() from patch 8.1.2062. Cherry-pick global old_indent from patch 8.2.2127.
* refactor: change FALSE/TRUE to false/trueLewis Russell2022-08-26
| | | | Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* refactor: replace char_u with charDundar Goc2022-08-25
| | | | Work on https://github.com/neovim/neovim/issues/459
* refactor: pre-incr to post-incrLewis Russell2022-08-25
|
* vim-patch:partial:8.2.4001: insert complete code uses global variableszeertzjq2022-08-25
| | | | | | | | | | Problem: Insert complete code uses global variables. Solution: Make variables local to the file and use accessor functions. (Yegappan Lakshmanan, closes vim/vim#9470) https://github.com/vim/vim/commit/d94fbfc74a8b8073e7a256c95fa6f39fc527c726 Skip changes in comments for callback-related functions (not ported). Also make compl_busy static again.
* vim-patch:8.2.3944: insert mode completion functions are too longzeertzjq2022-08-24
| | | | | | | | | Problem: Insert mode completion functions are too long. Solution: Split up into multiple functions. (Yegappan Lakshmanan, closes vim/vim#9431) https://github.com/vim/vim/commit/5d2e007ccbfbd749a1f201d06965b8811ff50e6e Cherry-pick can_cindent_get() -> get_can_cindent() from patch 8.1.2062.
* vim-patch:9.0.0206: redraw flags are not named specifically (#19913)zeertzjq2022-08-23
| | | | | Problem: Redraw flags are not named specifically. Solution: Prefix "UPD_" to the flags, for UPDate_screen(). https://github.com/vim/vim/commit/a4d158b3c839e96ed98ff87c7b7124ff4518c4ff
* fix(edit.c): indentkeys double indent after "!" #12894Axel Forsman2022-08-21
| | | | | | | | | | | | | which is both unexpected and different from the Vim behaviour. Indent was triggered once by the '!' check in insert_execute(), and inserting the char was correctly skipped, but then triggered again in insert_check() (provided that cindent was not being ignored after manual indentation, i.e. `can_cindent == true`). While this is the smallest fix, another solution would be to remove VimState#check and instead move that to *_enter()/-_execute(), since the control flow is pretty unnecessarily convoluted as is. That would also have the benefit of differing less from the Vim source code.
* refactor: move statusline code from buffer.c and [draw]screen.c to new filebfredl2022-08-19
| | | | | | | | | problem: code for drawing statusline is arbitrarily spreadout between drawscreen.c, screen.c and buffer.c solution: move it to a new file statusline.c - rename archaic internal name "status match" to public name "wildmenu" - showruler() does not show the ruler. it show anything which displays info about the cursor. Rename it accordingy.
* vim-patch:8.1.2057: the screen.c file is much too bigLewis Russell2022-08-19
| | | | | | | | | | | | | | | Problem: The screen.c file is much too big. Solution: Split it in three parts. (Yegappan Lakshmanan, closes vim/vim#4943) https://github.com/vim/vim/commit/7528d1f6b5422750eb778dfb550cfd0b0e540964 This is an approximation vim-patch 8.1.2057. Applying the patch directly isn't feasible since our version of screen.c has diverged too much, however we still introduce drawscreen.c and drawline.c: - screen.c is now a much smaller file used for low level screen functions - drawline.c contains everything needed for win_line() - drawscreen.c contains everything needed for update_screen() Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* vim-patch:8.1.2082: rename popupmnu.* to popupmenu.* (#19829)zeertzjq2022-08-18
| | | | | | | vim-patch:8.1.2082: some files have a weird name to fit in 8.3 characters Problem: Some files have a weird name to fit in 8.3 characters. Solution: Use a nicer names. https://github.com/vim/vim/commit/30e8e73506e4522ef4aebf7d525c0e6ffe8805fd
* refactor: remove some unused includes (#19820)zeertzjq2022-08-17
| | | Replace grid.h in screen.h and screen.h in buffer.h with grid_defs.h
* refactor: change pre-decrement/increment to post (#19799)Lewis Russell2022-08-16
| | | Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* vim-patch:8.1.1189: mode is not cleared when leaving Insert modezeertzjq2022-08-15
| | | | | | Problem: Mode is not cleared when leaving Insert mode. Solution: Clear the mode when got_int is set. (Ozaki Kiichi, closes vim/vim#4270) https://github.com/vim/vim/commit/abc7c7fc5a098374f5543a237e6c9dd918848b34
* vim-patch:partial:8.1.0822: peeking and flushing output slows down executionzeertzjq2022-08-15
| | | | | | | | | | | | | | | | | Problem: Peeking and flushing output slows down execution. Solution: Do not update the mode message when global_busy is set. Do not flush when only peeking for a character. (Ken Takata) https://github.com/vim/vim/commit/cb574f415486adff645ce384979bfecf27f5be8c Omit inchar() change: it breaks too many tests. N/A patches for version.c: vim-patch:8.2.5170: tiny issues Problem: Tiny issues. Solution: Tiny improvements. https://github.com/vim/vim/commit/944cc9ceba8868acd238264d4a3894803c566b37
* refactor: replace char_u with charDundar Goc2022-08-12
| | | | Work on https://github.com/neovim/neovim/issues/459
* feat(terminal): implement <c-\><c-o> for terminal modebfredl2022-08-02
| | | | this works similar to <c-o> or <c-\><c-o> in insert mode
* vim-patch:9.0.0124: code has more indent than neededzeertzjq2022-08-01
| | | | | | Problem: Code has more indent than needed. Solution: Use continue and return statements. (closes vim/vim#10824) https://github.com/vim/vim/commit/101d57b34b72f4fbc7df1b6edfd64c64a6be14fc
* vim-patch:8.1.1076: file for Insert mode is much too bigzeertzjq2022-07-20
| | | | | | | | | | | | Problem: File for Insert mode is much too big. Solution: Split off the code for Insert completion. (Yegappan Lakshmanan, closes vim/vim#4044) https://github.com/vim/vim/commit/7591bb39d58ece38a5fef984a08ea9012616c1f9 Cherry-pick ins_compl_len() -> get_compl_len() from patch 8.2.4001. Revert a71c5e9eb98fbb2ca88510269935cdcda37369fc: ctrl_x_mode is no longer a global variable, so l_ctrl_x_mode is no longer needed.
* vim-patch:8.2.2427: can still switch windows for 'completefunc'zeertzjq2022-07-17
| | | | | | | | | | Problem: Can still switch windows for 'completefunc'. Solution: Also disallow switching windows for other completions. https://github.com/vim/vim/commit/3eb6bd9c2b36dcce471bfb543c8d5488f1dc17a4 Assert E565 instead of E578. Need to assert a different string because patch 8.2.1919 hasn't been ported yet.
* vim-patch:8.2.2426: allowing 'completefunc' to switch windows causes troublezeertzjq2022-07-17
| | | | | | | | | | | | | | | | | | | | | | Problem: Allowing 'completefunc' to switch windows causes trouble. Solution: use "textwinlock" instead of "textlock". https://github.com/vim/vim/commit/28976e2accf11591c60e8a658a9e03544f0408b2 Assert E565 instead of E578. vim-patch:8.2.0670: cannot change window when evaluating 'completefunc' Problem: Cannot change window when evaluating 'completefunc'. Solution: Make a difference between not changing text or buffers and also not changing window. https://github.com/vim/vim/commit/6adb9ea0a6ca01414f4b591f379b0f829a8273c0 vim-patch:8.2.5029: "textlock" is always zero Problem: "textlock" is always zero. Solution: Remove "textlock" and rename "textwinlock" to "textlock". (closes vim/vim#10489) https://github.com/vim/vim/commit/cfe456543e840d133399551f8626d985e1fb1958
* vim-patch:8.2.0614: get ml_get error when deleting a line in 'completefunc' ↵zeertzjq2022-07-07
| | | | | | | | | | | | | (#19244) Problem: Get ml_get error when deleting a line in 'completefunc'. (Yegappan Lakshmanan) Solution: Lock the text while evaluating 'completefunc'. https://github.com/vim/vim/commit/ff06f283e3e4b3ec43012dd3b83f8454c98f6639 Fix a mistake in the porting of patch 8.1.0098. Cherry-pick Test_run_excmd_with_text_locked() from patch 8.2.0270. Cherry-pick test_gf.vim changes from patch 8.2.0369. Cherry-pick message change from later patches.
* vim-patch:7.4.212zeertzjq2022-07-06
| | | | | | | Problem: Now that the +visual feature is always enabled the #ifdefs for it are not useful. Solution: Remove the checks for FEAT_VISUAL. https://github.com/vim/vim/commit/f7ff6e85e8a4e84cff023f5db4b66ef85986605a
* feat: add 'mousescroll' option (#12355)Jay2022-07-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add 'mousescroll' option to control how many lines to scroll by when a mouse wheel keycode is received. The mousescroll option controls both horizontal and vertical scrolling. The option is a string in the format: set mousescroll=direction:count,direction:count Where direction is either "ver" or "hor", and count is a non negative integer. If a direction is omitted, a default value is used. The default values remain unchanged, that is 3 for vertical scrolling, and 6 for horizontal scrolling. As such, the mousescroll default is "ver:3,hor:6". Add mousescroll documentation - Add option documentation in options.txt - Add brief summary in quickref.txt Update :help scroll-mouse-wheel - Mention mousescroll option as a means of controlling scrolling. - Remove obsolete suggestion to map scroll wheel keys to <C-U> to scroll by a single line -- users should prefer the mousescroll option. - Add some information about the consequences of remapping scroll wheel keys (they lose their magic ability to affect inactive windows). Update :help vim-differences - Add brief mousescroll summary under Options Add mousescroll tests - Test option validation - Test default mousescroll value and behavior - Test fallback to default values - Test mouse vertical and horizontal scrolling in normal mode - Test mouse vertical and horizontal scrolling in insert mode
* vim-patch:8.2.5162: reading before the start of the line with BS in Replace ↵zeertzjq2022-07-06
| | | | | | | mode (#19241) Problem: Reading before the start of the line with BS in Replace mode. Solution: Check the cursor column is more than zero. https://github.com/vim/vim/commit/0971c7a4e537ea120a6bb2195960be8d0815e97b
* vim-patch:8.2.3615: wrong indent in first line if re-formatting with indent exprzeertzjq2022-07-05
| | | | | | | | Problem: When re-formatting with an indent expression the first line of a paragraph may get the wrong indent. (Martin F. Krafft) Solution: Apply the correct indenting function for the first line. (Christian Brabandt, closes vim/vim#9150, closes vim/vim#9056) https://github.com/vim/vim/commit/818ff25cd1aabf60b9cd239da2f1328a959954f7
* refactor: replace char_uDundar Goc2022-07-02
| | | | Work on https://github.com/neovim/neovim/issues/459
* feat(marks): restore viewport on jump #15831Javier Lopez2022-06-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ** Refactor Previously most functions used to "get" a mark returned a position, changed the line number and sometimes changed even the current buffer. Now functions return a {x}fmark_T making calling context aware whether the mark is in another buffer without arcane casting. A new function is provided for switching to the mark buffer and returning a flag style Enum to convey what happen in the movement. If the cursor changed, line, columns, if it changed buffer, etc. The function to get named mark was split into multiple functions. - mark_get() -> fmark_T - mark_get_global() -> xfmark_T - mark_get_local() -> fmark_T - mark_get_motion() -> fmark_T - mark_get_visual() -> fmark_T Functions that manage the changelist and jumplist were also modified to return mark types. - get_jumplist -> fmark_T - get_changelist -> fmark_T The refactor is also seen mainly on normal.c, where all the mark movement has been siphoned through one function nv_gomark, while the other functions handle getting the mark and setting their movement flags. To handle whether context marks should be left, etc. ** Mark View While doing the refactor the concept of a mark view was also implemented: The view of a mark currently implemented as the number of lines between the mark position on creation and the window topline. This allows for moving not only back to the position of a mark but having the window look similar to when the mark was defined. This is done by carrying and extra element in the fmark_T struct, which can be extended later to also restore horizontal shift. *** User space features 1. There's a new option, jumpoptions+=view enables the mark view restoring automatically when using the jumplist, changelist, alternate-file and mark motions. <C-O> <C-I> g; g, <C-^> '[mark] `[mark] ** Limitations - The view information is not saved in shada. - Calls to get_mark should copy the value in the pointer since we are using pos_to_mark() to wrap and provide a homogeneous interfaces. This was also a limitation in the previous state of things.
* refactor: replace char_u #18429dundargoc2022-06-28
| | | Work on https://github.com/neovim/neovim/issues/459
* vim-patch:8.2.5022: 'completefunc'/'omnifunc' error does not end completion ↵zeertzjq2022-06-25
| | | | | | | | (#19083) Problem: 'completefunc'/'omnifunc' error does not end completion. Solution: Check if there was an error or exception. (closes vim/vim#10486, closes vim/vim#4218) https://github.com/vim/vim/commit/9bcb9ca9c7dd1632385dc3351b5e019739368658
* refactor: move some mapping-related code to a separate file (#19061)zeertzjq2022-06-23
| | | | | | | | | | | | | | | | | | | This marks the following Vim patches as ported: vim-patch:8.1.1785: map functionality mixed with character input Problem: Map functionality mixed with character input. Solution: Move the map functionality to a separate file. (Yegappan Lakshmanan, closes vim/vim#4740) Graduate the +localmap feature. https://github.com/vim/vim/commit/b66bab381c8ba71fd6e92327d1d34c6f8a65f2a7 vim-patch:8.2.3643: header for source file is outdated Problem: Header for source file is outdated. Solution: Make the header more accurate. (closes vim/vim#9186) https://github.com/vim/vim/commit/a3f83feb63eae5464a620ae793c002eb45f7a838 Also cherry-pick a change for <unique> mappings from patch 8.2.0807. Rename map_clear_mode() to do_mapclear().
* vim-patch:8.2.1898: command modifier parsing always uses global cmdmodzeertzjq2022-06-14
| | | | | | Problem: Command modifier parsing always uses global cmdmod. Solution: Pass in cmdmod_T to use. Rename struct fields consistently. https://github.com/vim/vim/commit/e10044015841711b989f9a898d427bcc1fdb4c32
* refactor: change type of linenr_T from long to int32_tDundar Goc2022-06-10
| | | | | | | | | | | | | The size of long varies depending on architecture, in contrast to the MAXLNUM constant which sets the maximum allowable number of lines to 2^32-1. This discrepancy may lead to hard to detect bugs, for example https://github.com/neovim/neovim/issues/18454. Setting linenr_T to a fix maximum size of 2^32-1 will prevent this type of errors in the future. Also change the variables `amount` and `amount_after` to be linenr_T since they're referring to "the line number difference" between two texts.
* refactor: missing parenthesis may cause unexpected problems (#17443)kylo2522022-05-26
| | | related vim-8.2.{4402,4639}
* refactor(uncrustify): set maximum number of consecutive newlines to 2 (#18695)dundargoc2022-05-25
|
* vim-patch:8.2.5008: when 'formatoptions' contains "/" wrongly wrapping ↵zeertzjq2022-05-23
| | | | | | | | comment (#18717) Problem: When 'formatoptions' contains "/" wrongly wrapping a long trailing comment. Solution: Pass the OPENLINE_FORMAT flag. https://github.com/vim/vim/commit/7e667788150be617aeac42b0d668618ac33ab9da
* refactor!: delete insertmode (#18547)Gregory Anders2022-05-22
| | | | | | | Neovim already removed `evim` (or any similar flags). The 'insertmode' option is a weird remnant, so get rid of it. The 'insertmode' option is replaced with a script that closely emulates the option. This script is documented at :help 'insertmode'
* vim-patch:8.2.4993: smart/C/lisp indenting is optional (#18684)zeertzjq2022-05-22
| | | | | | Problem: smart/C/lisp indenting is optional, which makes the code more complex, while it only reduces the executable size a bit. Solution: Graduate FEAT_CINDENT, FEAT_SMARTINDENT and FEAT_LISP. https://github.com/vim/vim/commit/8e145b82464a21ee4fdf7948f04e2a1d505f8bfa
* refactor: grid->rows and grid->colsbfredl2022-05-18
|
* vim-patch:8.2.4969: changing text in Visual mode may cause invalid memory accesszeertzjq2022-05-17
| | | | | | Problem: Changing text in Visual mode may cause invalid memory access. Solution: Check the Visual position after making a change. https://github.com/vim/vim/commit/7ce5b2b590256ce53d6af28c1d203fb3bc1d2d97
* refactor: replace char_u variables and functions with charDundar Goc2022-05-16
| | | | Work on https://github.com/neovim/neovim/issues/459
* vim-patch:8.2.4953: with 'si' inserting '}' after completion goes wrongzeertzjq2022-05-14
| | | | | | Problem: With 'smartindent' inserting '}' after completion goes wrong. Solution: Check the cursor is in indent. (closes vim/vim#10420) https://github.com/vim/vim/commit/2e444bbef0f36535bf941f007f2961f3f66bbe87
* vim-patch:8.2.4951: smart indenting done when not enabledzeertzjq2022-05-14
| | | | | | Problem: Smart indenting done when not enabled. Solution: Check option values before setting can_si. (closes vim/vim#10420) https://github.com/vim/vim/commit/de5cf287812510d2c8ffe66b99cf33c4e1a6e6f1
* Merge pull request #18489 from dundargoc/refactor/remove-char_ubfredl2022-05-13
|\ | | | | refactor: replace char_u variables and functions with char
| * refactor: replace char_u variables and functions with charDundar Goc2022-05-11
| | | | | | | | Work on https://github.com/neovim/neovim/issues/459
* | refactor: rename keymap.{c,h} to keycodes.{c,h} (#18535)zeertzjq2022-05-12
|/ | | | | | | | Most code in keymap.h is for keycode definitions, while most code in keymap.c is for the parsing and conversion of keycodes. The name "keymap" may also make people think these two files are for mappings, while in fact keycodes are used even when no mappings are involved, so "keycodes" should be a better file name than "keymap".
* vim-patch:8.2.4911: the mode #defines are not clearly named (#18499)zeertzjq2022-05-10
| | | | | | | | Problem: The mode #defines are not clearly named. Solution: Prepend MODE_. Renumber them to put the mapped modes first. https://github.com/vim/vim/commit/249591057b4840785c50e41dd850efb8a8faf435 A hunk from the patch depends on patch 8.2.4861, which hasn't been ported yet, but that should be easy to notice.
* refactor: replace char_u variables and functions with charDundar Goc2022-05-09
| | | | Work on https://github.com/neovim/neovim/issues/459
* vim-patch:8.2.4908: no text formatting for // comment after a statement (#18472)zeertzjq2022-05-08
| | | | | Problem: No text formatting for // comment after a statement. Solution: format a comment when the 'c' flag is in 'formatoptions'. https://github.com/vim/vim/commit/48a8a833033e10fc1eba96f2fc8dd19c2408eddf
* Merge pull request #18425 from dundargoc/refactor/char_u/1bfredl2022-05-07
|\ | | | | refactor: replace char_u variables and functions with char