aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/fileio.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/fileio.c')
-rw-r--r--src/nvim/fileio.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index 3b715e2c0b..df9c4928c9 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -234,7 +234,7 @@ int readfile(char *fname, char *sfname, linenr_T from, linenr_T lines_to_skip,
int using_b_fname;
static char *msg_is_a_directory = N_("is a directory");
- au_did_filetype = false; // reset before triggering any autocommands
+ curbuf->b_au_did_filetype = false; // reset before triggering any autocommands
curbuf->b_no_eol_lnum = 0; // in case it was set by the previous read
@@ -957,7 +957,7 @@ retry:
int tlen = 0;
while (true) {
p = (uint8_t *)ml_get(read_buf_lnum) + read_buf_col;
- int n = (int)strlen((char *)p);
+ int n = ml_get_len(read_buf_lnum) - read_buf_col;
if (tlen + n + 1 > size) {
// Filled up to "size", append partial line.
// Change NL to NUL to reverse the effect done
@@ -1620,7 +1620,7 @@ failed:
save_file_ff(curbuf);
// If editing a new file: set 'fenc' for the current buffer.
// Also for ":read ++edit file".
- set_string_option_direct(kOptFileencoding, fenc, OPT_LOCAL, 0);
+ set_option_direct(kOptFileencoding, CSTR_AS_OPTVAL(fenc), OPT_LOCAL, 0);
}
if (fenc_alloced) {
xfree(fenc);
@@ -1854,7 +1854,7 @@ failed:
} else if (newfile || (read_buffer && sfname != NULL)) {
apply_autocmds_exarg(EVENT_BUFREADPOST, NULL, sfname,
false, curbuf, eap);
- if (!au_did_filetype && *curbuf->b_p_ft != NUL) {
+ if (!curbuf->b_au_did_filetype && *curbuf->b_p_ft != NUL) {
// EVENT_FILETYPE was not triggered but the buffer already has a
// filetype. Trigger EVENT_FILETYPE using the existing filetype.
apply_autocmds(EVENT_FILETYPE, curbuf->b_p_ft, curbuf->b_fname, true, curbuf);
@@ -1968,7 +1968,7 @@ void set_forced_fenc(exarg_T *eap)
}
char *fenc = enc_canonize(eap->cmd + eap->force_enc);
- set_string_option_direct(kOptFileencoding, fenc, OPT_LOCAL, 0);
+ set_option_direct(kOptFileencoding, CSTR_AS_OPTVAL(fenc), OPT_LOCAL, 0);
xfree(fenc);
}
@@ -3151,7 +3151,7 @@ void buf_reload(buf_T *buf, int orig_mode, bool reload_options)
if (saved == OK) {
curbuf->b_flags |= BF_CHECK_RO; // check for RO again
- keep_filetype = true; // don't detect 'filetype'
+ curbuf->b_keep_filetype = true; // don't detect 'filetype'
if (readfile(buf->b_ffname, buf->b_fname, 0, 0,
(linenr_T)MAXLNUM, &ea, flags, shortmess(SHM_FILEINFO)) != OK) {
if (!aborting()) {
@@ -3197,9 +3197,9 @@ void buf_reload(buf_T *buf, int orig_mode, bool reload_options)
curwin->w_topline = old_topline;
}
curwin->w_cursor = old_cursor;
- check_cursor();
+ check_cursor(curwin);
update_topline(curwin);
- keep_filetype = false;
+ curbuf->b_keep_filetype = false;
// Update folds unless they are defined manually.
FOR_ALL_TAB_WINDOWS(tp, wp) {