aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/buffer.c
Commit message (Collapse)AuthorAge
...
* vim-patch:9.0.0261: bufload() reads a file even if the name is not a file ↵zeertzjq2022-08-25
| | | | | | | | | name (#19944) Problem: bufload() reads a file even if the name is not a file name. (Cyker Way) Solution: Do not read the file when the buffer name is not a file name. (closes vim/vim#10975) https://github.com/vim/vim/commit/2eddbacd6dc17c84e4bdc41e60e81949a36bb973
* 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.2.4753: error from setting an option is silently ignored (#19888)zeertzjq2022-08-22
| | | | | Problem: Error from setting an option is silently ignored. Solution: Handle option value errors better. Fix uses of N_(). https://github.com/vim/vim/commit/31e5c60a682840959cae6273ccadd9aae48c928d
* vim-patch:8.1.1886: command line expansion code is spread out (#19861)zeertzjq2022-08-21
| | | | | Problem: Command line expansion code is spread out. Solution: Move the code to cmdexpand.c. (Yegappan Lakshmanan, closes vim/vim#4831) https://github.com/vim/vim/commit/66b51420e0c8d49bcf6786b792c938d6099e3393
* vim-patch:8.1.2045: the option.c file is too big (#19854)zeertzjq2022-08-20
| | | | | | | | | | | Problem: The option.c file is too big. Solution: Split off the code dealing with strings. (Yegappan Lakshmanan, closes vim/vim#4937) https://github.com/vim/vim/commit/dac1347b4d9c1a1aef6aa73fdea08a9d1077d6ea Cherry-pick set_string_option_direct_in_win() from patch 8.1.1405. Cherry-pick shift_line() comment change from patch 8.1.2096. Move 'clipboard' default parsing to didset_string_options(). Reorder option flags to put Nvim-only flags at the end.
* 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.2.1262: src/ex_cmds.c file is too big (#19811)zeertzjq2022-08-17
| | | | | | Problem: src/ex_cmds.c file is too big. Solution: Move help related code to src/help.c. (Yegappan Lakshmanan, closes vim/vim#6506) https://github.com/vim/vim/commit/f868ba89039045b25efe83d12ca501d657e170e8
* vim-patch:8.1.1869: code for the argument list is spread out (#19791)zeertzjq2022-08-16
| | | | | | Problem: Code for the argument list is spread out. Solution: Put argument list code in arglist.c. (Yegappan Lakshmanan, closes vim/vim#4819) https://github.com/vim/vim/commit/4ad62155a1015751a6645aaecd94b02c94c8934b
* vim-patch:8.2.0056: execution stack is incomplete and inefficientzeertzjq2022-08-14
| | | | | | | | | | | Problem: Execution stack is incomplete and inefficient. Solution: Introduce a proper execution stack and use it instead of sourcing_name/sourcing_lnum. Create a string only when used. https://github.com/vim/vim/commit/1a47ae32cdc19b0fd5a82e19fe5fddf45db1a506 Omit test_debugger.vim: superseded by later patches. Omit check_map_keycodes(): N/A. Omit kword_test.c: N/A (converted to a unit test).
* vim-patch:9.0.0198: ml_get error when switching buffer in Visual mode (#19756)zeertzjq2022-08-13
| | | | | Problem: ml_get error when switching buffer in Visual mode. Solution: End Visual mode when switching buffer. (closes vim/vim#10902) https://github.com/vim/vim/commit/cfeb8a584be11758cf71ae02f6c937b06d6bb66f
* fix(winbar): do not always assume cursor is valid. fixes #19458bfredl2022-08-13
|
* refactor: remove some unused includes (#19747)zeertzjq2022-08-13
| | | | | - Remove autocmd.h from fileio.h - Remove normal.h from main.h - Move bufinfo_T from undo_defs.h to undo.c
* refactor: use CLEAR_FIELD and CLEAR_POINTER macros (#19709)zeertzjq2022-08-11
| | | | | | | vim-patch:8.2.0559: clearing a struct is verbose Problem: Clearing a struct is verbose. Solution: Define and use CLEAR_FIELD() and CLEAR_POINTER(). https://github.com/vim/vim/commit/a80faa8930ed5a554beeb2727762538873135e83
* vim-patch:8.2.1280: Ex command error cannot contain an argumentzeertzjq2022-08-07
| | | | | | | | | Problem: Ex command error cannot contain an argument. Solution: Add ex_errmsg() and translate earlier. Use e_trailing_arg where possible. https://github.com/vim/vim/commit/8930caaa1a283092aca81fdbc3fcf15c7eadb197 Remove duplicate test file 062_tab_pages_spec.lua
* vim-patch:8.1.1210: support for user commands is spread out (#19653)zeertzjq2022-08-06
| | | | | | | Problem: Support for user commands is spread out. No good reason to make user commands optional. Solution: Move user command support to usercmd.c. Always enable the user_commands feature. https://github.com/vim/vim/commit/ac9fb18020d7e8bf16d02d45fbb02cf47328aaf7
* vim-patch:8.2.0413: buffer menu does not handle special buffers properlyzeertzjq2022-08-05
| | | | | | | | | Problem: Buffer menu does not handle special buffers properly. Solution: Keep a dictionary with buffer names to reliably keep track of entries. Also trigger BufFilePre and BufFilePost for command-line and terminal buffers when the name changes. https://github.com/vim/vim/commit/5e94a29ebbde10dd973d58f1adba9a2fc83877d1
* refactor: rename function prefix mb to the more accurate utf_cp (#19590)dundargoc2022-08-02
| | | | | The "cp" stands for codepoint. Closes https://github.com/neovim/neovim/issues/7401
* vim-patch:9.0.0095: conditions are always truezeertzjq2022-07-28
| | | | | | Problem: Conditions are always true. Solution: Remove useless conditions. (closes vim/vim#10802) https://github.com/vim/vim/commit/122dea70073d140aa89212d344c3f62bd3b5b3fa
* vim-patch:8.2.4731: the changelist index is not remembered per bufferzeertzjq2022-07-23
| | | | | | | | | | Problem: The changelist index is not remembered per buffer. Solution: Keep the changelist index per window and buffer. (closes vim/vim#10135, closes vim/vim#2173) https://github.com/vim/vim/commit/db0ea7f2b00c84d84f188c9e9953c4f1887528e7 Cherry-pick FOR_ALL_BUF_WININFO from patch 8.2.0500. Cherry-pick test_changelist.vim change from patch 8.2.3795.
* vim-patch:8.1.1933: the eval.c file is too big (#19462)zeertzjq2022-07-22
| | | | | | | | Problem: The eval.c file is too big. Solution: Move code related to variables to evalvars.c. (Yegappan Lakshmanan, closes vim/vim#4868) https://github.com/vim/vim/commit/0522ba0359c96a8c2a4fc8fca0d3b58e49dda759 Name the new file eval/vars.c instead.
* vim-patch:8.1.1547: functionality of bt_nofile() is confusingzeertzjq2022-07-15
| | | | | | Problem: Functionality of bt_nofile() is confusing. Solution: Split into bt_nofile() and bt_nofilename(). https://github.com/vim/vim/commit/26910de8b0da6abab87bd5a397330f9cbe483309
* vim-patch:8.2.0426: some errors were not tested forzeertzjq2022-07-15
| | | | | | | | Problem: Some errors were not tested for. Solution: Add tests. (Dominique Pelle, closes vim/vim#5824) https://github.com/vim/vim/commit/9b9be007e7d674f49fc2b650f840d08532b180ad Cherry-pick get_highest_fnum() from patch 8.1.1908 to make tests pass.
* vim-patch:8.0.1118: FEAT_WINDOWS adds a lot of #ifdefszeertzjq2022-07-15
| | | | | | | Problem: FEAT_WINDOWS adds a lot of #ifdefs while it is nearly always enabled and only adds 7% to the binary size of the tiny build. Solution: Graduate FEAT_WINDOWS. https://github.com/vim/vim/commit/4033c55eca575777718c0701e26635a0cc47d907
* vim-patch:8.2.0035: saving and restoring called_emsg is clumsy (#19335)zeertzjq2022-07-13
| | | | | Problem: Saving and restoring called_emsg is clumsy. Solution: Count the number of error messages. https://github.com/vim/vim/commit/53989554a44caca0964376d60297f08ec257c53c
* vim-patch:8.2.5043: can open a cmdline window from a substitute expressionzeertzjq2022-07-07
| | | | | | | Problem: Can open a cmdline window from a substitute expression. Solution: Disallow opening a command line window when text or buffer is locked. https://github.com/vim/vim/commit/71223e2db87c2bf3b09aecb46266b56cda26191d
* fix(terminal): crash if TermClose deletes own buffer #19222Justin M. Keyes2022-07-05
| | | | | | | | - Partially fixes #10386 except for the case where the alternate buffer is the default, empty, first buffer created on startup. #vimlife - TODO: port patches related to `can_unload_buffer`, maybe that fully fixes #10386? vim-patch:8.0.1732: crash when terminal API call deletes the buffer
* 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.
* vim-patch:9.0.0002: map functionality outside of map.c (#19150)zeertzjq2022-06-29
| | | | | Problem: Map functionality outside of map.c. Solution: Move f_hasmapto() to map.c. Rename a function. (closes vim/vim#10611) https://github.com/vim/vim/commit/c207fd2535717030d78f9b92839e5f2ac004cc78
* refactor: replace char_u #18429dundargoc2022-06-28
| | | Work on https://github.com/neovim/neovim/issues/459
* 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().
* fix(terminal): coverity USE_AFTER_FREE #18978Justin M. Keyes2022-06-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Coverity reports use after free: *** CID 352784: Memory - illegal accesses (USE_AFTER_FREE) /src/nvim/buffer.c: 1508 in set_curbuf() 1502 if (old_tw != curbuf->b_p_tw) { 1503 check_colorcolumn(curwin); 1504 } 1505 } 1506 1507 if (bufref_valid(&prevbufref) && prevbuf->terminal != NULL) { >>> CID 352784: Memory - illegal accesses (USE_AFTER_FREE) >>> Calling "terminal_check_size" dereferences freed pointer "prevbuf->terminal". 1508 terminal_check_size(prevbuf->terminal); 1509 } 1510 } 1511 1512 /// Enter a new current buffer. 1513 /// Old curbuf must have been abandoned already! This also means "curbuf" may Solution: Change terminal_destroy and terminal_close to set caller storage to NULL, similar to XFREE_CLEAR. This aligns with the pattern found already in: terminal_destroy e897ccad3eb1e term_delayed_free 3e59c1e20d605
* 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
* fix(buffer): disable buffer-updates before removing from window #18933zeertzjq2022-06-12
| | | | | | | | There can be other places that access window buffer info (e.g. `tabpagebuflist()`), so checking `w_closing` in `win_findbuf()` doesn't solve the crash in all cases, and may also cause Nvim's behavior to diverge from Vim. Fix #14998
* refactor(uncrustify): set maximum number of consecutive newlines to 2 (#18695)dundargoc2022-05-25
|
* refactor: replace char_u variables and functions with charDundar Goc2022-05-16
| | | | Work on https://github.com/neovim/neovim/issues/459
* 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
* | vim-patch:8.2.4938: crash when matching buffer with invalid patternzeertzjq2022-05-11
| | | | | | | | | | | | Problem: Crash when matching buffer with invalid pattern. Solution: Check for NULL regprog. https://github.com/vim/vim/commit/a59f2dfd0cf9ee1a584d3de5b7c2d47648e79060
* | vim-patch:8.2.4901: NULL pointer access when using invalid patternzeertzjq2022-05-11
|/ | | | | | Problem: NULL pointer access when using invalid pattern. Solution: Check for failed regexp program. https://github.com/vim/vim/commit/8e4b76da1d7e987d43ca960dfbc372d1c617466f
* vim-patch:8.2.4929: off-by-one error in in statusline itemzeertzjq2022-05-10
| | | | | | Problem: Off-by-one error in in statusline item. Solution: Subtrace one less. (closes vim/vim#10394, closes vim/vim#5599) https://github.com/vim/vim/commit/57ff52677bf5ba1651281ffe40505df8feba4a36
* 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
* Merge pull request #18425 from dundargoc/refactor/char_u/1bfredl2022-05-07
|\ | | | | refactor: replace char_u variables and functions with char
| * refactor: replace char_u variables and functions with charDundar Goc2022-05-07
| | | | | | | | Work on https://github.com/neovim/neovim/issues/459
* | build(clint): remove "function size is too large" warningDundar Goc2022-05-06
|/ | | | | | | | This warning is essentially only triggered for ported vim functions. It's unlikely that we'll refactor vim functions solely based on their size since it'd mean we'd greatly deviate from vim, which is a high cost when it comes to importing the vim patches. Thus, this warning only serves as an annoyance and should be removed.
* refactor: replace char_u variables and functions with charDundar Goc2022-05-04
| | | | Work on https://github.com/neovim/neovim/issues/459
* refactor: replace char_u variables and functions with charDundar Goc2022-05-03
| | | | Work on https://github.com/neovim/neovim/issues/459
* refactor: replace char_u variables and functions with charDundar Goc2022-04-30
| | | | Work on https://github.com/neovim/neovim/issues/459