refactor: cleanup

This commit is contained in:
vanaigr 2024-12-18 12:10:50 -06:00
parent b037af3f2c
commit 35cea0b28d
2 changed files with 16 additions and 22 deletions

View File

@ -1483,16 +1483,13 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s
}
// Call it here since we need to invalidate the line pointer anyway.
bool added_decor = false;
decor_providers_invoke_line(wp, lnum - 1, &added_decor);
has_decor |= added_decor;
decor_providers_invoke_line(wp, lnum - 1, &has_decor);
decor_provider_end_col = invoke_range_next(wp, lnum, col, rem_vcols + 1, &has_decor);
line = ml_get_buf(wp->w_buffer, lnum);
ptr = line + col;
}
if (has_decor) {
extra_check = true;
}
@ -3039,18 +3036,16 @@ static int invoke_range_next(win_T *wp, int lnum, colnr_T begin_col, colnr_T col
int const line_len = ml_get_buf_len(wp->w_buffer, lnum);
col_off = MAX(col_off, 1);
bool added_decor = false;
colnr_T new_col;
if (col_off <= line_len - begin_col) {
int end_col = begin_col + col_off;
end_col += mb_off_next(line, line + end_col);
decor_providers_invoke_range(wp, lnum - 1, begin_col, lnum - 1, end_col, &added_decor);
decor_providers_invoke_range(wp, lnum - 1, begin_col, lnum - 1, end_col, has_decor);
new_col = end_col;
} else {
decor_providers_invoke_range(wp, lnum - 1, begin_col, lnum, 0, &added_decor);
decor_providers_invoke_range(wp, lnum - 1, begin_col, lnum, 0, has_decor);
new_col = INT_MAX;
}
*has_decor |= added_decor;
return new_col;
}

View File

@ -1291,23 +1291,22 @@ static inline bool set_uint32(lua_State *L, int idx, char const *name, uint32_t
FUNC_ATTR_ALWAYS_INLINE FUNC_ATTR_NONNULL_ALL
{
lua_getfield(L, idx, name);
if (!lua_isnil(L, -1)) {
int64_t value = lua_tointeger(L, -1);
if (value < 0U) {
*res = 0U;
return true;
} else if (value > UINT32_MAX) {
*res = UINT32_MAX;
return true;
} else {
*res = (uint32_t)value;
return true;
}
if (lua_isnil(L, -1)) {
lua_pop(L, 1);
return false;
}
int64_t value = lua_tointeger(L, -1);
lua_pop(L, 1);
return false;
if (value < 0U) {
*res = 0U;
} else if (value > UINT32_MAX) {
*res = UINT32_MAX;
} else {
*res = (uint32_t)value;
}
return true;
}
int tslua_push_querycursor(lua_State *L)