aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/change.c
Commit message (Collapse)AuthorAge
...
* refactor(change): do API changes to buffer without curbuf switchbfredl2023-08-26
| | | | | | | | | | | | | | | | | | | | | | | Most of the messy things when changing a non-current buffer is not about the buffer, it is about windows. In particular, it is about `curwin`. When editing a non-current buffer which is displayed in some other window in the current tabpage, one such window will be "borrowed" as the curwin. But this means if two or more non-current windows displayed the buffers, one of them will be treated differenty. this is not desirable. In particular, with nvim_buf_set_text, cursor _column_ position was only corrected for one single window. Two new tests are added: the test with just one non-current window passes, but the one with two didn't. Two corresponding such tests were also added for nvim_buf_set_lines. This already worked correctly on master, but make sure this is well-tested for future refactors. Also, nvim_create_buf no longer invokes autocmds just because you happened to use `scratch=true`. No option value was changed, therefore OptionSet must not be fired.
* refactor(memline): distinguish mutating uses of ml_get_buf()bfredl2023-08-24
| | | | | | | | | | | | | | ml_get_buf() takes a third parameters to indicate whether the caller wants to mutate the memline data in place. However the vast majority of the call sites is using this function just to specify a buffer but without any mutation. This makes it harder to grep for the places which actually perform mutation. Solution: Remove the bool param from ml_get_buf(). it now works like ml_get() except for a non-current buffer. Add a new ml_get_buf_mut() function for the mutating use-case, which can be grepped along with the other ml_replace() etc functions which can modify the memline.
* fix(events): avoid unnecessary CursorMoved (#24675)zeertzjq2023-08-12
| | | | | | Problem: Temporarily changing current window in a script causes CursorMoved to be triggerd. Solution: Don't trigger CursorMoved if neither curwin nor cursor changed between two checks.
* refactor: remove longdundargoc2023-07-03
| | | | | long is 32-bits even on 64-bit windows which makes the type suboptimal for a codebase meant to be cross-platform.
* vim-patch:9.0.0664: bad redrawing with spell checking, using "C" and "$" in ↵Luuk van Baal2023-05-25
| | | | | | | | | | | 'cpo' Problem: Bad redrawing with spell checking, using "C" and "$" in 'cpo'. Solution: Do not redraw the next line when "$" is in 'cpo'. (closes vim/vim#11285) https://github.com/vim/vim/commit/f3ef026c9897f1d2e3fba47166a4771d507dae91 Co-authored-by: Bram Moolenaar <Bram@vim.org>
* vim-patch:9.0.0608: with spelling, deleting a full stop does not update next ↵Luuk van Baal2023-05-25
| | | | | | | | | | | | | line 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. https://github.com/vim/vim/commit/26f09ea54b2c60abf21df42c60bdfc60eca17b0d Co-authored-by: Bram Moolenaar <Bram@vim.org>
* vim-patch:9.0.1551: position of marker for 'smoothscroll' not computed ↵luukvbaal2023-05-14
| | | | | | | | | correctly (#23617) Problem: Position of marker for 'smoothscroll' not computed correctly. Solution: Take 'list' and other options into account. (Luuk van Baal, closes vim/vim#12393) https://github.com/vim/vim/commit/24b62ec8258cc7c9ca2c09f645f7f6b02584c892
* vim-patch:9.0.1543: display errors when making topline shorterLuuk van Baal2023-05-11
| | | | | | | | | Problem: Display errors when making topline shorter and 'smoothscroll' is set. Solution: Reset w_skipcol when the topline becomes shorter than its current value. (Luuk van Baal, closes vim/vim#12367) https://github.com/vim/vim/commit/5d01f86d99bc3a3fd92d4f4e9338a9e78e9ebe16
* refactor: uncrustifydundargoc2023-04-26
| | | | Notable changes: replace all infinite loops to `while(true)` and remove `int` from `unsigned int`.
* refactor(clang-tidy): remove redundant castsdundargoc2023-04-26
|
* refactor: remove redundant castsii142023-04-07
|
* refactor: remove use of reserved c++ keywordsii142023-04-06
| | | | | | libnvim couldn't be easily used in C++ due to the use of reserved keywords. Additionally, add explicit casts to *alloc function calls used in inline functions, as C++ doesn't allow implicit casts from void pointers.
* vim-patch:9.0.0194: cursor displayed in wrong position after removing text ↵zeertzjq2023-03-17
| | | | | | | | | | | prop (#22706) Problem: Cursor displayed in wrong position after removing text prop. (Ben Jackson) Solution: Invalidate the cursor position. (closes vim/vim#10898) https://github.com/vim/vim/commit/326c5d36e7cb8526330565109c17b4a13ff790ae Co-authored-by: Bram Moolenaar <Bram@vim.org>
* refactor(screen): screen.c delenda estbfredl2023-03-14
| | | | | | | | | | | | | drawscreen.c vs screen.c makes absolutely no sense. The screen exists only to draw upon it, therefore helper functions are distributed randomly between screen.c and the file that does the redrawing. In addition screen.c does a lot of drawing on the screen. It made more sense for vim/vim as our grid.c is their screen.c Not sure if we want to dump all the code for option chars into optionstr.c, so keep these in a optionchar.c for now.
* vim-patch:partial:9.0.0013: reproducing memory access errors can be difficultzeertzjq2023-03-04
| | | | | | | | | | | | | | | | | | 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. https://github.com/vim/vim/commit/fa4873ccfc10e0f278dc46f39d00136fab059b19 Since test_override() is N/A, enable ml_get_alloc_lines when ASAN is enabled instead, so it also applies to functional tests. Use xstrdup() to copy the line as ml_line_len looks hard to port. Squash the test changes from patch 9.0.0016. Co-authored-by: Bram Moolenaar <Bram@vim.org>
* vim-patch:9.0.1279: display shows lines scrolled down erroneously (#22126)zeertzjq2023-02-05
| | | | | | | | Problem: Display shows lines scrolled down erroneously. (Yishai Lerner) Solution: Do not change "wl_lnum" at index zero. (closes vim/vim#11938) https://github.com/vim/vim/commit/61fdbfa1e3c842252b701aec12f45839ca41ece5 Co-authored-by: Bram Moolenaar <Bram@vim.org>
* vim-patch:9.0.1213: adding a line below the last one does not expand fold ↵zeertzjq2023-01-18
| | | | | | | | | | | (#21869) Problem: Adding a line below the last one does not expand fold. Solution: Do not skip mark_adjust() when adding lines below the last one. (Brandon Simmons, closes vim/vim#11832, closes vim/vim#10698) https://github.com/vim/vim/commit/da3dd7d857ba4fb4bf408dedd1d9d6a2d5e2ae9f Co-authored-by: Brandon Simmons <simmsbra@gmail.com>
* refactor: replace char_u with char 17 - remove STRLCPY (#21235)dundargoc2023-01-09
| | | | | refactor: replace char_u with char Work on https://github.com/neovim/neovim/issues/459
* refactor: replace char_u with chardundargoc2022-11-28
| | | | Work on https://github.com/neovim/neovim/issues/459
* refactor: replace char_u with charDundar Göc2022-11-26
| | | | Work on https://github.com/neovim/neovim/issues/459
* build: allow IWYU to fix includes for all .c filesdundargoc2022-11-15
| | | | | | | | | | Allow Include What You Use to remove unnecessary includes and only include what is necessary. This helps with reducing compilation times and makes it easier to visualise which dependencies are actually required. Work on https://github.com/neovim/neovim/issues/549, but doesn't close it since this only works fully for .c files and not headers.
* vim-patch:8.2.1919: assert_fails() setting emsg_silent changes normal ↵zeertzjq2022-11-11
| | | | | | | | | | | | execution (#20998) Problem: Assert_fails() setting emsg_silent changes normal execution. Solution: Use a separate flag in_assert_fails. https://github.com/vim/vim/commit/28ee892ac4197421b3317f195512ca64cc56a5b4 Cherry-pick no_wait_return from patch 9.0.0846. Co-authored-by: Bram Moolenaar <Bram@vim.org>
* vim-patch:9.0.0819: still a build error, tests are failingzeertzjq2022-10-30
| | | | | | | | | | | Problem: Still a build error, tests are failing. Solution: Correct recent changes. Add missing init for 'eof'. https://github.com/vim/vim/commit/1577537f109d97a975fda9a899cacfb598617767 vim-patch:1577537f109d Co-authored-by: Bram Moolenaar <Bram@vim.org>
* vim-patch:9.0.0761: cannot use 'indentexpr' for Lisp indentingzeertzjq2022-10-16
| | | | | | | | | | | | Problem: Cannot use 'indentexpr' for Lisp indenting. Solution: Add the 'lispoptions' option. https://github.com/vim/vim/commit/49846fb1a31de99f49d6a7e70efe685197423c84 vim-patch:9.0.0762: build failure Problem: Build failure. Solution: Add missing change. https://github.com/vim/vim/commit/4b082c4bd05f504fda1acaa9d28fca55a2d04857
* vim-patch:9.0.0754: 'indentexpr' overrules lisp indenting in one situationzeertzjq2022-10-15
| | | | | | Problem: 'indentexpr' overrules lisp indenting in one situation. Solution: Add "else" to keep the lisp indent. (issue vim/vim#11327) https://github.com/vim/vim/commit/a79b35b5781ae770334cec781d17fec3875f8108
* docs: fix typos (#20394)dundargoc2022-09-30
| | | | | Co-authored-by: Raphael <glephunter@gmail.com> Co-authored-by: smjonas <jonas.strittmatter@gmx.de> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* refactor: replace char_u with charDundar Göc2022-09-11
| | | | Work on https://github.com/neovim/neovim/issues/459
* refactor: replace char_u with charDundar Göc2022-09-09
| | | | Work on https://github.com/neovim/neovim/issues/459
* refactor: replace char_u with charDundar Göc2022-09-06
| | | | Work on https://github.com/neovim/neovim/issues/459
* refactor: replace char_u with charDundar Göc2022-09-01
| | | | Work on https://github.com/neovim/neovim/issues/459
* refactor: replace char_u with charDundar Göc2022-08-31
| | | | Work on https://github.com/neovim/neovim/issues/459
* refactor: replace char_u with char 4 (#19987)dundargoc2022-08-30
| | | | | | | * refactor: replace char_u with char Work on https://github.com/neovim/neovim/issues/459
* refactor: replace char_u with charDundar Göc2022-08-29
| | | | Work on https://github.com/neovim/neovim/issues/459
* refactor(plines): use a struct for chartabsize statebfredl2022-08-29
| | | | | | | | | This is a refactor extracted from vim-patch 9.0.0067: cannot show virtual text The logic for inline virtual text is going to be different in nvim than text property based text in vim, but this refactor is still useful, as calculation of displayed linesize is going to be stateful in a similar way.
* 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.
* vim-patch:8.1.2331: the option.c file is still very big (#19954)zeertzjq2022-08-26
| | | | | | | | | | | | Problem: The option.c file is still very big. Solution: Move a few functions to where they fit better. (Yegappan Lakshmanan, closes vim/vim#4895) https://github.com/vim/vim/commit/7bae0b1bc84a95d565ffab38cf7f82ad21c656b6 vim-patch:9.0.0271: using INIT() in non-header files Problem: Using INIT() in non-header files. Solution: Remove INIT(). (closes vim/vim#10981) https://github.com/vim/vim/commit/9b7d2a959646560f5770329f4428c4739eed4656
* vim-patch:9.0.0263: too many #ifdefszeertzjq2022-08-26
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Too many #ifdefs. Solution: Make some functions always available. https://github.com/vim/vim/commit/6d4b2f54df5d533eb0794331f38445a6ca5d3a3f N/A patches for version.c: vim-patch:9.0.0262: build failure without the +quickfix feature Problem: Build failure without the +quickfix feature. Solution: Add #ifdef. https://github.com/vim/vim/commit/2e6dcbc4450c98bd12faace5d77a65f2afddae44 vim-patch:9.0.0266: compiler warning for unused argument Problem: Compiler warning for unused argument. Solution: Add UNUSED. https://github.com/vim/vim/commit/340dafd155222ac96304107542344faf3c56e12b vim-patch:9.0.0268: build error without the +eval feature Problem: Build error without the +eval feature. Solution: Remove #ifdef. https://github.com/vim/vim/commit/0166e398d11a09662d783fe5db62b414045880f8
* refactor: replace char_u with charDundar Goc2022-08-25
| | | | Work on https://github.com/neovim/neovim/issues/459
* 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
* 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>
* fix(folds): fix fold remains when :delete makes buffer empty (#19673)zeertzjq2022-08-08
|
* refactor: replace char_u with charDundar Goc2022-07-31
| | | | Work on https://github.com/neovim/neovim/issues/459
* 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.
* 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.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.
* feat: add preview functionality to user commandsFamiu Haque2022-05-31
| | | | Adds a Lua-only `preview` flag to user commands which allows the command to be incrementally previewed like `:substitute` when 'inccommand' is set.
* refactor(uncrustify): set maximum number of consecutive newlines to 2 (#18695)dundargoc2022-05-25
|