diff options
author | bfredl <bjorn.linse@gmail.com> | 2023-08-21 14:52:17 +0200 |
---|---|---|
committer | bfredl <bjorn.linse@gmail.com> | 2023-08-26 12:02:05 +0200 |
commit | 008154954791001efcc46c28146e21403f3a698b (patch) | |
tree | 306721ca60456ba9562c16b9d41cf5ec8d5a360c /src/nvim/log.c | |
parent | 1635c9e75e21e07c4331cf983e14a11c7e09b119 (diff) | |
download | rneovim-008154954791001efcc46c28146e21403f3a698b.tar.gz rneovim-008154954791001efcc46c28146e21403f3a698b.tar.bz2 rneovim-008154954791001efcc46c28146e21403f3a698b.zip |
refactor(change): do API changes to buffer without curbuf switch
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.
Diffstat (limited to 'src/nvim/log.c')
-rw-r--r-- | src/nvim/log.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/nvim/log.c b/src/nvim/log.c index afe3d95e9a..84b6e9ece7 100644 --- a/src/nvim/log.c +++ b/src/nvim/log.c @@ -152,7 +152,17 @@ bool logmsg(int log_level, const char *context, const char *func_name, int line_ #ifdef EXITFREE // Logging after we've already started freeing all our memory will only cause // pain. We need access to VV_PROGPATH, homedir, etc. - assert(!entered_free_all_mem); + if (entered_free_all_mem) { + fprintf(stderr, "FATAL: error in free_all_mem\n %s %s %d: ", context, func_name, line_num); + va_list args; + va_start(args, fmt); + vfprintf(stderr, fmt, args); + va_end(args); + if (eol) { + fprintf(stderr, "\n"); + } + abort(); + } #endif log_lock(); |