Skip to content

Commit

Permalink
Merge branch 'theme-tweaks-2' of https://github.com/p-e-w/vis
Browse files Browse the repository at this point in the history
Conflicts:
	view.c
  • Loading branch information
martanne committed Jun 27, 2017
2 parents 56f1989 + 03ceb79 commit dfe9937
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 17 deletions.
1 change: 1 addition & 0 deletions lua/themes/dark-16.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ lexers.STYLE_EMBEDDED = 'back:blue,bold'
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_LINE = 'underlined'
Expand Down
1 change: 1 addition & 0 deletions lua/themes/light-16.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ lexers.STYLE_EMBEDDED = 'back:blue,bold'
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_LINE = 'underlined'
Expand Down
3 changes: 2 additions & 1 deletion lua/themes/solarized.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,12 @@ lexers.STYLE_PREPROCESSOR = 'fore:'..colors.orange
lexers.STYLE_TAG = 'fore:'..colors.red
lexers.STYLE_TYPE = 'fore:'..colors.yellow
lexers.STYLE_VARIABLE = 'fore:'..colors.blue
lexers.STYLE_WHITESPACE = ''
lexers.STYLE_WHITESPACE = 'fore:'..colors.base01
lexers.STYLE_EMBEDDED = 'back:blue'
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_LINE = 'back:'..colors.base02
Expand Down
1 change: 1 addition & 0 deletions lua/vis.lua
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ vis.types.window.set_syntax = function(win, syntax)
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 '')
win:style_define(win.STYLE_LINENUMBER_CURSOR, lexers.STYLE_LINENUMBER_CURSOR or '')
win:style_define(win.STYLE_COLOR_COLUMN, lexers.STYLE_COLOR_COLUMN or '')
win:style_define(win.STYLE_STATUS, lexers.STYLE_STATUS or '')
win:style_define(win.STYLE_STATUS_FOCUSED, lexers.STYLE_STATUS_FOCUSED or '')
Expand Down
3 changes: 2 additions & 1 deletion ui-terminal.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,8 @@ static void ui_window_draw(UiWin *w) {
}
snprintf(buf, sizeof buf, "%*zu ", sidebar_width-1, number);
}
ui_draw_string(ui, x, y, buf, win, UI_STYLE_LINENUMBER);
ui_draw_string(ui, x, y, buf, win,
(l->lineno == cursor_lineno) ? UI_STYLE_LINENUMBER_CURSOR : UI_STYLE_LINENUMBER);
prev_lineno = l->lineno;
}
debug("draw-window: [%d][%d] ... cells[%d][%d]\n", y, x+sidebar_width, y, view_width);
Expand Down
1 change: 1 addition & 0 deletions ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ enum UiStyle {
UI_STYLE_CURSOR_LINE,
UI_STYLE_SELECTION,
UI_STYLE_LINENUMBER,
UI_STYLE_LINENUMBER_CURSOR,
UI_STYLE_COLOR_COLUMN,
UI_STYLE_STATUS,
UI_STYLE_STATUS_FOCUSED,
Expand Down
2 changes: 1 addition & 1 deletion view.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ void view_draw(View *view) {
/* resync position of cursors within visible area */
for (Selection *s = view->selections; s; s = s->next) {
size_t pos = view_cursors_pos(s);
if (!view_coord_get(view, pos, &s->line, &s->row, &s->col) &&
if (!view_coord_get(view, pos, &s->line, &s->row, &s->col) &&
s == view->selection) {
s->line = view->topline;
s->row = 0;
Expand Down
27 changes: 14 additions & 13 deletions vis-lua.c
Original file line number Diff line number Diff line change
Expand Up @@ -1640,7 +1640,7 @@ static int window_unmap(lua_State *L) {
* Define a display style.
* @function style_define
* @tparam int id the style id to use
* @tparam string style the style definition
* @tparam string style the style definition
* @treturn bool whether the style definition has been successfully
* associated with the given id
* @see style
Expand Down Expand Up @@ -2625,18 +2625,19 @@ void vis_lua_init(Vis *vis) {
enum UiStyle id;
const char *name;
} styles[] = {
{ UI_STYLE_DEFAULT, "STYLE_DEFAULT" },
{ UI_STYLE_CURSOR, "STYLE_CURSOR" },
{ UI_STYLE_CURSOR_PRIMARY, "STYLE_CURSOR_PRIMARY" },
{ UI_STYLE_CURSOR_LINE, "STYLE_CURSOR_LINE" },
{ UI_STYLE_SELECTION, "STYLE_SELECTION" },
{ UI_STYLE_LINENUMBER, "STYLE_LINENUMBER" },
{ UI_STYLE_COLOR_COLUMN, "STYLE_COLOR_COLUMN" },
{ UI_STYLE_STATUS, "STYLE_STATUS" },
{ UI_STYLE_STATUS_FOCUSED, "STYLE_STATUS_FOCUSED" },
{ UI_STYLE_SEPARATOR, "STYLE_SEPARATOR" },
{ UI_STYLE_INFO, "STYLE_INFO" },
{ UI_STYLE_EOF, "STYLE_EOF" },
{ UI_STYLE_DEFAULT, "STYLE_DEFAULT" },
{ UI_STYLE_CURSOR, "STYLE_CURSOR" },
{ UI_STYLE_CURSOR_PRIMARY, "STYLE_CURSOR_PRIMARY" },
{ UI_STYLE_CURSOR_LINE, "STYLE_CURSOR_LINE" },
{ UI_STYLE_SELECTION, "STYLE_SELECTION" },
{ UI_STYLE_LINENUMBER, "STYLE_LINENUMBER" },
{ UI_STYLE_LINENUMBER_CURSOR, "STYLE_LINENUMBER_CURSOR" },
{ UI_STYLE_COLOR_COLUMN, "STYLE_COLOR_COLUMN" },
{ UI_STYLE_STATUS, "STYLE_STATUS" },
{ UI_STYLE_STATUS_FOCUSED, "STYLE_STATUS_FOCUSED" },
{ UI_STYLE_SEPARATOR, "STYLE_SEPARATOR" },
{ UI_STYLE_INFO, "STYLE_INFO" },
{ UI_STYLE_EOF, "STYLE_EOF" },
};

for (size_t i = 0; i < LENGTH(styles); i++) {
Expand Down
2 changes: 1 addition & 1 deletion vis.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ static void window_draw_cursorline(Win *win) {
return;
if (view_selections_count(view) > 1)
return;

int width = view_width_get(view);
CellStyle style = win->ui->style_get(win->ui, UI_STYLE_CURSOR_LINE);
Selection *sel = view_selections_primary_get(view);
Expand Down

0 comments on commit dfe9937

Please sign in to comment.