aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/buffer.c
Commit message (Collapse)AuthorAge
...
* refactor(uncrustify): change rules to better align with the style guideDundar Goc2022-04-29
| | | | | | | | | | | | | Add space around arithmetic operators '+' and '-'. Remove space between back-to-back parentheses, i.e. ')(' vs. ') ('. Remove space between '((' or '))' of control statements. Add space between ')' and '{' of control statements. Remove space between function name and '(' on function declaration. Collapse empty blocks between '{' and '}'. Remove newline at the end of the file. Remove newline between 'enum' and '{'. Remove newline between '}' and ')' in a function invocation. Remove newline between '}' and 'while' of 'do' statement.
* refactor(build): remove unused includes #17078kylo2522022-04-26
| | | | Remove unused includes in src/nvim/buffer.c|h using the IWYU library. Yet another step towards #6371 and #549
* fix: show autocmd output when F is in shortmess (#18251)Gregory Anders2022-04-25
| | | | | | | | | | | The default value of including F in 'shortmess' has the unfortunate side effect of hiding output from autocommands. This is a common source of confusion and often leads people to think their autocommands are not working when they are. There is a small snippet in the docs for 'shortmess' indicating that the F flag suppresses autocmd output, but it's not easy to find if you don't already know to look for it. This commit removes that behavior of the F flag to make it only suppress file info when opening a new file.
* refactor: convert macros to all-caps (#17895)dundargoc2022-04-24
| | | Closes https://github.com/neovim/neovim/issues/6297
* refactor: add pure attribute to pure functions (#18165)dundargoc2022-04-24
| | | | This will allow the compilers that support the pure attribute to make further optimizations.
* vim-patch:8.2.4791: events triggered in different order when reusing bufferzeertzjq2022-04-21
| | | | | | | | | Problem: Autocmd events triggered in different order when reusing an empty buffer. Solution: Call buff_freeall() earlier. (Charlie Groves, closes vim/vim#10198) https://github.com/vim/vim/commit/fef4485ef58d5937b170c6dc69431359469fc9cd Test failure becomes very strange.
* vim-patch:8.2.2476: using freed memory when splitting window while closing ↵zeertzjq2022-04-21
| | | | | | | | | | | | | buffer Problem: Using freed memory when using an autocommand to split a window while a buffer is being closed. Solution: Disallow splitting when the buffer has b_locked_split set. https://github.com/vim/vim/commit/983d83ff1cd796ff321074335fa53fbe7ac45a46 Put the error message in window.c. Cherry-pick a memory leak fix from Vim patch 8.2.0399. Test still fails.
* vim-patch:8.1.1756: autocommand that splits window messes up window layoutzeertzjq2022-04-21
| | | | | | | | | | | Problem: Autocommand that splits window messes up window layout. Solution: Disallow splitting a window while closing one. In ":all" give an error when moving a window will not work. https://github.com/vim/vim/commit/1417c766f55e5959b31da488417b7d9b141404af Expected error number was changed to E242 in Vim in patch 8.2.1183, and patch 8.2.2420 (which has already been ported) made the test no longer throw E249 in Vim, so just use E242 in the test.
* chore: remove vestigial sfname freeing (#18123)Charlie Groves2022-04-16
| | | | This freeing is necessary in Vim since the alloc can fail. Since we're using xcalloc, that's not possible and the freeing will never run.
* Merge pull request #18023 from tom-anders/vim-8.2.4702zeertzjq2022-04-09
|\ | | | | vim-patch:8.2.{4702,4703}: C++ scope labels are hard-coded
| * vim-patch:8.2.4702: C++ scope labels are hard-codedTom Praschan2022-04-09
| | | | | | | | | | | | | | Problem: C++ scope labels are hard-coded. Solution: Add 'cinscopedecls' to define the labels. (Tom Praschan, closes vim/vim#10109) https://github.com/vim/vim/commit/3506cf34c17c5eae6c2d1317db1fcd5a8493c288
* | vim-patch:8.2.0004: get E685 and E931 if buffer reload is interruptedzeertzjq2022-04-08
|/ | | | | | Problem: Get E685 and E931 if buffer reload is interrupted. Solution: Do not abort deleting a dummy buffer. (closes vim/vim#5361) https://github.com/vim/vim/commit/a6e8f888e7fc31b8ab7233509254fb2e2fe4089f
* vim-patch:8.2.4631: crash when switching window in BufWipeout autocommandzeertzjq2022-03-27
| | | | | | | | | Problem: Crash when switching window in BufWipeout autocommand. Solution: Put any buffer in the window to avoid it being NULL. (closes vim/vim#10024) https://github.com/vim/vim/commit/347538fad0c503249ebdedd5884c2081257c9f61 win_init_empty() cannot be made static because it is used in autocmd.c
* vim-patch:8.2.4327: may end up with no current bufferzeertzjq2022-03-26
| | | | | | | | | | Problem: May end up with no current buffer. Solution: When deleting the current buffer to not pick a quickfix buffer as the new current buffer. https://github.com/vim/vim/commit/e3537aec2f8d6470010547af28dcbd83d41461b8 The test cannot be ported as-is because Nvim doesn't support "-Z" command line argument. Just use only "--clean" instead.
* vim-patch:8.2.4281: using freed memory with :lopen and :bwipezeertzjq2022-03-26
| | | | | | | | Problem: Using freed memory with :lopen and :bwipe. Solution: Do not use a wiped out buffer. https://github.com/vim/vim/commit/9b4a80a66544f2782040b641498754bcb5b8d461 Cherry-pick some indent changes from patch 8.2.1432.
* fix(float): do not switch window before deleting last listed buffer (#17840)zeertzjq2022-03-24
| | | | Just allow close_windows() to close the current window instead. This fixes wrong working directory or autocommands not being triggered.
* fix(float): don't always switch window when deleting last listed buffer (#17836)zeertzjq2022-03-24
|
* fix(float): handle buffer deletion with floating windowszeertzjq2022-03-23
|
* Merge pull request #17694 from lewis6991/fix_signcolbfredl2022-03-18
|\ | | | | fix(signcol): always trigger a redraw
| * fix(signcol): always trigger a redrawLewis Russell2022-03-12
| | | | | | | | | | | | | | Whenever we change the size of the buffer signcol value, always trigger a redraw. Fixes: #17693
* | vim-patch:8.1.1693: syntax coloring and highlighting is in one big file (#17721)Lewis Russell2022-03-18
| | | | | | | | | | | | | | | | | | | | | | Problem: Syntax coloring and highlighting is in one big file. Solution: Move the highlighting to a separate file. (Yegappan Lakshmanan, closes vim/vim#4674) https://github.com/vim/vim/commit/f9cc9f209ede9f15959e4c2351e970477c139614 Name the new file highlight_group.c instead. Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* | Merge pull request #17266 from famiu/feat/ui/global-statuslinebfredl2022-03-17
|\ \ | | | | | | feat(statusline): add global statusline
| * | feat: add support for global statuslineFamiu Haque2022-03-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ref: #9342 Adds the option to have a single global statusline for the current window at the bottom of the screen instead of a statusline at the bottom of every window. Enabled by setting `laststatus = 3`. Due to the fact that statuslines at the bottom of windows are removed when global statusline is enabled, horizontal separators are used instead to separate horizontal splits. The horizontal separator character is configurable through the`horiz` item in `'fillchars'`. Separator connector characters are also used to connect the horizontal and vertical separators together, which are also configurable through the `horizup`, `horizdown`, `vertleft`, `vertright` and `verthoriz` items in `fillchars`. The window separators are highlighted using the `WinSeparator` highlight group, which supersedes `VertSplit` and is linked to `VertSplit` by default in order to maintain backwards compatibility.
* | | vim-patch:8.1.0877: new buffer used every time the quickfix window is openedJan Edmund Lazo2022-03-13
| |/ |/| | | | | | | | | Problem: New buffer used every time the quickfix window is opened. Solution: Reuse the buffer. (Yegappan Lakshmanan, closes vim/vim#3902) https://github.com/vim/vim/commit/ee8188fc74a7cf9ee7acb634b2bb7a032d0cb24c
* | refactor: fix all clint warnings from buffer.cDundar Göc2022-03-11
| |
* | refactor(signcol): smarter invalidation (#17533)Lewis Russell2022-03-06
| | | | | | | | | | | | | | | | | | | | Previously b_signcols was invalidated whenever a sign was added/removed or when a buffer line was added/removed. This change introduces a sentinel linenr_T into the buffer state which is a line number used to determine the signcolumn. With this information, we can invalidate the signcolumn less often. Now the signcolumn is only invalidated when a sign or line at the sentinel line number is removed.
* | feat(decorations): support signsLewis Russell2022-03-05
| | | | | | | | | | | | | | | | | | | | | | | | Add the following options to extmarks: - sign_text - sign_hl_group - number_hl_group - line_hl_group - cursorline_hl_group Note: ranges are unsupported and decorations are only applied to start_row
* | fix(signcol): handle edge case with maximum valueLewis Russell2022-02-24
| | | | | | | | | | | | | | | | | | 50250542 failed to consider that the maximum passed to buf_signcols is window scoped whereas the signcols value is buffer scoped. This can lead to a bug where the signcolumn becomes incorrect if: - global signcolumn is set to auto:N - signcolumn in a window is changed locally to auto:M where M > N - the buffer has a line with M or greater signs.
* | Merge pull request #17403 from zeertzjq/vim-8.1.1955zeertzjq2022-02-21
|\ \ | | | | | | vim-patch:8.1.{1846,1955},8.2.0156
| * | vim-patch:8.2.0156: various typos in source files and testszeertzjq2022-02-14
| |/ | | | | | | | | | | Problem: Various typos in source files and tests. Solution: Fix the typos. (Emir Sari, closes vim/vim#5532) https://github.com/vim/vim/commit/4b96df5a017a04141c4e901b1fc5704a3ca48099
* / vim-patch:8.2.4419: illegal memory access when using 20 highlightsSean Dewar2022-02-19
|/ | | | | | | Problem: Illegal memory access when using exactly 20 highlights. Solution: Add one more item in the array. (Brandon Richardson, closes vim/vim#9800) https://github.com/vim/vim/commit/a493b6506b67887a1cc2d1c00a896598c3b2d445
* refactor(signs): more efficient signcol calcLewis Russell2022-02-12
| | | | | When iterating signs to calculate the sign column, stop iterating when we reach the maximum configured from 'signcolumn'.
* vim-patch:8.1.2073: when editing a buffer 'colorcolumn' may not workzeertzjq2022-02-12
| | | | | | | Problem: When editing a buffer 'colorcolumn' may not work. Solution: Set the buffer before copying option values. Call check_colorcolumn() after copying window options. https://github.com/vim/vim/commit/010ee9657acf1a9f799079d718998c94e50ccadc
* fix: close floating windows when calling win_close()Rom Grk2022-02-10
|
* 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().
* Merge pull request #17113 from zeertzjq/vim-8.2.2569zeertzjq2022-02-01
|\ | | | | feat(statusline): support multibyte fillchar
| * feat(statusline): support multibyte fillcharzeertzjq2022-01-16
| | | | | | | | | | | | | | | | This includes a partial port of Vim patch 8.2.2569 and some changes to nvim_eval_statusline() to allow a multibyte fillchar. Literally every line of C code touched by that patch has been refactored in Nvim, and that patch contains some irrelevant foldcolumn tests I'm not sure how to port (as Nvim's foldcolumn behavior has diverged from Vim's).
* | vim-patch:8.2.4245: ":retab 0" may cause illegal memory accessSean Dewar2022-01-29
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem: ":retab 0" may cause illegal memory access. Solution: Limit the value of 'tabstop' to 10000. https://github.com/vim/vim/commit/652dee448618589de5528a9e9a36995803f5557a ex_retab change is N/A (+vartabs always available). Nvim's set_num_option validation logic was refactored, hence why it looks different from Vim's. Also use XFREE_CLEAR in other places.
* | Merge pull request #17150 from zeertzjq/vim-8.2.4166bfredl2022-01-27
|\ \ | | | | | | vim-patch:8.2.4166: undo synced when switching buffer in another window
| * | vim-patch:8.2.4166: undo synced when switching buffer in another windowzeertzjq2022-01-21
| |/ | | | | | | | | | | Problem: Undo synced when switching buffer in another window. Solution: Do not sync undo when not needed. (closes vim/vim#9575) https://github.com/vim/vim/commit/e615db06046312e74886fa1ef98feb5a9db2a7c3
* | Merge pull request #17094 from zeertzjq/vim-8.2.4091bfredl2022-01-27
|\ \ | | | | | | vim-patch:8.2.4091: virtcol is recomputed for statusline unnecessarily
| * | vim-patch:8.2.4091: virtcol is recomputed for statusline unnecessarilyzeertzjq2022-01-15
| |/ | | | | | | | | | | Problem: Virtcol is recomputed for statusline unnecessarily. Solution: Just use "w_virtcol". (closes vim/vim#9523) https://github.com/vim/vim/commit/0f112052acaeffd75b7eb001eeb8a246ad12a276
* / fix(coverity/188749): nullify pointer to fix use-after-freeJames McCoy2022-01-19
|/
* 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>
* 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.
* refactor(misc1): move out misc functions which obviously belong elsewhereBjörn Linse2021-12-09
| | | | Also make some function names more descriptive/regular.
* Merge pull request #16362 from zeertzjq/vim-8.2.3617Jan Edmund Lazo2021-11-21
|\ | | | | vim-patch:8.2.{3468,3617,3618,3622}: some other CWD related patches
| * revert: partially revert #9894zeertzjq2021-11-19
| | | | | | | | Vim has a solution to #9892 with fewer side-effects in patch 8.2.3618
| * vim-patch:8.2.3617: ":verbose pwd" does not mention 'autochdir' was appliedzeertzjq2021-11-19
| | | | | | | | | | | | Problem: ":verbose pwd" does not mention 'autochdir' was applied. Solution: Remember the last chdir was done by 'autochdir'. (issue vim/vim#9142) https://github.com/vim/vim/commit/0526815c15170a5926e1008600ec29d42d8b64c2
* | refactor: saner options for uncrustify (#16204)dundargoc2021-11-19
|/ | | | | | | | | | | | | | | | | | | | | | | | * sp_enum_after_assign = force * sp_brace_typedef = force * nl_do_brace = remove * sp_do_brace_open = force * sp_brace_close_while = force * sp_before_semi = remove * sp_before_semi_for = remove * sp_before_semi_for_empty = remove * sp_between_semi_for_empty = remove * sp_after_semi_for_empty = remove * sp_before_square = remove * sp_before_squares = remove * sp_inside_square = remove * sp_inside_fparens = remove * sp_inside_fparen = remove * sp_inside_tparen = remove * sp_after_tparen_close = remove * sp_return_paren = force * pos_bool = lead * sp_pp_concat = remove * sp_pp_stringify = remove * fixup: disable formatting for the INIT section