refactor: remove cpo-& behavior (#17745)

cpo-& has been removed, but its behavior was accidentally made the
default behavior. That should be removed instead.
This commit is contained in:
zeertzjq
2022-03-23 19:52:50 +08:00
committed by GitHub
parent 0621cd3112
commit f5a3edb0c0
5 changed files with 10 additions and 11 deletions

View File

@@ -108,7 +108,7 @@ command:
*:pre* *:preserve* *E313* *E314* *:pre* *:preserve* *E313* *E314*
:pre[serve] Write all text for the current buffer into its swap :pre[serve] Write all text for the current buffer into its swap
file. The original file is no longer needed for file. The original file is no longer needed for
recovery. This sets a flag in the current buffer. recovery.
A Vim swap file can be recognized by the first six characters: "b0VIM ". A Vim swap file can be recognized by the first six characters: "b0VIM ".
After that comes the version number, e.g., "3.0". After that comes the version number, e.g., "3.0".

View File

@@ -90,7 +90,6 @@ typedef struct {
#define BF_NEW_W 0x20 // Warned for BF_NEW and file created #define BF_NEW_W 0x20 // Warned for BF_NEW and file created
#define BF_READERR 0x40 // got errors while reading the file #define BF_READERR 0x40 // got errors while reading the file
#define BF_DUMMY 0x80 // dummy buffer, only used internally #define BF_DUMMY 0x80 // dummy buffer, only used internally
#define BF_PRESERVED 0x100 // ":preserve" was used
#define BF_SYN_SET 0x200 // 'syntax' option was set #define BF_SYN_SET 0x200 // 'syntax' option was set
// Mask to check for flags that prevent normal writing // Mask to check for flags that prevent normal writing

View File

@@ -7155,7 +7155,6 @@ void alist_slash_adjust(void)
/// ":preserve". /// ":preserve".
static void ex_preserve(exarg_T *eap) static void ex_preserve(exarg_T *eap)
{ {
curbuf->b_flags |= BF_PRESERVED;
ml_preserve(curbuf, true, true); ml_preserve(curbuf, true, true);
} }

View File

@@ -585,16 +585,14 @@ void ml_close(buf_T *buf, int del_file)
buf->b_flags &= ~BF_RECOVERED; buf->b_flags &= ~BF_RECOVERED;
} }
/* /// Close all existing memlines and memfiles.
* Close all existing memlines and memfiles. /// Only used when exiting.
* Only used when exiting. ///
* When 'del_file' is TRUE, delete the memfiles. /// @param del_file if true, delete the memfiles.
* But don't delete files that were ":preserve"d when we are POSIX compatible. void ml_close_all(bool del_file)
*/
void ml_close_all(int del_file)
{ {
FOR_ALL_BUFFERS(buf) { FOR_ALL_BUFFERS(buf) {
ml_close(buf, del_file && ((buf->b_flags & BF_PRESERVED) == 0)); ml_close(buf, del_file);
} }
spell_delete_wordlist(); // delete the internal wordlist spell_delete_wordlist(); // delete the internal wordlist
vim_deltempdir(); // delete created temp directory vim_deltempdir(); // delete created temp directory

View File

@@ -10,6 +10,7 @@ local feed = helpers.feed
local nvim_prog = helpers.nvim_prog local nvim_prog = helpers.nvim_prog
local ok = helpers.ok local ok = helpers.ok
local rmdir = helpers.rmdir local rmdir = helpers.rmdir
local os_kill = helpers.os_kill
local set_session = helpers.set_session local set_session = helpers.set_session
local spawn = helpers.spawn local spawn = helpers.spawn
local nvim_async = helpers.nvim_async local nvim_async = helpers.nvim_async
@@ -62,6 +63,7 @@ describe(':preserve', function()
local swappath1 = eval('g:swapname') local swappath1 = eval('g:swapname')
os_kill(eval('getpid()'))
-- Start another Nvim instance. -- Start another Nvim instance.
local nvim2 = spawn({nvim_prog, '-u', 'NONE', '-i', 'NONE', '--embed'}, local nvim2 = spawn({nvim_prog, '-u', 'NONE', '-i', 'NONE', '--embed'},
true) true)
@@ -122,6 +124,7 @@ describe('swapfile detection', function()
feed('isometext<esc>') feed('isometext<esc>')
command('preserve') command('preserve')
os_kill(eval('getpid()'))
-- Start another Nvim instance. -- Start another Nvim instance.
local nvim2 = spawn({nvim_prog, '-u', 'NONE', '-i', 'NONE', '--embed'}, local nvim2 = spawn({nvim_prog, '-u', 'NONE', '-i', 'NONE', '--embed'},
true) true)