mirror of
https://github.com/neovim/neovim.git
synced 2025-09-30 06:58:35 +00:00
Linted
This commit is contained in:
@@ -671,14 +671,15 @@ void handle_swap_exists(buf_T *old_curbuf)
|
|||||||
* aborting() returns FALSE when closing a buffer. */
|
* aborting() returns FALSE when closing a buffer. */
|
||||||
enter_cleanup(&cs);
|
enter_cleanup(&cs);
|
||||||
|
|
||||||
/* User selected Quit at ATTENTION prompt. Go back to previous
|
// User selected Quit at ATTENTION prompt. Go back to previous
|
||||||
* buffer. If that buffer is gone or the same as the current one,
|
// buffer. If that buffer is gone or the same as the current one,
|
||||||
* open a new, empty buffer. */
|
// open a new, empty buffer.
|
||||||
swap_exists_action = SEA_NONE; /* don't want it again */
|
swap_exists_action = SEA_NONE; // don't want it again
|
||||||
swap_exists_did_quit = TRUE;
|
swap_exists_did_quit = true;
|
||||||
close_buffer(curwin, curbuf, DOBUF_UNLOAD, FALSE);
|
close_buffer(curwin, curbuf, DOBUF_UNLOAD, false);
|
||||||
if (!buf_valid(old_curbuf) || old_curbuf == curbuf)
|
if (!buf_valid(old_curbuf) || old_curbuf == curbuf) {
|
||||||
old_curbuf = buflist_new(NULL, NULL, 1L, BLN_CURBUF | BLN_LISTED, 0);
|
old_curbuf = buflist_new(NULL, NULL, 1L, BLN_CURBUF | BLN_LISTED, 0);
|
||||||
|
}
|
||||||
if (old_curbuf != NULL) {
|
if (old_curbuf != NULL) {
|
||||||
enter_buffer(old_curbuf);
|
enter_buffer(old_curbuf);
|
||||||
if (old_tw != curbuf->b_p_tw)
|
if (old_tw != curbuf->b_p_tw)
|
||||||
@@ -1336,10 +1337,10 @@ static int top_file_num = 1; /* highest file number */
|
|||||||
|
|
||||||
buf_T *
|
buf_T *
|
||||||
buflist_new(
|
buflist_new(
|
||||||
char_u *ffname, /* full path of fname or relative */
|
char_u *ffname, // full path of fname or relative
|
||||||
char_u *sfname, /* short fname or NULL */
|
char_u *sfname, // short fname or NULL
|
||||||
linenr_T lnum, /* preferred cursor line */
|
linenr_T lnum, // preferred cursor line
|
||||||
int flags, /* BLN_ defines */
|
int flags, // BLN_ defines
|
||||||
handle_T bufnr
|
handle_T bufnr
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -2377,10 +2378,11 @@ buf_T *setaltfname(char_u *ffname, char_u *sfname, linenr_T lnum)
|
|||||||
{
|
{
|
||||||
buf_T *buf;
|
buf_T *buf;
|
||||||
|
|
||||||
/* Create a buffer. 'buflisted' is not set if it's a new buffer */
|
// Create a buffer. 'buflisted' is not set if it's a new buffer
|
||||||
buf = buflist_new(ffname, sfname, lnum, 0, 0);
|
buf = buflist_new(ffname, sfname, lnum, 0, 0);
|
||||||
if (buf != NULL && !cmdmod.keepalt)
|
if (buf != NULL && !cmdmod.keepalt) {
|
||||||
curwin->w_alt_fnum = buf->b_fnum;
|
curwin->w_alt_fnum = buf->b_fnum;
|
||||||
|
}
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2415,8 +2417,9 @@ int buflist_add(char_u *fname, int flags)
|
|||||||
buf_T *buf;
|
buf_T *buf;
|
||||||
|
|
||||||
buf = buflist_new(fname, NULL, (linenr_T)0, flags, 0);
|
buf = buflist_new(fname, NULL, (linenr_T)0, flags, 0);
|
||||||
if (buf != NULL)
|
if (buf != NULL) {
|
||||||
return buf->b_fnum;
|
return buf->b_fnum;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1531,9 +1531,10 @@ int rename_buffer(char_u *new_fname)
|
|||||||
curbuf->b_flags |= BF_NOTEDITED;
|
curbuf->b_flags |= BF_NOTEDITED;
|
||||||
if (xfname != NULL && *xfname != NUL) {
|
if (xfname != NULL && *xfname != NUL) {
|
||||||
buf = buflist_new(fname, xfname, curwin->w_cursor.lnum, 0, 0);
|
buf = buflist_new(fname, xfname, curwin->w_cursor.lnum, 0, 0);
|
||||||
if (buf != NULL && !cmdmod.keepalt)
|
if (buf != NULL && !cmdmod.keepalt) {
|
||||||
curwin->w_alt_fnum = buf->b_fnum;
|
curwin->w_alt_fnum = buf->b_fnum;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
xfree(fname);
|
xfree(fname);
|
||||||
xfree(sfname);
|
xfree(sfname);
|
||||||
apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, curbuf);
|
||||||
@@ -2181,9 +2182,9 @@ do_ecmd (
|
|||||||
buflist_altfpos(oldwin);
|
buflist_altfpos(oldwin);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fnum && !(flags & ECMD_RESERVED_BUFNR))
|
if (fnum && !(flags & ECMD_RESERVED_BUFNR)) {
|
||||||
buf = buflist_findnr(fnum);
|
buf = buflist_findnr(fnum);
|
||||||
else {
|
} else {
|
||||||
if (flags & ECMD_ADDBUF) {
|
if (flags & ECMD_ADDBUF) {
|
||||||
linenr_T tlnum = 1L;
|
linenr_T tlnum = 1L;
|
||||||
|
|
||||||
@@ -2196,7 +2197,8 @@ do_ecmd (
|
|||||||
goto theend;
|
goto theend;
|
||||||
}
|
}
|
||||||
buf = buflist_new(ffname, sfname, 0L,
|
buf = buflist_new(ffname, sfname, 0L,
|
||||||
BLN_CURBUF | ((flags & ECMD_SET_HELP) ? 0 : BLN_LISTED), fnum);
|
BLN_CURBUF | ((flags & ECMD_SET_HELP) ? 0 : BLN_LISTED),
|
||||||
|
fnum);
|
||||||
// Autocmds may change curwin and curbuf.
|
// Autocmds may change curwin and curbuf.
|
||||||
if (oldwin != NULL) {
|
if (oldwin != NULL) {
|
||||||
oldwin = curwin;
|
oldwin = curwin;
|
||||||
@@ -2989,7 +2991,7 @@ static bool sub_joining_lines(exarg_T *eap, char_u *pat,
|
|||||||
if (!cmdmod.keeppatterns) {
|
if (!cmdmod.keeppatterns) {
|
||||||
save_re_pat(RE_SUBST, pat, p_magic);
|
save_re_pat(RE_SUBST, pat, p_magic);
|
||||||
}
|
}
|
||||||
add_to_history(HIST_SEARCH, pat, TRUE, NUL);
|
add_to_history(HIST_SEARCH, pat, true, NUL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -3169,20 +3171,22 @@ void do_sub(exarg_T *eap)
|
|||||||
EMSG(_(e_backslash));
|
EMSG(_(e_backslash));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (*cmd != '&')
|
if (*cmd != '&') {
|
||||||
which_pat = RE_SEARCH; /* use last '/' pattern */
|
which_pat = RE_SEARCH; // use last '/' pattern
|
||||||
pat = (char_u *)""; /* empty search pattern */
|
}
|
||||||
delimiter = *cmd++; /* remember delimiter character */
|
pat = (char_u *)""; // empty search pattern
|
||||||
|
delimiter = *cmd++; // remember delimiter character
|
||||||
has_second_delim = true;
|
has_second_delim = true;
|
||||||
} else { /* find the end of the regexp */
|
} else { // find the end of the regexp
|
||||||
if (p_altkeymap && curwin->w_p_rl)
|
if (p_altkeymap && curwin->w_p_rl) {
|
||||||
lrF_sub(cmd);
|
lrF_sub(cmd);
|
||||||
which_pat = RE_LAST; /* use last used regexp */
|
}
|
||||||
delimiter = *cmd++; /* remember delimiter character */
|
which_pat = RE_LAST; // use last used regexp
|
||||||
pat = cmd; /* remember start of search pat */
|
delimiter = *cmd++; // remember delimiter character
|
||||||
|
pat = cmd; // remember start of search pat
|
||||||
cmd = skip_regexp(cmd, delimiter, p_magic, &eap->arg);
|
cmd = skip_regexp(cmd, delimiter, p_magic, &eap->arg);
|
||||||
if (cmd[0] == delimiter) { /* end delimiter found */
|
if (cmd[0] == delimiter) { // end delimiter found
|
||||||
*cmd++ = NUL; /* replace it with a NUL */
|
*cmd++ = NUL; // replace it with a NUL
|
||||||
has_second_delim = true;
|
has_second_delim = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3649,48 +3653,45 @@ void do_sub(exarg_T *eap)
|
|||||||
goto skip;
|
goto skip;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* When the match included the "$" of the last line it may
|
// When the match included the "$" of the last line it may
|
||||||
* go beyond the last line of the buffer. */
|
// go beyond the last line of the buffer.
|
||||||
if (nmatch > curbuf->b_ml.ml_line_count - sub_firstlnum + 1) {
|
if (nmatch > curbuf->b_ml.ml_line_count - sub_firstlnum + 1) {
|
||||||
nmatch = curbuf->b_ml.ml_line_count - sub_firstlnum + 1;
|
nmatch = curbuf->b_ml.ml_line_count - sub_firstlnum + 1;
|
||||||
skip_match = TRUE;
|
skip_match = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Need room for:
|
// Need room for:
|
||||||
* - result so far in new_start (not for first sub in line)
|
// - result so far in new_start (not for first sub in line)
|
||||||
* - original text up to match
|
// - original text up to match
|
||||||
* - length of substituted part
|
// - length of substituted part
|
||||||
* - original text after match
|
// - original text after match
|
||||||
*/
|
if (nmatch == 1) {
|
||||||
if (nmatch == 1)
|
|
||||||
p1 = sub_firstline;
|
p1 = sub_firstline;
|
||||||
else {
|
} else {
|
||||||
p1 = ml_get(sub_firstlnum + nmatch - 1);
|
p1 = ml_get(sub_firstlnum + nmatch - 1);
|
||||||
nmatch_tl += nmatch - 1;
|
nmatch_tl += nmatch - 1;
|
||||||
}
|
}
|
||||||
size_t copy_len = regmatch.startpos[0].col - copycol;
|
size_t copy_len = regmatch.startpos[0].col - copycol;
|
||||||
new_end = sub_grow_buf(&new_start,
|
new_end = sub_grow_buf(&new_start,
|
||||||
copy_len + (STRLEN(p1) - regmatch.endpos[0].col)
|
(STRLEN(p1) - regmatch.endpos[0].col)
|
||||||
+ sublen + 1);
|
+ copy_len + sublen + 1);
|
||||||
|
|
||||||
/*
|
// copy the text up to the part that matched
|
||||||
* copy the text up to the part that matched
|
|
||||||
*/
|
|
||||||
memmove(new_end, sub_firstline + copycol, (size_t)copy_len);
|
memmove(new_end, sub_firstline + copycol, (size_t)copy_len);
|
||||||
new_end += copy_len;
|
new_end += copy_len;
|
||||||
|
|
||||||
(void)vim_regsub_multi(®match,
|
(void)vim_regsub_multi(®match,
|
||||||
sub_firstlnum - regmatch.startpos[0].lnum,
|
sub_firstlnum - regmatch.startpos[0].lnum,
|
||||||
sub, new_end, TRUE, p_magic, TRUE);
|
sub, new_end, true, p_magic, true);
|
||||||
sub_nsubs++;
|
sub_nsubs++;
|
||||||
did_sub = TRUE;
|
did_sub = true;
|
||||||
|
|
||||||
/* Move the cursor to the start of the line, to avoid that it
|
// Move the cursor to the start of the line, to avoid that it
|
||||||
* is beyond the end of the line after the substitution. */
|
// is beyond the end of the line after the substitution.
|
||||||
curwin->w_cursor.col = 0;
|
curwin->w_cursor.col = 0;
|
||||||
|
|
||||||
/* For a multi-line match, make a copy of the last matched
|
// For a multi-line match, make a copy of the last matched
|
||||||
* line and continue in that one. */
|
// line and continue in that one.
|
||||||
if (nmatch > 1) {
|
if (nmatch > 1) {
|
||||||
sub_firstlnum += nmatch - 1;
|
sub_firstlnum += nmatch - 1;
|
||||||
xfree(sub_firstline);
|
xfree(sub_firstline);
|
||||||
@@ -3703,33 +3704,31 @@ void do_sub(exarg_T *eap)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remember next character to be copied. */
|
// Remember next character to be copied.
|
||||||
copycol = regmatch.endpos[0].col;
|
copycol = regmatch.endpos[0].col;
|
||||||
|
|
||||||
if (skip_match) {
|
if (skip_match) {
|
||||||
/* Already hit end of the buffer, sub_firstlnum is one
|
// Already hit end of the buffer, sub_firstlnum is one
|
||||||
* less than what it ought to be. */
|
// less than what it ought to be.
|
||||||
xfree(sub_firstline);
|
xfree(sub_firstline);
|
||||||
sub_firstline = vim_strsave((char_u *)"");
|
sub_firstline = vim_strsave((char_u *)"");
|
||||||
copycol = 0;
|
copycol = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// Now the trick is to replace CTRL-M chars with a real line
|
||||||
* Now the trick is to replace CTRL-M chars with a real line
|
// break. This would make it impossible to insert a CTRL-M in
|
||||||
* break. This would make it impossible to insert a CTRL-M in
|
// the text. The line break can be avoided by preceding the
|
||||||
* the text. The line break can be avoided by preceding the
|
// CTRL-M with a backslash. To be able to insert a backslash,
|
||||||
* CTRL-M with a backslash. To be able to insert a backslash,
|
// they must be doubled in the string and are halved here.
|
||||||
* they must be doubled in the string and are halved here.
|
// That is Vi compatible.
|
||||||
* That is Vi compatible.
|
for (p1 = new_end; *p1; p1++) {
|
||||||
*/
|
if (p1[0] == '\\' && p1[1] != NUL) { // remove backslash
|
||||||
for (p1 = new_end; *p1; ++p1) {
|
|
||||||
if (p1[0] == '\\' && p1[1] != NUL) /* remove backslash */
|
|
||||||
STRMOVE(p1, p1 + 1);
|
STRMOVE(p1, p1 + 1);
|
||||||
else if (*p1 == CAR) {
|
} else if (*p1 == CAR) {
|
||||||
if (u_inssub(lnum) == OK) { /* prepare for undo */
|
if (u_inssub(lnum) == OK) { // prepare for undo
|
||||||
*p1 = NUL; /* truncate up to the CR */
|
*p1 = NUL; // truncate up to the CR
|
||||||
ml_append(lnum - 1, new_start,
|
ml_append(lnum - 1, new_start,
|
||||||
(colnr_T)(p1 - new_start + 1), FALSE);
|
(colnr_T)(p1 - new_start + 1), false);
|
||||||
mark_adjust(lnum + 1, (linenr_T)MAXLNUM, 1L, 0L);
|
mark_adjust(lnum + 1, (linenr_T)MAXLNUM, 1L, 0L);
|
||||||
if (subflags.do_ask) {
|
if (subflags.do_ask) {
|
||||||
appended_lines(lnum - 1, 1L);
|
appended_lines(lnum - 1, 1L);
|
||||||
@@ -3739,20 +3738,21 @@ void do_sub(exarg_T *eap)
|
|||||||
}
|
}
|
||||||
last_line = lnum + 1;
|
last_line = lnum + 1;
|
||||||
}
|
}
|
||||||
/* All line numbers increase. */
|
// All line numbers increase.
|
||||||
++sub_firstlnum;
|
sub_firstlnum++;
|
||||||
++lnum;
|
lnum++;
|
||||||
++line2;
|
line2++;
|
||||||
/* move the cursor to the new line, like Vi */
|
// move the cursor to the new line, like Vi
|
||||||
++curwin->w_cursor.lnum;
|
curwin->w_cursor.lnum++;
|
||||||
/* copy the rest */
|
// copy the rest
|
||||||
STRMOVE(new_start, p1 + 1);
|
STRMOVE(new_start, p1 + 1);
|
||||||
p1 = new_start - 1;
|
p1 = new_start - 1;
|
||||||
}
|
}
|
||||||
} else if (has_mbyte)
|
} else if (has_mbyte) {
|
||||||
p1 += (*mb_ptr2len)(p1) - 1;
|
p1 += (*mb_ptr2len)(p1) - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 4. If subflags.do_all is set, find next match.
|
// 4. If subflags.do_all is set, find next match.
|
||||||
// Prevent endless loop with patterns that match empty
|
// Prevent endless loop with patterns that match empty
|
||||||
@@ -6102,7 +6102,8 @@ static void inc_sub_display(char_u * pat,
|
|||||||
cmdwin_type = get_cmdline_type();
|
cmdwin_type = get_cmdline_type();
|
||||||
|
|
||||||
// Create the command-line buffer empty.
|
// Create the command-line buffer empty.
|
||||||
(void)do_ecmd(inc_sub_bufnr, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE | ECMD_RESERVED_BUFNR, NULL);
|
(void)do_ecmd(inc_sub_bufnr, NULL, NULL, NULL, ECMD_ONE,
|
||||||
|
ECMD_HIDE | ECMD_RESERVED_BUFNR, NULL);
|
||||||
inc_sub_bufnr = curbuf->handle;
|
inc_sub_bufnr = curbuf->handle;
|
||||||
(void)setfname(curbuf, (char_u *) "[inc_sub]", NULL, true);
|
(void)setfname(curbuf, (char_u *) "[inc_sub]", NULL, true);
|
||||||
set_option_value((char_u *) "bt", 0L, (char_u *) "incsub", OPT_LOCAL);
|
set_option_value((char_u *) "bt", 0L, (char_u *) "incsub", OPT_LOCAL);
|
||||||
|
@@ -9,14 +9,14 @@
|
|||||||
#include "nvim/lib/klist.h"
|
#include "nvim/lib/klist.h"
|
||||||
#include "nvim/lib/kvec.h"
|
#include "nvim/lib/kvec.h"
|
||||||
|
|
||||||
/* flags for do_ecmd() */
|
// flags for do_ecmd()
|
||||||
#define ECMD_HIDE 0x01 /* don't free the current buffer */
|
#define ECMD_HIDE 0x01 // don't free the current buffer
|
||||||
#define ECMD_SET_HELP 0x02 /* set b_help flag of (new) buffer before
|
#define ECMD_SET_HELP 0x02 // set b_help flag of (new) buffer before
|
||||||
opening file */
|
// opening file
|
||||||
#define ECMD_OLDBUF 0x04 /* use existing buffer if it exists */
|
#define ECMD_OLDBUF 0x04 // use existing buffer if it exists
|
||||||
#define ECMD_FORCEIT 0x08 /* ! used in Ex command */
|
#define ECMD_FORCEIT 0x08 // ! used in Ex command
|
||||||
#define ECMD_ADDBUF 0x10 /* don't edit, just add to buffer list */
|
#define ECMD_ADDBUF 0x10 // don't edit, just add to buffer list
|
||||||
#define ECMD_RESERVED_BUFNR 0x20 /* bufnr argument is reserved bufnr */
|
#define ECMD_RESERVED_BUFNR 0x20 // bufnr argument is reserved bufnr
|
||||||
|
|
||||||
/* for lnum argument in do_ecmd() */
|
/* for lnum argument in do_ecmd() */
|
||||||
#define ECMD_LASTL (linenr_T)0 /* use last position in loaded file */
|
#define ECMD_LASTL (linenr_T)0 /* use last position in loaded file */
|
||||||
|
@@ -1249,7 +1249,7 @@ static char_u * do_one_cmd(char_u **cmdlinep,
|
|||||||
ea.line1 = 1;
|
ea.line1 = 1;
|
||||||
ea.line2 = 1;
|
ea.line2 = 1;
|
||||||
ea.is_live = flags & DOCMD_LIVE_PREVIEW;
|
ea.is_live = flags & DOCMD_LIVE_PREVIEW;
|
||||||
++ex_nesting_level;
|
ex_nesting_level++;
|
||||||
|
|
||||||
/* When the last file has not been edited :q has to be typed twice. */
|
/* When the last file has not been edited :q has to be typed twice. */
|
||||||
if (quitmore
|
if (quitmore
|
||||||
@@ -1727,8 +1727,9 @@ static char_u * do_one_cmd(char_u **cmdlinep,
|
|||||||
if (ea.cmdidx == CMD_SIZE) {
|
if (ea.cmdidx == CMD_SIZE) {
|
||||||
if (!ea.skip) {
|
if (!ea.skip) {
|
||||||
STRCPY(IObuff, _("E492: Not an editor command"));
|
STRCPY(IObuff, _("E492: Not an editor command"));
|
||||||
if (!(flags & DOCMD_VERBOSE))
|
if (!(flags & DOCMD_VERBOSE)) {
|
||||||
append_command(*cmdlinep);
|
append_command(*cmdlinep);
|
||||||
|
}
|
||||||
errormsg = IObuff;
|
errormsg = IObuff;
|
||||||
did_emsg_syntax = TRUE;
|
did_emsg_syntax = TRUE;
|
||||||
}
|
}
|
||||||
|
@@ -3,14 +3,15 @@
|
|||||||
|
|
||||||
#include "nvim/ex_cmds_defs.h"
|
#include "nvim/ex_cmds_defs.h"
|
||||||
|
|
||||||
/* flags for do_cmdline() */
|
// flags for do_cmdline()
|
||||||
#define DOCMD_VERBOSE 0x01 /* included command in error message */
|
#define DOCMD_VERBOSE 0x01 // included command in error message
|
||||||
#define DOCMD_NOWAIT 0x02 /* don't call wait_return() and friends */
|
#define DOCMD_NOWAIT 0x02 // don't call wait_return() and friends
|
||||||
#define DOCMD_REPEAT 0x04 /* repeat exec. until getline() returns NULL */
|
#define DOCMD_REPEAT 0x04 // repeat exec. until getline() returns NULL
|
||||||
#define DOCMD_KEYTYPED 0x08 /* don't reset KeyTyped */
|
#define DOCMD_KEYTYPED 0x08 // don't reset KeyTyped
|
||||||
#define DOCMD_EXCRESET 0x10 /* reset exception environment (for debugging)*/
|
#define DOCMD_EXCRESET 0x10 // reset exception environment (for debugging
|
||||||
#define DOCMD_KEEPLINE 0x20 /* keep typed line for repeating with "." */
|
#define DOCMD_KEEPLINE 0x20 // keep typed line for repeating with "."
|
||||||
#define DOCMD_LIVE_PREVIEW 0x40 // Command is a live preview like incsubstitute
|
#define DOCMD_LIVE_PREVIEW 0x40 // Command is a live preview like
|
||||||
|
// incsubstitution
|
||||||
|
|
||||||
/* defines for eval_vars() */
|
/* defines for eval_vars() */
|
||||||
#define VALID_PATH 1
|
#define VALID_PATH 1
|
||||||
|
@@ -5063,10 +5063,10 @@ void buf_reload(buf_T *buf, int orig_mode)
|
|||||||
* the old contents. Can't use memory only, the file might be
|
* the old contents. Can't use memory only, the file might be
|
||||||
* too big. Use a hidden buffer to move the buffer contents to.
|
* too big. Use a hidden buffer to move the buffer contents to.
|
||||||
*/
|
*/
|
||||||
if (bufempty() || saved == FAIL)
|
if (bufempty() || saved == FAIL) {
|
||||||
savebuf = NULL;
|
savebuf = NULL;
|
||||||
else {
|
} else {
|
||||||
/* Allocate a buffer without putting it in the buffer list. */
|
// Allocate a buffer without putting it in the buffer list.
|
||||||
savebuf = buflist_new(NULL, NULL, (linenr_T)1, BLN_DUMMY, 0);
|
savebuf = buflist_new(NULL, NULL, (linenr_T)1, BLN_DUMMY, 0);
|
||||||
if (savebuf != NULL && buf == curbuf) {
|
if (savebuf != NULL && buf == curbuf) {
|
||||||
/* Open the memline. */
|
/* Open the memline. */
|
||||||
|
@@ -473,7 +473,7 @@ static void fname2fnum(xfmark_T *fm)
|
|||||||
os_dirname(IObuff, IOSIZE);
|
os_dirname(IObuff, IOSIZE);
|
||||||
p = path_shorten_fname(NameBuff, IObuff);
|
p = path_shorten_fname(NameBuff, IObuff);
|
||||||
|
|
||||||
/* buflist_new() will call fmarks_check_names() */
|
// buflist_new() will call fmarks_check_names()
|
||||||
(void)buflist_new(NameBuff, p, (linenr_T)1, 0, 0);
|
(void)buflist_new(NameBuff, p, (linenr_T)1, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -3326,10 +3326,11 @@ load_dummy_buffer (
|
|||||||
int failed = TRUE;
|
int failed = TRUE;
|
||||||
aco_save_T aco;
|
aco_save_T aco;
|
||||||
|
|
||||||
/* Allocate a buffer without putting it in the buffer list. */
|
// Allocate a buffer without putting it in the buffer list.
|
||||||
newbuf = buflist_new(NULL, NULL, (linenr_T)1, BLN_DUMMY, 0);
|
newbuf = buflist_new(NULL, NULL, (linenr_T)1, BLN_DUMMY, 0);
|
||||||
if (newbuf == NULL)
|
if (newbuf == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Init the options. */
|
/* Init the options. */
|
||||||
buf_copy_options(newbuf, BCO_ENTER | BCO_NOHELP);
|
buf_copy_options(newbuf, BCO_ENTER | BCO_NOHELP);
|
||||||
|
@@ -2904,8 +2904,9 @@ static int win_alloc_firstwin(win_T *oldwin)
|
|||||||
/* Very first window, need to create an empty buffer for it and
|
/* Very first window, need to create an empty buffer for it and
|
||||||
* initialize from scratch. */
|
* initialize from scratch. */
|
||||||
curbuf = buflist_new(NULL, NULL, 1L, BLN_LISTED, 0);
|
curbuf = buflist_new(NULL, NULL, 1L, BLN_LISTED, 0);
|
||||||
if (curbuf == NULL)
|
if (curbuf == NULL) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
}
|
||||||
curwin->w_buffer = curbuf;
|
curwin->w_buffer = curbuf;
|
||||||
curwin->w_s = &(curbuf->b_s);
|
curwin->w_s = &(curbuf->b_s);
|
||||||
curbuf->b_nwindows = 1; /* there is one window */
|
curbuf->b_nwindows = 1; /* there is one window */
|
||||||
|
Reference in New Issue
Block a user