aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mpack/conv.c1
-rw-r--r--src/mpack/lmpack.c2
-rw-r--r--src/nvim/api/buffer.c21
-rw-r--r--src/nvim/change.c2
-rw-r--r--src/nvim/channel.c4
-rw-r--r--src/nvim/eval/funcs.c12
-rw-r--r--src/nvim/eval/typval.c2
-rw-r--r--src/nvim/extmark.c2
-rw-r--r--src/nvim/if_cscope.c6
-rw-r--r--src/nvim/lua/treesitter.c10
-rw-r--r--src/nvim/marktree.c4
-rw-r--r--src/nvim/menu.c2
-rw-r--r--src/nvim/message.c2
-rw-r--r--src/nvim/mouse.c12
-rw-r--r--src/nvim/option.c2
-rw-r--r--src/nvim/shada.c51
-rw-r--r--src/nvim/spell.c4
-rw-r--r--src/nvim/terminal.c23
-rw-r--r--src/nvim/undo.c2
19 files changed, 81 insertions, 83 deletions
diff --git a/src/mpack/conv.c b/src/mpack/conv.c
index 31297a8784..6bd446ca49 100644
--- a/src/mpack/conv.c
+++ b/src/mpack/conv.c
@@ -301,7 +301,6 @@ MPACK_API double mpack_unpack_number(mpack_token_t t)
*/
if (!hi) {
assert(t.length <= 4);
- hi = 0;
lo = (~lo & (((mpack_uint32_t)1 << ((t.length * 8) - 1)) - 1));
} else {
hi = ~hi;
diff --git a/src/mpack/lmpack.c b/src/mpack/lmpack.c
index 4b0e132a3a..2d6131d7cb 100644
--- a/src/mpack/lmpack.c
+++ b/src/mpack/lmpack.c
@@ -445,7 +445,6 @@ static int lmpack_unpacker_unpack_str(lua_State *L, Unpacker *unpacker,
if (rv == MPACK_NOMEM) {
unpacker->parser = lmpack_grow_parser(unpacker->parser);
if (!unpacker->parser) {
- unpacker->unpacking = 0;
return luaL_error(L, "failed to grow Unpacker capacity");
}
}
@@ -799,7 +798,6 @@ static int lmpack_packer_pack(lua_State *L)
if (result == MPACK_NOMEM) {
packer->parser = lmpack_grow_parser(packer->parser);
if (!packer->parser) {
- packer->packing = 0;
return luaL_error(L, "Failed to grow Packer capacity");
}
}
diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c
index f906b426d7..569c0c9771 100644
--- a/src/nvim/api/buffer.c
+++ b/src/nvim/api/buffer.c
@@ -418,7 +418,7 @@ void nvim_buf_set_lines(uint64_t channel_id, Buffer buffer, Integer start, Integ
try_start();
aco_save_T aco;
- aucmd_prepbuf(&aco, (buf_T *)buf);
+ aucmd_prepbuf(&aco, buf);
if (!MODIFIABLE(buf)) {
api_set_error(err, kErrorTypeException, "Buffer is not 'modifiable'");
@@ -657,7 +657,7 @@ void nvim_buf_set_text(uint64_t channel_id, Buffer buffer, Integer start_row, In
try_start();
aco_save_T aco;
- aucmd_prepbuf(&aco, (buf_T *)buf);
+ aucmd_prepbuf(&aco, buf);
if (!MODIFIABLE(buf)) {
api_set_error(err, kErrorTypeException, "Buffer is not 'modifiable'");
@@ -1341,7 +1341,7 @@ ArrayOf(Integer) nvim_buf_get_extmark_by_id(Buffer buffer, Integer ns_id,
if (extmark.row < 0) {
return rv;
}
- return extmark_to_array(extmark, false, (bool)details);
+ return extmark_to_array(extmark, false, details);
}
/// Gets extmarks in "traversal order" from a |charwise| region defined by
@@ -1562,17 +1562,18 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, Integer line, Integer
Dict(set_extmark) *opts, Error *err)
FUNC_API_SINCE(7)
{
+ Decoration decor = DECORATION_INIT;
+
buf_T *buf = find_buffer_by_handle(buffer, err);
if (!buf) {
- return 0;
+ goto error;
}
if (!ns_initialized((uint64_t)ns_id)) {
api_set_error(err, kErrorTypeValidation, "Invalid ns_id");
- return 0;
+ goto error;
}
-
uint64_t id = 0;
if (opts->id.type == kObjectTypeInteger && opts->id.data.integer > 0) {
id = (uint64_t)opts->id.data.integer;
@@ -1609,8 +1610,6 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, Integer line, Integer
goto error;
}
- Decoration decor = DECORATION_INIT;
-
if (HAS_KEY(opts->hl_group)) {
decor.hl_id = object_to_hl_id(opts->hl_group, "hl_group", err);
if (ERROR_SET(err)) {
@@ -1742,7 +1741,7 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, Integer line, Integer
if (line < 0 || line > buf->b_ml.ml_line_count) {
api_set_error(err, kErrorTypeValidation, "line value outside range");
- return 0;
+ goto error;
} else if (line < buf->b_ml.ml_line_count) {
len = ephemeral ? MAXCOL : STRLEN(ml_get_buf(buf, (linenr_T)line+1, false));
}
@@ -1751,7 +1750,7 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, Integer line, Integer
col = (Integer)len;
} else if (col < -1 || col > (Integer)len) {
api_set_error(err, kErrorTypeValidation, "col value outside range");
- return 0;
+ goto error;
}
if (col2 >= 0) {
@@ -1984,7 +1983,7 @@ Object nvim_buf_call(Buffer buffer, LuaRef fun, Error *err)
}
try_start();
aco_save_T aco;
- aucmd_prepbuf(&aco, (buf_T *)buf);
+ aucmd_prepbuf(&aco, buf);
Array args = ARRAY_DICT_INIT;
Object res = nlua_call_ref(fun, NULL, args, true, err);
diff --git a/src/nvim/change.c b/src/nvim/change.c
index 4ac5edeaa9..7f702d888e 100644
--- a/src/nvim/change.c
+++ b/src/nvim/change.c
@@ -625,7 +625,7 @@ void ins_char_bytes(char_u *buf, size_t charlen)
// Copy bytes before the cursor.
if (col > 0) {
- memmove(newp, oldp, (size_t)col);
+ memmove(newp, oldp, col);
}
// Copy bytes after the changed character(s).
diff --git a/src/nvim/channel.c b/src/nvim/channel.c
index 30243a3102..db0a2ff64c 100644
--- a/src/nvim/channel.c
+++ b/src/nvim/channel.c
@@ -87,7 +87,7 @@ bool channel_close(uint64_t id, ChannelPart part, const char **error)
break;
case kChannelStreamProc:
- proc = (Process *)&chan->stream.proc;
+ proc = &chan->stream.proc;
if (part == kChannelPartStdin || close_main) {
stream_may_close(&proc->in);
}
@@ -335,7 +335,7 @@ Channel *channel_job_start(char **argv, CallbackReader on_stdout, CallbackReader
chan->stream.uv = libuv_process_init(&main_loop, chan);
}
- Process *proc = (Process *)&chan->stream.proc;
+ Process *proc = &chan->stream.proc;
proc->argv = argv;
proc->cb = channel_process_exit_cb;
proc->events = chan->events;
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
index 50e0b0b258..71ad0b7369 100644
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -3741,7 +3741,7 @@ static void f_getmatches(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (cur->conceal_char) {
char buf[MB_MAXBYTES + 1];
- buf[utf_char2bytes((int)cur->conceal_char, (char_u *)buf)] = NUL;
+ buf[utf_char2bytes(cur->conceal_char, (char_u *)buf)] = NUL;
tv_dict_add_str(dict, S_LEN("conceal"), buf);
}
@@ -5230,7 +5230,7 @@ static void f_jobpid(typval_T *argvars, typval_T *rettv, FunPtr fptr)
return;
}
- Process *proc = (Process *)&data->stream.proc;
+ Process *proc = &data->stream.proc;
rettv->vval.v_number = proc->pid;
}
@@ -5528,7 +5528,7 @@ static void f_jobstop(typval_T *argvars, typval_T *rettv, FunPtr fptr)
// Ignore return code, but show error later.
(void)channel_close(data->id, kChannelPartRpc, &error);
}
- process_stop((Process *)&data->stream.proc);
+ process_stop(&data->stream.proc);
rettv->vval.v_number = 1;
if (error) {
EMSG(error);
@@ -6135,7 +6135,7 @@ static void find_some_match(typval_T *const argvars, typval_T *const rettv,
}
}
- match = vim_regexec_nl(&regmatch, str, (colnr_T)startcol);
+ match = vim_regexec_nl(&regmatch, str, startcol);
if (match && --nth <= 0) {
break;
@@ -6346,7 +6346,7 @@ static void f_matcharg(typval_T *argvars, typval_T *rettv, FunPtr fptr)
: 0));
if (id >= 1 && id <= 3) {
- matchitem_T *const m = (matchitem_T *)get_match(curwin, id);
+ matchitem_T *const m = get_match(curwin, id);
if (m != NULL) {
tv_list_append_string(rettv->vval.v_list,
@@ -6993,7 +6993,7 @@ static void f_range(typval_T *argvars, typval_T *rettv, FunPtr fptr)
} else {
tv_list_alloc_ret(rettv, (end - start) / stride);
for (i = start; stride > 0 ? i <= end : i >= end; i += stride) {
- tv_list_append_number(rettv->vval.v_list, (varnumber_T)i);
+ tv_list_append_number(rettv->vval.v_list, i);
}
}
}
diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c
index 4c8789964f..cfc95ba167 100644
--- a/src/nvim/eval/typval.c
+++ b/src/nvim/eval/typval.c
@@ -2861,7 +2861,7 @@ bool tv_equal(typval_T *const tv1, typval_T *const tv2, const bool ic, const boo
char buf2[NUMBUFLEN];
const char *s1 = tv_get_string_buf(tv1, buf1);
const char *s2 = tv_get_string_buf(tv2, buf2);
- return mb_strcmp_ic((bool)ic, s1, s2) == 0;
+ return mb_strcmp_ic(ic, s1, s2) == 0;
}
case VAR_BOOL:
return tv1->vval.v_bool == tv2->vval.v_bool;
diff --git a/src/nvim/extmark.c b/src/nvim/extmark.c
index cf01c305d7..dc73e34111 100644
--- a/src/nvim/extmark.c
+++ b/src/nvim/extmark.c
@@ -723,7 +723,7 @@ void extmark_move_region(buf_T *buf, int start_row, colnr_T start_col, bcount_t
uint64_t src2ns(Integer *src_id)
{
if (*src_id == 0) {
- *src_id = (Integer)nvim_create_namespace((String)STRING_INIT);
+ *src_id = nvim_create_namespace((String)STRING_INIT);
}
if (*src_id < 0) {
return UINT64_MAX;
diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c
index 76dcb58236..f236b966ca 100644
--- a/src/nvim/if_cscope.c
+++ b/src/nvim/if_cscope.c
@@ -1294,7 +1294,7 @@ static int cs_kill(exarg_T *eap)
}
}
} else {
- cs_kill_execute((size_t)i, stok);
+ cs_kill_execute(i, stok);
}
}
@@ -1559,8 +1559,8 @@ static void cs_fill_results(char *tagstr, size_t totmatches, int *nummatches_a,
assert(totmatches > 0);
buf = xmalloc(CSREAD_BUFSIZE);
- matches = xmalloc(sizeof(char *) * (size_t)totmatches);
- cntxts = xmalloc(sizeof(char *) * (size_t)totmatches);
+ matches = xmalloc(sizeof(char *) * totmatches);
+ cntxts = xmalloc(sizeof(char *) * totmatches);
for (size_t i = 0; i < csinfo_size; i++) {
if (nummatches_a[i] < 1) {
diff --git a/src/nvim/lua/treesitter.c b/src/nvim/lua/treesitter.c
index 37929093e3..bd978cc8ab 100644
--- a/src/nvim/lua/treesitter.c
+++ b/src/nvim/lua/treesitter.c
@@ -30,6 +30,7 @@
typedef struct {
TSQueryCursor *cursor;
int predicated_match;
+ int max_match_id;
} TSLua_cursor;
#ifdef INCLUDE_GENERATED_DECLARATIONS
@@ -1055,6 +1056,8 @@ static int query_next_match(lua_State *L)
static int query_next_capture(lua_State *L)
{
+ // Upvalues are:
+ // [ cursor, node, query, current_match ]
TSLua_cursor *ud = lua_touserdata(L, lua_upvalueindex(1));
TSQueryCursor *cursor = ud->cursor;
@@ -1078,9 +1081,13 @@ static int query_next_capture(lua_State *L)
lua_pushinteger(L, capture.index+1); // [index]
push_node(L, capture.node, lua_upvalueindex(2)); // [index, node]
+ // Now check if we need to run the predicates
uint32_t n_pred;
ts_query_predicates_for_pattern(query, match.pattern_index, &n_pred);
- if (n_pred > 0 && capture_index == 0) {
+
+ if (n_pred > 0 && (ud->max_match_id < (int)match.id)) {
+ ud->max_match_id = match.id;
+
lua_pushvalue(L, lua_upvalueindex(4)); // [index, node, match]
set_match(L, &match, lua_upvalueindex(2));
lua_pushinteger(L, match.pattern_index+1);
@@ -1127,6 +1134,7 @@ static int node_rawquery(lua_State *L)
TSLua_cursor *ud = lua_newuserdata(L, sizeof(*ud)); // [udata]
ud->cursor = cursor;
ud->predicated_match = -1;
+ ud->max_match_id = -1;
lua_getfield(L, LUA_REGISTRYINDEX, TS_META_QUERYCURSOR);
lua_setmetatable(L, -2); // [udata]
diff --git a/src/nvim/marktree.c b/src/nvim/marktree.c
index ebe4478bc8..e62f91e698 100644
--- a/src/nvim/marktree.c
+++ b/src/nvim/marktree.c
@@ -837,8 +837,8 @@ bool marktree_splice(MarkTree *b, int start_line, int start_col, int old_extent_
int old_extent_col, int new_extent_line, int new_extent_col)
{
mtpos_t start = { start_line, start_col };
- mtpos_t old_extent = { (int)old_extent_line, old_extent_col };
- mtpos_t new_extent = { (int)new_extent_line, new_extent_col };
+ mtpos_t old_extent = { old_extent_line, old_extent_col };
+ mtpos_t new_extent = { new_extent_line, new_extent_col };
bool may_delete = (old_extent.row != 0 || old_extent.col != 0);
bool same_line = old_extent.row == 0 && new_extent.row == 0;
diff --git a/src/nvim/menu.c b/src/nvim/menu.c
index de8503f9d0..85e062009a 100644
--- a/src/nvim/menu.c
+++ b/src/nvim/menu.c
@@ -857,7 +857,7 @@ static void show_menus_recursive(vimmenu_T *menu, int modes, int depth)
MSG_PUTS(" ");
}
if (menu->priority) {
- msg_outnum((long)menu->priority);
+ msg_outnum(menu->priority);
MSG_PUTS(" ");
}
// Same highlighting as for directories!?
diff --git a/src/nvim/message.c b/src/nvim/message.c
index edde51e770..cc4319b8da 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -2363,7 +2363,7 @@ void msg_reset_scroll(void)
// non-displayed part of msg_grid is considered invalid.
for (int i = 0; i < MIN(msg_scrollsize(), msg_grid.Rows); i++) {
grid_clear_line(&msg_grid, msg_grid.line_offset[i],
- (int)msg_grid.Columns, false);
+ msg_grid.Columns, false);
}
}
} else {
diff --git a/src/nvim/mouse.c b/src/nvim/mouse.c
index cd9f5fc83e..f02c000e82 100644
--- a/src/nvim/mouse.c
+++ b/src/nvim/mouse.c
@@ -682,8 +682,8 @@ static int mouse_adjust_click(win_T *wp, int row, int col)
vcol = offset;
-#define incr() nudge++; ptr_end += utfc_ptr2len(ptr_end)
-#define decr() nudge--; ptr_end -= utfc_ptr2len(ptr_end)
+#define INCR() nudge++; ptr_end += utfc_ptr2len(ptr_end)
+#define DECR() nudge--; ptr_end -= utfc_ptr2len(ptr_end)
while (ptr < ptr_end && *ptr != NUL) {
cwidth = win_chartabsize(curwin, ptr, vcol);
@@ -692,7 +692,7 @@ static int mouse_adjust_click(win_T *wp, int row, int col)
// A tab will "absorb" any previous adjustments.
cwidth = MIN(cwidth, nudge);
while (cwidth > 0) {
- decr();
+ DECR();
cwidth--;
}
}
@@ -700,20 +700,20 @@ static int mouse_adjust_click(win_T *wp, int row, int col)
matchid = syn_get_concealed_id(wp, lnum, (colnr_T)(ptr - line));
if (matchid != 0) {
if (wp->w_p_cole == 3) {
- incr();
+ INCR();
} else {
if (!(row > 0 && ptr == ptr_row_offset)
&& (wp->w_p_cole == 1 || (wp->w_p_cole == 2
&& (wp->w_p_lcs_chars.conceal != NUL
|| syn_get_sub_char() != NUL)))) {
// At least one placeholder character will be displayed.
- decr();
+ DECR();
}
prev_matchid = matchid;
while (prev_matchid == matchid && *ptr != NUL) {
- incr();
+ INCR();
ptr += utfc_ptr2len(ptr);
matchid = syn_get_concealed_id(wp, lnum, (colnr_T)(ptr - line));
}
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 5646a62cd4..b60699b66f 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -3899,7 +3899,7 @@ static char *set_bool_option(const int opt_idx, char_u *const varp, const int va
// when 'buflisted' changes, trigger autocommands
apply_autocmds(curbuf->b_p_bl ? EVENT_BUFADD : EVENT_BUFDELETE,
NULL, NULL, true, curbuf);
- } else if ((int *)varp == (int *)&curbuf->b_p_swf) {
+ } else if ((int *)varp == &curbuf->b_p_swf) {
// when 'swf' is set, create swapfile, when reset remove swapfile
if (curbuf->b_p_swf && p_uc) {
ml_open_file(curbuf); // create the swap file
diff --git a/src/nvim/shada.c b/src/nvim/shada.c
index 2d65db8437..2610df666b 100644
--- a/src/nvim/shada.c
+++ b/src/nvim/shada.c
@@ -65,11 +65,6 @@ KHASH_SET_INIT_INT64(bufset)
KHASH_MAP_INIT_STR(fnamebufs, buf_T *)
KHASH_SET_INIT_STR(strset)
-#define find_shada_parameter(...) \
- ((const char *)find_shada_parameter(__VA_ARGS__))
-#define path_try_shorten_fname(b) \
- ((char *)path_try_shorten_fname((char_u *)b))
-
#define SEARCH_KEY_MAGIC "sm"
#define SEARCH_KEY_SMARTCASE "sc"
#define SEARCH_KEY_HAS_LINE_OFFSET "sl"
@@ -609,20 +604,6 @@ static inline void hmll_insert(HMLList *const hmll, HMLListEntry *hmll_entry, co
}
}
-/// Iterate over HMLList in backward direction
-///
-/// @param hmll Pointer to the list.
-/// @param cur_entry Name of the variable to iterate over, must be already
-/// defined.
-/// @param code Code to execute on each iteration.
-///
-/// @return `for` cycle header (use `HMLL_FORALL(hmll, cur_entry) {body}`).
-#define HMLL_ITER_BACK(hmll, cur_entry, code) \
- for (cur_entry = (hmll)->last; cur_entry != NULL; \
- cur_entry = cur_entry->prev) { \
- code \
- }
-
/// Free linked list
///
/// @param[in] hmll List to free.
@@ -966,11 +947,12 @@ static void hms_insert(HistoryMergerState *const hms_p, const ShadaEntry entry,
}
}
HMLListEntry *insert_after;
- HMLL_ITER_BACK(hmll, insert_after, {
+ // Iterate over HMLList in backward direction
+ for (insert_after = hmll->last; insert_after != NULL; insert_after = insert_after->prev) {
if (insert_after->data.timestamp <= entry.timestamp) {
break;
}
- })
+ }
hmll_insert(hmll, insert_after, entry, can_free_entry);
}
@@ -1346,7 +1328,8 @@ static void shada_read(ShaDaReadDef *const sd_reader, const int flags)
}
case kSDItemBufferList:
for (size_t i = 0; i < cur_entry.data.buffer_list.size; i++) {
- char *const sfname = path_try_shorten_fname(cur_entry.data.buffer_list.buffers[i].fname);
+ char *const sfname =
+ (char *)path_try_shorten_fname((char_u *)cur_entry.data.buffer_list.buffers[i].fname);
buf_T *const buf =
buflist_new((char_u *)cur_entry.data.buffer_list.buffers[i].fname, (char_u *)sfname, 0,
BLN_LISTED);
@@ -1488,7 +1471,7 @@ static char *shada_filename(const char *file)
if (p_shadafile != NULL && *p_shadafile != NUL) {
file = p_shadafile;
} else {
- if ((file = find_shada_parameter('n')) == NULL || *file == NUL) {
+ if ((file = (char *)find_shada_parameter('n')) == NULL || *file == NUL) {
file = shada_get_default_file();
}
// XXX It used to be one level lower, so that whatever is in
@@ -1508,14 +1491,6 @@ static char *shada_filename(const char *file)
msgpack_pack_str(spacker, sizeof(s) - 1); \
msgpack_pack_str_body(spacker, s, sizeof(s) - 1); \
} while (0)
-#define PACK_STRING(s) \
- do { \
- const String s_ = (s); \
- msgpack_pack_str(spacker, s_.size); \
- if (s_.size) { \
- msgpack_pack_str_body(spacker, s_.data, s_.size); \
- } \
- } while (0)
#define PACK_BIN(s) \
do { \
const String s_ = (s); \
@@ -1796,7 +1771,11 @@ static ShaDaWriteResult shada_pack_entry(msgpack_packer *const packer, ShadaEntr
case kSDItemHeader:
msgpack_pack_map(spacker, entry.data.header.size);
for (size_t i = 0; i < entry.data.header.size; i++) {
- PACK_STRING(entry.data.header.items[i].key);
+ const String s = entry.data.header.items[i].key;
+ msgpack_pack_str(spacker, s.size);
+ if (s.size) {
+ msgpack_pack_str_body(spacker, s.data, s.size);
+ }
const Object obj = entry.data.header.items[i].value;
switch (obj.type) {
case kObjectTypeString:
@@ -1842,7 +1821,6 @@ shada_pack_entry_error:
msgpack_sbuffer_destroy(&sbuf);
return ret;
}
-#undef PACK_STRING
/// Write single ShaDa entry and free it afterwards
///
@@ -2423,7 +2401,7 @@ static inline void shada_initialize_registers(WriteMergerState *const wms, int m
.data = {
.reg = {
.contents = (char **)reg.y_array,
- .contents_size = (size_t)reg.y_size,
+ .contents_size = reg.y_size,
.type = reg.y_type,
.width = (size_t)(reg.y_type == kMTBlockWise ? reg.y_width : 0),
.additional_data = reg.additional_data,
@@ -2943,7 +2921,6 @@ shada_write_exit:
return ret;
}
-#undef IGNORE_BUF
#undef PACK_STATIC_STR
/// Write ShaDa file to a given location
@@ -3410,8 +3387,7 @@ static ShaDaReadResult msgpack_read_uint64(ShaDaReadDef *const sd_reader, const
sizeof(*un.data.via.map.ptr)); \
ad_ga.ga_len++; \
}
-#define CONVERTED(str, len) (xmemdupz((str), (len)))
-#define BIN_CONVERTED(b) CONVERTED(b.ptr, b.size)
+#define BIN_CONVERTED(b) (xmemdupz((b.ptr), (b.size)))
#define SET_ADDITIONAL_DATA(tgt, name) \
do { \
if (ad_ga.ga_len) { \
@@ -3968,7 +3944,6 @@ shada_read_next_item_error:
goto shada_read_next_item_end;
}
#undef BIN_CONVERTED
-#undef CONVERTED
#undef CHECK_KEY
#undef BOOLEAN_KEY
#undef CONVERTED_STRING_KEY
diff --git a/src/nvim/spell.c b/src/nvim/spell.c
index 450ec891ad..9ed421c8a0 100644
--- a/src/nvim/spell.c
+++ b/src/nvim/spell.c
@@ -2924,8 +2924,8 @@ void spell_suggest(int count)
// Get the list of suggestions. Limit to 'lines' - 2 or the number in
// 'spellsuggest', whatever is smaller.
- if (sps_limit > (int)Rows - 2) {
- limit = (int)Rows - 2;
+ if (sps_limit > Rows - 2) {
+ limit = Rows - 2;
} else {
limit = sps_limit;
}
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c
index 6f19a9209e..fb025265f2 100644
--- a/src/nvim/terminal.c
+++ b/src/nvim/terminal.c
@@ -358,11 +358,21 @@ void terminal_enter(void)
// Disable these options in terminal-mode. They are nonsense because cursor is
// placed at end of buffer to "follow" output. #11072
win_T *save_curwin = curwin;
- int save_w_p_cul = curwin->w_p_cul;
+ bool save_w_p_cul = curwin->w_p_cul;
+ char_u *save_w_p_culopt = NULL;
+ char_u save_w_p_culopt_flags = curwin->w_p_culopt_flags;
int save_w_p_cuc = curwin->w_p_cuc;
long save_w_p_so = curwin->w_p_so;
long save_w_p_siso = curwin->w_p_siso;
- curwin->w_p_cul = false;
+ if (curwin->w_p_cul && curwin->w_p_culopt_flags & CULOPT_NBR) {
+ if (strcmp((char *)curwin->w_p_culopt, "number")) {
+ save_w_p_culopt = curwin->w_p_culopt;
+ curwin->w_p_culopt = (char_u *)xstrdup("number");
+ }
+ curwin->w_p_culopt_flags = CULOPT_NBR;
+ } else {
+ curwin->w_p_cul = false;
+ }
curwin->w_p_cuc = false;
curwin->w_p_so = 0;
curwin->w_p_siso = 0;
@@ -386,9 +396,16 @@ void terminal_enter(void)
if (save_curwin == curwin) { // save_curwin may be invalid (window closed)!
curwin->w_p_cul = save_w_p_cul;
+ if (save_w_p_culopt) {
+ xfree(curwin->w_p_culopt);
+ curwin->w_p_culopt = save_w_p_culopt;
+ }
+ curwin->w_p_culopt_flags = save_w_p_culopt_flags;
curwin->w_p_cuc = save_w_p_cuc;
curwin->w_p_so = save_w_p_so;
curwin->w_p_siso = save_w_p_siso;
+ } else if (save_w_p_culopt) {
+ xfree(save_w_p_culopt);
}
// draw the unfocused cursor
@@ -1224,7 +1241,7 @@ static bool send_mouse_event(Terminal *term, int c)
mouse_action(term, button, row, col - offset, drag, 0);
size_t len = vterm_output_read(term->vt, term->textbuf,
sizeof(term->textbuf));
- terminal_send(term, term->textbuf, (size_t)len);
+ terminal_send(term, term->textbuf, len);
return false;
}
diff --git a/src/nvim/undo.c b/src/nvim/undo.c
index d5857ff8b9..500845ec72 100644
--- a/src/nvim/undo.c
+++ b/src/nvim/undo.c
@@ -3085,6 +3085,8 @@ void u_undoline(void)
oldp = u_save_line(curbuf->b_u_line_lnum);
ml_replace(curbuf->b_u_line_lnum, curbuf->b_u_line_ptr, true);
changed_bytes(curbuf->b_u_line_lnum, 0);
+ extmark_splice_cols(curbuf, (int)curbuf->b_u_line_lnum-1, 0, (colnr_T)STRLEN(oldp),
+ (colnr_T)STRLEN(curbuf->b_u_line_ptr), kExtmarkUndo);
xfree(curbuf->b_u_line_ptr);
curbuf->b_u_line_ptr = oldp;