mirror of
https://github.com/neovim/neovim.git
synced 2025-09-14 23:38:17 +00:00
cursor_shape: use attribute ids instead of syntax ids
As attribute ids is the convention in the UI protocol Also remove non-threadsafe calls in tui.c to syntax module.
This commit is contained in:
@@ -64,6 +64,9 @@ Array mode_style_array(void)
|
||||
PUT(dic, "blinkoff", INTEGER_OBJ(cur->blinkoff));
|
||||
PUT(dic, "hl_id", INTEGER_OBJ(cur->id));
|
||||
PUT(dic, "id_lm", INTEGER_OBJ(cur->id_lm));
|
||||
PUT(dic, "attr_id", INTEGER_OBJ(cur->id ? syn_id2attr(cur->id) : 0));
|
||||
PUT(dic, "attr_id_lm", INTEGER_OBJ(cur->id_lm ? syn_id2attr(cur->id_lm)
|
||||
: 0));
|
||||
}
|
||||
PUT(dic, "name", STRING_OBJ(cstr_to_string(cur->full_name)));
|
||||
PUT(dic, "short_name", STRING_OBJ(cstr_to_string(cur->name)));
|
||||
@@ -258,15 +261,30 @@ char_u *parse_shape_opt(int what)
|
||||
/// @return -1 in case of failure, else the matching SHAPE_ID* integer
|
||||
int cursor_mode_str2int(const char *mode)
|
||||
{
|
||||
for (int current_mode = 0; current_mode < SHAPE_IDX_COUNT; current_mode++) {
|
||||
if (strcmp(shape_table[current_mode].full_name, mode) == 0) {
|
||||
return current_mode;
|
||||
for (int mode_idx = 0; mode_idx < SHAPE_IDX_COUNT; mode_idx++) {
|
||||
if (strcmp(shape_table[mode_idx].full_name, mode) == 0) {
|
||||
return mode_idx;
|
||||
}
|
||||
}
|
||||
WLOG("Unknown mode %s", mode);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/// Check if a syntax id is used as a cursor style.
|
||||
bool cursor_mode_uses_syn_id(int syn_id)
|
||||
{
|
||||
if (*p_guicursor == NUL) {
|
||||
return false;
|
||||
}
|
||||
for (int mode_idx = 0; mode_idx < SHAPE_IDX_COUNT; mode_idx++) {
|
||||
if (shape_table[mode_idx].id == syn_id
|
||||
|| shape_table[mode_idx].id_lm == syn_id) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/// Return the index into shape_table[] for the current mode.
|
||||
int cursor_get_mode_idx(void)
|
||||
|
Reference in New Issue
Block a user