Skip to content

Commit

Permalink
replace STYLE_CURSOR_PRIMARY with STYLE_CURSOR_MATCHING
Browse files Browse the repository at this point in the history
Related martanne#952.
  • Loading branch information
gotroyb127 authored and rnpnr committed Oct 17, 2023
1 parent bebc691 commit 1263cd3
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lua/themes/dark-16.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ lexers.STYLE_IDENTIFIER = 'fore:white'
lexers.STYLE_LINENUMBER = 'fore:white'
lexers.STYLE_LINENUMBER_CURSOR = lexers.STYLE_LINENUMBER
lexers.STYLE_CURSOR = 'reverse'
lexers.STYLE_CURSOR_PRIMARY = lexers.STYLE_CURSOR..',fore:yellow'
lexers.STYLE_CURSOR_MATCHING = lexers.STYLE_CURSOR..',fore:yellow'
lexers.STYLE_CURSOR_LINE = 'underlined'
lexers.STYLE_COLOR_COLUMN = 'back:red'
lexers.STYLE_SELECTION = 'back:white'
Expand Down
2 changes: 1 addition & 1 deletion lua/themes/light-16.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ lexers.STYLE_IDENTIFIER = 'fore:black'
lexers.STYLE_LINENUMBER = 'fore:black'
lexers.STYLE_LINENUMBER_CURSOR = lexers.STYLE_LINENUMBER
lexers.STYLE_CURSOR = 'reverse'
lexers.STYLE_CURSOR_PRIMARY = lexers.STYLE_CURSOR..',fore:yellow'
lexers.STYLE_CURSOR_MATCHING = lexers.STYLE_CURSOR..',fore:yellow'
lexers.STYLE_CURSOR_LINE = 'underlined'
lexers.STYLE_COLOR_COLUMN = 'back:red'
lexers.STYLE_SELECTION = 'back:black'
Expand Down
2 changes: 1 addition & 1 deletion lua/themes/solarized.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ lexers.STYLE_IDENTIFIER = fg
lexers.STYLE_LINENUMBER = 'fore:'..colors.base00..',back:'..colors.base02
lexers.STYLE_LINENUMBER_CURSOR = 'back:'..colors.base00..',fore:'..colors.base02
lexers.STYLE_CURSOR = 'fore:'..colors.base03..',back:'..colors.base0
lexers.STYLE_CURSOR_PRIMARY = lexers.STYLE_CURSOR..',back:yellow'
lexers.STYLE_CURSOR_MATCHING = lexers.STYLE_CURSOR..',back:yellow'
lexers.STYLE_CURSOR_LINE = 'back:'..colors.base02
lexers.STYLE_COLOR_COLUMN = 'back:'..colors.base02
-- lexers.STYLE_SELECTION = 'back:'..colors.base02
Expand Down
2 changes: 1 addition & 1 deletion lua/themes/zenburn.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ lexers.STYLE_IDENTIFIER = ''
lexers.STYLE_LINENUMBER = 'fore:#585858'
lexers.STYLE_LINENUMBER_CURSOR = 'fore:#666666'
lexers.STYLE_CURSOR = 'back:#585858'
lexers.STYLE_CURSOR_PRIMARY = 'fore:#1c1c1c,back:#87afaf,bold'
lexers.STYLE_CURSOR_MATCHING = 'fore:#1c1c1c,back:#87afaf,bold'
lexers.STYLE_CURSOR_LINE = 'back:#444444'
lexers.STYLE_COLOR_COLUMN = 'back:#444444'
lexers.STYLE_SELECTION = 'back:#5f875f'
Expand Down
2 changes: 1 addition & 1 deletion lua/vis.lua
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ vis.types.window.set_syntax = function(win, syntax)

win:style_define(win.STYLE_DEFAULT, lexers.STYLE_DEFAULT or '')
win:style_define(win.STYLE_CURSOR, lexers.STYLE_CURSOR or '')
win:style_define(win.STYLE_CURSOR_PRIMARY, lexers.STYLE_CURSOR_PRIMARY or '')
win:style_define(win.STYLE_CURSOR_MATCHING, lexers.STYLE_CURSOR_MATCHING or '')
win:style_define(win.STYLE_CURSOR_LINE, lexers.STYLE_CURSOR_LINE or '')
win:style_define(win.STYLE_SELECTION, lexers.STYLE_SELECTION or '')
win:style_define(win.STYLE_LINENUMBER, lexers.STYLE_LINENUMBER or '')
Expand Down
2 changes: 1 addition & 1 deletion ui-terminal.c
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ static UiWin *ui_window_new(Ui *ui, Win *w, enum UiOption options) {
}

styles[UI_STYLE_CURSOR].attr |= CELL_ATTR_REVERSE;
styles[UI_STYLE_CURSOR_PRIMARY].attr |= CELL_ATTR_REVERSE|CELL_ATTR_BLINK;
styles[UI_STYLE_CURSOR_MATCHING].attr |= CELL_ATTR_REVERSE;
styles[UI_STYLE_SELECTION].attr |= CELL_ATTR_REVERSE;
styles[UI_STYLE_COLOR_COLUMN].attr |= CELL_ATTR_REVERSE;
styles[UI_STYLE_STATUS].attr |= CELL_ATTR_REVERSE;
Expand Down
2 changes: 1 addition & 1 deletion ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ enum UiStyle {
UI_STYLE_LEXER_MAX = 64,
UI_STYLE_DEFAULT,
UI_STYLE_CURSOR,
UI_STYLE_CURSOR_PRIMARY,
UI_STYLE_CURSOR_MATCHING,
UI_STYLE_CURSOR_LINE,
UI_STYLE_SELECTION,
UI_STYLE_LINENUMBER,
Expand Down
2 changes: 1 addition & 1 deletion vis-lua.c
Original file line number Diff line number Diff line change
Expand Up @@ -3266,7 +3266,7 @@ void vis_lua_init(Vis *vis) {
} styles[] = {
{ UI_STYLE_DEFAULT, "STYLE_DEFAULT" },
{ UI_STYLE_CURSOR, "STYLE_CURSOR" },
{ UI_STYLE_CURSOR_PRIMARY, "STYLE_CURSOR_PRIMARY" },
{ UI_STYLE_CURSOR_MATCHING, "STYLE_CURSOR_MATCHING" },
{ UI_STYLE_CURSOR_LINE, "STYLE_CURSOR_LINE" },
{ UI_STYLE_SELECTION, "STYLE_SELECTION" },
{ UI_STYLE_LINENUMBER, "STYLE_LINENUMBER" },
Expand Down
7 changes: 3 additions & 4 deletions vis.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,26 +423,25 @@ static void window_draw_cursor(Win *win, Selection *cur, CellStyle *style, CellS
if (!line || col == -1)
return;
line->cells[col].style = *style;
window_draw_cursor_matching(win, cur, sel_style);
return;
}

static void window_draw_selections(Win *win) {
View *view = win->view;
Filerange viewport = view_viewport_get(view);
Selection *sel = view_selections_primary_get(view);
CellStyle style_cursor = win->ui->style_get(win->ui, UI_STYLE_CURSOR);
CellStyle style_cursor_primary = win->ui->style_get(win->ui, UI_STYLE_CURSOR_PRIMARY);
CellStyle style_cursor_matching = win->ui->style_get(win->ui, UI_STYLE_CURSOR_MATCHING);
CellStyle style_selection = win->ui->style_get(win->ui, UI_STYLE_SELECTION);
for (Selection *s = view_selections_prev(sel); s; s = view_selections_prev(s)) {
window_draw_selection(win->view, s, &style_selection);
size_t pos = view_cursors_pos(s);
if (pos < viewport.start)
break;
window_draw_cursor(win, s, &style_cursor, &style_selection);
window_draw_cursor_matching(win, s, &style_cursor_matching);
}
window_draw_selection(win->view, sel, &style_selection);
window_draw_cursor_matching(win, sel, &style_cursor_primary);
window_draw_cursor_matching(win, sel, &style_cursor_matching);
for (Selection *s = view_selections_next(sel); s; s = view_selections_next(s)) {
window_draw_selection(win->view, s, &style_selection);
size_t pos = view_cursors_pos(s);
Expand Down

0 comments on commit 1263cd3

Please sign in to comment.