aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/buffer.c
Commit message (Collapse)AuthorAge
...
* refactor: move some constants out of vim_defs.h (#26298)zeertzjq2023-11-29
|
* perf(column): only invalidate lines affected by added signLuuk van Baal2023-11-29
|
* refactor: fix headers with IWYUdundargoc2023-11-28
|
* fix(column): redraw and update signcols for paired extmarkLuuk van Baal2023-11-28
| | | | | | Problem: Signcolumn width does not increase when ranged sign does not start at sentinel line. Solution: Handle paired range of added sign when checking signcols.
* refactor: rename types.h to types_defs.hdundargoc2023-11-27
|
* build(IWYU): fix includes for undo_defs.hdundargoc2023-11-27
|
* build(IWYU): replace most private mappings with pragmas (#26247)zeertzjq2023-11-27
|
* vim-patch:8.2.4685: when a swap file is found for a popup there is no dialog ↵zeertzjq2023-11-25
| | | | | | | | | | | (#26207) Problem: When a swap file is found for a popup there is no dialog and the buffer is loaded anyway. Solution: Silently load the buffer read-only. (closes vim/vim#10073) https://github.com/vim/vim/commit/188639d75c363dffaf813e8e2209f7350ad1e871 Co-authored-by: Bram Moolenaar <Bram@vim.org>
* fix(column): always set b_signcols.maxLuuk van Baal2023-11-21
| | | | Fix #26135
* refactor: enable formatting for ternariesdundargoc2023-11-20
| | | | | | This requires removing the "Inner expression should be aligned" rule from clint as it prevents essentially any formatting regarding ternary operators.
* Merge pull request #25724 from luukvbaal/signmergebfredl2023-11-18
|\ | | | | refactor(sign): move legacy signs to extmarks
| * refactor(sign): move legacy signs to extmarksLuuk van Baal2023-11-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: The legacy signlist data structures and associated functions are redundant since the introduction of extmark signs. Solution: Store signs defined through the legacy commands in a hashmap, placed signs in the extmark tree. Replace signlist associated functions. Usage of the legacy sign commands should yield no change in behavior with the exception of: - "orphaned signs" are now always removed when the line it is placed on is deleted. This used to depend on the value of 'signcolumn'. - It is no longer possible to place multiple signs with the same identifier in a single group on multiple lines. This will now move the sign instead. Moreover, both signs placed through the legacy sign commands and through |nvim_buf_set_extmark()|: - Will show up in both |sign-place| and |nvim_buf_get_extmarks()|. - Are displayed by increasing sign identifier, left to right. Extmark signs used to be ordered decreasingly as opposed to legacy signs.
* | vim-patch:9.0.2010: [security] use-after-free from buf_contents_changed()zeertzjq2023-11-17
| | | | | | | | | | | | | | | | | | Problem: [security] use-after-free from buf_contents_changed() Solution: block autocommands https://github.com/vim/vim/commit/41e6f7d6ba67b61d911f9b1d76325cd79224753d Co-authored-by: Christian Brabandt <cb@256bit.org>
* | refactor: iwyu (#26062)zeertzjq2023-11-16
| |
* | refactor: move some functions to winfloat.c (#26020)Raphael2023-11-16
|/
* refactor: follow style guidedundargoc2023-11-13
| | | | | | - reduce variable scope - prefer initialization over declaration and assignment - use bool to represent boolean values
* build: remove PVSdundargoc2023-11-12
| | | | | | | We already have an extensive suite of static analysis tools we use, which causes a fair bit of redundancy as we get duplicate warnings. PVS is also prone to give false warnings which creates a lot of work to identify and disable.
* refactor: remove redundant castsdundargoc2023-11-11
|
* refactor: the long goodbyedundargoc2023-11-05
| | | | | | long is 32 bits on windows, while it is 64 bits on other architectures. This makes the type suboptimal for a codebase meant to be cross-platform. Replace it with more appropriate integer types.
* refactor: the long goodbyedundargoc2023-10-03
| | | | | | long is 32 bits on windows, while it is 64 bits on other architectures. This makes the type suboptimal for a codebase meant to be cross-platform. Replace it with more appropriate integer types.
* refactor: reorganize option header files (#25437)zeertzjq2023-09-30
| | | | | | - Move vimoption_T to option.h - option_defs.h is for option-related types - option_vars.h corresponds to Vim's option.h - option_defs.h and option_vars.h don't include each other
* build(iwyu): add a few more _defs.h mappings (#25435)zeertzjq2023-09-30
|
* refactor(message): smsg_attr -> smsgbfredl2023-09-29
|
* refactor: remove longdundargoc2023-09-29
| | | | | long is 32-bits even on 64-bit windows which makes the type suboptimal for a codebase meant to be cross-platform.
* refactor(messages): rename msg_trunc_attr and msg_multiline_attr without attrbfredl2023-09-27
|
* refactor(messages): fold msg_attr into msgbfredl2023-09-27
| | | | | problem: there are too many different functions in message.c solution: fold some of the functions into themselves
* refactor(messages): fold msg_outtrans_attr into msg_outtransbfredl2023-09-27
| | | | | problem: there are too many different functions in message.c solution: fold some of the functions into themselves
* vim-patch:8.2.3517: TextChanged does not trigger after TextChangedI (#25384)zeertzjq2023-09-27
| | | | | | | | | Problem: TextChanged does not trigger after TextChangedI. Solution: Store the tick separately for TextChangedI. (Christian Brabandt, closes vim/vim#8968, closes vim/vim#8932) https://github.com/vim/vim/commit/db3b44640d69ab27270691a3cab8d83cc93a0861 Co-authored-by: Christian Brabandt <cb@256bit.org>
* refactor(options)!: graduate some more shortmess flagsbfredl2023-09-25
| | | | | | | | A lot of updated places in the docs were already incorrect since long since they did not reflect the default behaviour. "[dos format]" could've been argued being better for discoverability but that ship has already sailed as it is no longer displayed by default.
* Merge pull request #25330 from bfredl/no_shm_fbfredl2023-09-23
|\ | | | | refactor(options)!: graduate shortmess+=f flag
| * refactor(options)!: graduate shortmess+=f flagbfredl2023-09-23
| | | | | | | | | | | | | | Not everything needs to be crazy overconfigurable. Also fixes a warning in latest clang which didn't approve of the funky math switch statement in append_arg_number
* | fix(float): fix some other crashes with :unhide or :all (#25328)zeertzjq2023-09-23
|/
* fix(unhide): close floating windows first (#25318)zeertzjq2023-09-23
|
* vim-patch:8.2.4609: :unhide does not check for failing to close a window ↵zeertzjq2023-09-23
| | | | | | | | | | | (#25317) Problem: :unhide does not check for failing to close a window. Solution: When closing a window fails continue with the next one. Do not try closing the autocmd window. (closes vim/vim#9984) https://github.com/vim/vim/commit/6f2465d336a9d4afe392db4084ef7e9db17e67c1 Co-authored-by: Bram Moolenaar <Bram@vim.org>
* feat(extmark): support proper multiline rangesbfredl2023-09-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The removes the previous restriction that nvim_buf_set_extmark() could not be used to highlight arbitrary multi-line regions The problem can be summarized as follows: let's assume an extmark with a hl_group is placed covering the region (5,0) to (50,0) Now, consider what happens if nvim needs to redraw a window covering the lines 20-30. It needs to be able to ask the marktree what extmarks cover this region, even if they don't begin or end here. Therefore the marktree needs to be augmented with the information covers a point, not just what marks begin or end there. To do this, we augment each node with a field "intersect" which is a set the ids of the marks which overlap this node, but only if it is not part of the set of any parent. This ensures the number of nodes that need to be explicitly marked grows only logarithmically with the total number of explicitly nodes (and thus the number of of overlapping marks). Thus we can quickly iterate all marks which overlaps any query position by looking up what leaf node contains that position. Then we only need to consider all "start" marks within that leaf node, and the "intersect" set of that node and all its parents. Now, and the major source of complexity is that the tree restructuring operations (to ensure that each node has T-1 <= size <= 2*T-1) also need to update these sets. If a full inner node is split in two, one of the new parents might start to completely overlap some ranges and its ids will need to be moved from its children's sets to its own set. Similarly, if two undersized nodes gets joined into one, it might no longer completely overlap some ranges, and now the children which do needs to have the have the ids in its set instead. And then there are the pivots! Yes the pivot operations when a child gets moved from one parent to another.
* refactor(marks): don't set timestamp twice with :delmarks (#24994)zeertzjq2023-09-03
| | | refactor(mark): don't set same timestamp twice
* 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.
* 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.1672: tabline highlight wrong after truncated double width ↵zeertzjq2023-07-02
| | | | | | | | label (#24223) Problem: Tabline highlight wrong after truncated double width label. Solution: Fill up half a double width character later. (closes vim/vim#12614) https://github.com/vim/vim/commit/d392a74c5a8af8271a33a20d37ae1a8ea422cb4b
* refactor(options): remove `getoption_T` and introduce `OptVal` (#23850)Famiu Haque2023-06-07
| | | | | | | | Removes the `getoption_T` struct and also introduces the `OptVal` struct to unify the methods of getting/setting different option value types. This is the first of many PRs to reduce code duplication in the Vim option code as well as to make options easier to maintain. It also increases the flexibility and extensibility of options. Which opens the door for things like Array and Dictionary options.
* vim-patch:9.0.1583: get E304 when using 'cryptmethod' "xchacha20v2" (#23790)zeertzjq2023-05-28
| | | | | | | | | Problem: Get E304 when using 'cryptmethod' "xchacha20v2". (Steve Mynott) Solution: Add 4th crypt method to block zero ID check. Avoid syncing a swap file before reading the file. (closes vim/vim#12433) https://github.com/vim/vim/commit/3a2a60ce4a8e73594bca16814672fcc243d093ac Co-authored-by: Bram Moolenaar <Bram@vim.org>
* fix(ui-ext): send title to newly-attached UIzeertzjq2023-05-26
|
* vim-patch:9.0.1575: "file N of M" message is not translated (#23737)zeertzjq2023-05-24
| | | | | | | | Problem: "file N of M" message is not translated. Solution: Make argument count message translatable. (close vim/vim#12429) https://github.com/vim/vim/commit/a8490a4952c320f234ae4528d4a1e812a27f3a0a Co-authored-by: Bram Moolenaar <Bram@vim.org>
* Merge pull request #15534 from bfredl/monomapbfredl2023-05-17
|\ | | | | refactor(map): avoid duplicated khash_t implementations for values and support sets
| * refactor(map): avoid duplicated khash_t types for valuesbfredl2023-05-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reduces the total number of khash_t instantiations from 22 to 8. Make the khash internal functions take the size of values as a runtime parameter. This is abstracted with typesafe Map containers which are still specialized for both key, value type. Introduce `Set(key)` type for when there is no value. Refactor shada.c to use Map/Set instead of khash directly. This requires `map_ref` operation to be more flexible. Return pointers to both key and value, plus an indicator for new_item. As a bonus, `map_key` is now redundant. Instead of Map(cstr_t, FileMarks), use a pointer map as the FileMarks struct is humongous. Make `event_strings` actually work like an intern pool instead of wtf it was doing before.
* | refactor: use xstrl{cpy,cat} on IObuff (#23648)ii142023-05-16
|/ | | | | Replace usage of STR{CPY,CAT} with xstrl{cpy,cat} when using on IObuff Co-authored-by: ii14 <ii14@users.noreply.github.com>
* vim-patch:9.0.1554: code for handling 'switchbuf' is repeated (#23632)zeertzjq2023-05-15
| | | | | | | | | Problem: Code for handling 'switchbuf' is repeated. Solution: Add a function to handle 'switchbuf'. (Yegappan Lakshmanan, closes vim/vim#12397) https://github.com/vim/vim/commit/e42c27d9e8a18e3786f13f17663914cdd0f63f9e Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
* vim-patch:9.0.1497: the ruler percentage can't be localized (#23389)zeertzjq2023-04-29
| | | | | | | | Problem: The ruler percentage can't be localized. Solution: Use a string that can be translated. (Emir Sari, closes vim/vim#12311) https://github.com/vim/vim/commit/971cd2b8bc3e3a7faa886162cd7568938c627882 Co-authored-by: Emir SARI <emir_sari@icloud.com>
* vim-patch:9.0.1330: handling new value of an option has a long "else if" chainLewis Russell2023-04-28
| | | | | | | Problem: Handling new value of an option has a long "else if" chain. Solution: Use a function pointer. (Yegappan Lakshmanan, closes vim/vim#12015) https://github.com/vim/vim/commit/af93691b53f38784efce0b93fe7644c44a7e382e