aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/change.c10
-rw-r--r--src/nvim/fileio.c13
-rw-r--r--src/nvim/globals.h10
-rw-r--r--src/nvim/main.c3
-rw-r--r--src/nvim/quickfix.c8
-rw-r--r--src/nvim/spell_defs.h2
-rw-r--r--src/nvim/testdir/test_quickfix.vim13
-rw-r--r--src/nvim/version.c13
8 files changed, 35 insertions, 37 deletions
diff --git a/src/nvim/change.c b/src/nvim/change.c
index 271d350967..0f5081c94c 100644
--- a/src/nvim/change.c
+++ b/src/nvim/change.c
@@ -530,12 +530,8 @@ void ins_bytes_len(char_u *p, size_t len)
{
size_t n;
for (size_t i = 0; i < len; i += n) {
- if (enc_utf8) {
- // avoid reading past p[len]
- n = (size_t)utfc_ptr2len_len(p + i, (int)(len - i));
- } else {
- n = (size_t)(*mb_ptr2len)(p + i);
- }
+ // avoid reading past p[len]
+ n = (size_t)utfc_ptr2len_len(p + i, (int)(len - i));
ins_char_bytes(p + i, n);
}
}
@@ -761,7 +757,7 @@ int del_bytes(colnr_T count, bool fixpos_arg, bool use_delcombine)
// If 'delcombine' is set and deleting (less than) one character, only
// delete the last combining character.
- if (p_deco && use_delcombine && enc_utf8
+ if (p_deco && use_delcombine
&& utfc_ptr2len(oldp + col) >= count) {
int cc[MAX_MCO];
int n;
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index 49de0f3bf8..6ee3a3f579 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -1310,14 +1310,11 @@ retry:
char_u *dest;
char_u *tail = NULL;
- /*
- * "enc_utf8" set: Convert Unicode or Latin1 to UTF-8.
- * "enc_utf8" not set: Convert Unicode to Latin1.
- * Go from end to start through the buffer, because the number
- * of bytes may increase.
- * "dest" points to after where the UTF-8 bytes go, "p" points
- * to after the next character to convert.
- */
+ // Convert Unicode or Latin1 to UTF-8.
+ // Go from end to start through the buffer, because the number
+ // of bytes may increase.
+ // "dest" points to after where the UTF-8 bytes go, "p" points
+ // to after the next character to convert.
dest = ptr + real_size;
if (fio_flags == FIO_LATIN1 || fio_flags == FIO_UTF8) {
p = ptr + size;
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index 657afeaf4c..566a5ae9d6 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -585,8 +585,8 @@ EXTERN int vr_lines_changed INIT(= 0); // #Lines changed by "gR" so far
EXTERN int inhibit_delete_count INIT(= 0);
// These flags are set based upon 'fileencoding'.
-// Note that "enc_utf8" is also set for "unicode", because the characters are
-// internally stored as UTF-8 (to avoid trouble with NUL bytes).
+// The characters are internally stored as UTF-8
+// to avoid trouble with NUL bytes.
# define DBCS_JPN 932 // japan
# define DBCS_JPNU 9932 // euc-jp
# define DBCS_KOR 949 // korea
@@ -598,12 +598,6 @@ EXTERN int inhibit_delete_count INIT(= 0);
# define DBCS_2BYTE 1 // 2byte-
# define DBCS_DEBUG -1
-// mbyte flags that used to depend on 'encoding'. These are now deprecated, as
-// 'encoding' is always "utf-8". Code that use them can be refactored to
-// remove dead code.
-#define enc_utf8 true
-#define has_mbyte true
-
/// Encoding used when 'fencs' is set to "default"
EXTERN char_u *fenc_default INIT(= NULL);
diff --git a/src/nvim/main.c b/src/nvim/main.c
index 6ff5216a84..941258fa79 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -188,9 +188,6 @@ void early_init(mparm_T *paramp)
global_alist.id = 0;
// Set the default values for the options.
- // NOTE: Non-latin1 translated messages are working only after this,
- // because this is where "has_mbyte" will be set, which is used by
- // msg_outtrans_len_attr().
// First find out the home directory, needed to expand "~" in options.
init_homedir(); // find real value of $HOME
set_init_1(paramp != NULL ? paramp->clean : false);
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index 6ca97c3072..d3ca65c53c 100644
--- a/src/nvim/quickfix.c
+++ b/src/nvim/quickfix.c
@@ -3975,11 +3975,15 @@ static void qf_fill_buffer(qf_list_T *qfl, buf_T *buf, qfline_T *old_last)
*dirname = NUL;
// Add one line for each error
- if (old_last == NULL || old_last->qf_next == NULL) {
+ if (old_last == NULL) {
qfp = qfl->qf_start;
lnum = 0;
} else {
- qfp = old_last->qf_next;
+ if (old_last->qf_next != NULL) {
+ qfp = old_last->qf_next;
+ } else {
+ qfp = old_last;
+ }
lnum = buf->b_ml.ml_line_count;
}
while (lnum < qfl->qf_count) {
diff --git a/src/nvim/spell_defs.h b/src/nvim/spell_defs.h
index 05667f060e..e2c9ab7ae8 100644
--- a/src/nvim/spell_defs.h
+++ b/src/nvim/spell_defs.h
@@ -162,7 +162,7 @@ struct slang_S {
bool sl_collapse; // SAL collapse_result
bool sl_rem_accents; // SAL remove_accents
bool sl_sofo; // SOFOFROM and SOFOTO instead of SAL items:
- // "sl_sal_first" maps chars, when has_mbyte
+ // "sl_sal_first" maps chars
// "sl_sal" is a list of wide char lists.
garray_T sl_repsal; // list of fromto_T entries from REPSAL lines
int16_t sl_repsal_first[256]; // sl_rep_first for REPSAL lines
diff --git a/src/nvim/testdir/test_quickfix.vim b/src/nvim/testdir/test_quickfix.vim
index 049163890e..3e97cd2dd0 100644
--- a/src/nvim/testdir/test_quickfix.vim
+++ b/src/nvim/testdir/test_quickfix.vim
@@ -4410,4 +4410,17 @@ func Test_search_in_dirstack()
call delete('Xtestdir', 'rf')
endfunc
+" Test for adding an invalid entry with the quickfix window open and making
+" sure that the window contents are not changed
+func Test_add_invalid_entry_with_qf_window()
+ call setqflist([], 'f')
+ cexpr "Xfile1:10:aa"
+ copen
+ call setqflist(['bb'], 'a')
+ call assert_equal(1, line('$'))
+ call assert_equal(['Xfile1|10| aa'], getline(1, '$'))
+ call assert_equal([{'lnum': 10, 'bufnr': bufnr('Xfile1'), 'col': 0, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'module': '', 'text': 'aa'}], getqflist())
+ cclose
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/nvim/version.c b/src/nvim/version.c
index 7296c74109..6be2a61c6a 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -2301,14 +2301,11 @@ static void do_intro_line(long row, char_u *mesg, int attr)
for (p = mesg; *p != NUL; p += l) {
clen = 0;
- for (l = 0; p[l] != NUL
- && (l == 0 || (p[l] != '<' && p[l - 1] != '>')); ++l) {
- if (has_mbyte) {
- clen += ptr2cells(p + l);
- l += (*mb_ptr2len)(p + l) - 1;
- } else {
- clen += byte2cells(p[l]);
- }
+ for (l = 0;
+ p[l] != NUL && (l == 0 || (p[l] != '<' && p[l - 1] != '>'));
+ l++) {
+ clen += ptr2cells(p + l);
+ l += utfc_ptr2len(p + l) - 1;
}
assert(row <= INT_MAX && col <= INT_MAX);
grid_puts_len(&default_grid, p, l, (int)row, (int)col,