From 94c7358d6ddf832234c0dfcd62c5762ecac91659 Mon Sep 17 00:00:00 2001 From: git-bruh Date: Sun, 7 Apr 2024 18:33:52 +0530 Subject: [PATCH 1/6] plugins/filetype: fix javascript/typescript detection --- lua/plugins/filetype.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/plugins/filetype.lua b/lua/plugins/filetype.lua index defdc9b3e..e8a594513 100644 --- a/lua/plugins/filetype.lua +++ b/lua/plugins/filetype.lua @@ -222,7 +222,7 @@ vis.ftdetect.filetypes = { ext = { "%.bsh$", "%.java$" }, }, javascript = { - ext = { "%.cjs$", "%.js$", "%.jsfl$", "%.mjs$", "%.jsx$", "%.ts$", "%.tsx$" }, + ext = { "%.cjs$", "%.js$", "%.jsfl$", "%.mjs$", "%.jsx$" }, }, jq = { ext = { "%.jq$" }, @@ -456,7 +456,7 @@ vis.ftdetect.filetypes = { ext = { "%.toml$" }, }, typescript = { - ext = { "%.ts$" }, + ext = { "%.ts$", "%.tsx$" }, }, typst = { ext = { "%.typ$", "%.typst$" }, From f01cf2c3cd30536344534fa24c8a3b3e63f7f982 Mon Sep 17 00:00:00 2001 From: Rudy Dellomas III Date: Fri, 19 Apr 2024 09:57:25 +1000 Subject: [PATCH 2/6] Add a Lua constant for UI_STYLE_LEXER_MAX Currently, there's no mechanism for defining user styles without risk of collision with default lexer and theme settings. Very few lexers use more than 10, let alone all 64 of the allowed styles, so UI_STYLE_LEXER_MAX - (no. of user defined styles) allows for a reasonably large number of user-defined styles before collision becomes a problem. --- vis-lua.c | 1 + 1 file changed, 1 insertion(+) diff --git a/vis-lua.c b/vis-lua.c index 98a524993..b103b1267 100644 --- a/vis-lua.c +++ b/vis-lua.c @@ -3276,6 +3276,7 @@ void vis_lua_init(Vis *vis) { enum UiStyle id; const char *name; } styles[] = { + { UI_STYLE_LEXER_MAX, "STYLE_LEXER_MAX" }, { UI_STYLE_DEFAULT, "STYLE_DEFAULT" }, { UI_STYLE_CURSOR, "STYLE_CURSOR" }, { UI_STYLE_CURSOR_PRIMARY, "STYLE_CURSOR_PRIMARY" }, From 65045941277df247e089789e50aa29862d4563bc Mon Sep 17 00:00:00 2001 From: Rudy Dellomas III Date: Fri, 19 Apr 2024 21:54:42 +1000 Subject: [PATCH 3/6] Disable reverse with "notreverse" in style definitions --- ui-terminal.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ui-terminal.c b/ui-terminal.c index cf343783a..dd04f7613 100644 --- a/ui-terminal.c +++ b/ui-terminal.c @@ -167,6 +167,8 @@ static bool ui_style_define(UiWin *w, int id, const char *style) { for (*value++ = '\0'; *value == ' '; value++); if (!strcasecmp(option, "reverse")) { cell_style.attr |= CELL_ATTR_REVERSE; + } else if (!strcasecmp(option, "notreverse")) { + cell_style.attr &= CELL_ATTR_REVERSE; } else if (!strcasecmp(option, "bold")) { cell_style.attr |= CELL_ATTR_BOLD; } else if (!strcasecmp(option, "notbold")) { From 025ab0f5789621beb470a1eb0a3ce9a437682dbf Mon Sep 17 00:00:00 2001 From: Randy Palamar Date: Sun, 21 Apr 2024 08:25:31 -0600 Subject: [PATCH 4/6] ci: fix macOS runner Apparently Github changed the permissions on /usr/local in the default image so now we need to use `sudo` for luarocks to be able to install packages. While I'm here: update the checkout dependency and use macOS-latest image instead of multiple old images. --- .github/workflows/macos.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 6fc017a23..06d484bdf 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -4,25 +4,22 @@ on: [push, pull_request] jobs: build: + runs-on: macos-latest strategy: matrix: - os: - - macos-12 - - macos-11 # latest config: - "" - --disable-curses - --disable-lua - --disable-tre - --disable-help - runs-on: ${{ matrix.os }} env: CFLAGS_EXTRA: --coverage LDFLAGS_EXTRA: --coverage steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Dependency Homebrew run: | @@ -36,8 +33,8 @@ jobs: - name: Dependency LuaRocks run: | - luarocks install lpeg - luarocks install busted + sudo luarocks install lpeg + sudo luarocks install busted - name: Build run: | From ad03feb0857c39d74a476432bcc5b0d4207f175d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= Date: Sun, 31 Mar 2024 23:14:34 +0200 Subject: [PATCH 5/6] vis-cmd: silence gcc warning & remove strlen call --- vis-cmds.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vis-cmds.c b/vis-cmds.c index 05b18a5bb..2b6428ab6 100644 --- a/vis-cmds.c +++ b/vis-cmds.c @@ -641,7 +641,8 @@ static bool cmd_earlier_later(Vis *vis, Win *win, Command *cmd, const char *argv } static int space_replace(char *dest, const char *src, size_t dlen) { - int i, invisiblebytes = 0, size = strlen("␣"); + int invisiblebytes = 0; + size_t i, size = LENGTH("␣") - 1; for (i = 0; *src && i < dlen; src++) { if (*src == ' ' && i < dlen - size - 1) { memcpy(&dest[i], "␣", size); From 1fc175627f3afe938be0b5daa6a864b281725fec Mon Sep 17 00:00:00 2001 From: Rudy Dellomas III Date: Tue, 23 Apr 2024 15:33:13 +1000 Subject: [PATCH 6/6] lua: Report viewport lines and bytes in one table This will break all plugins which currently use Win.viewport. --- lua/vis-std.lua | 2 +- vis-lua.c | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/lua/vis-std.lua b/lua/vis-std.lua index 5dd13eb28..1fe93a9d9 100644 --- a/lua/vis-std.lua +++ b/lua/vis-std.lua @@ -54,7 +54,7 @@ vis.events.subscribe(vis.events.WIN_HIGHLIGHT, function(win) if not lexer then return end -- TODO: improve heuristic for initial style - local viewport = win.viewport + local viewport = win.viewport.bytes if not viewport then return end local horizon_max = win.horizon or 32768 local horizon = viewport.start < horizon_max and viewport.start or horizon_max diff --git a/vis-lua.c b/vis-lua.c index b103b1267..a3029fab4 100644 --- a/vis-lua.c +++ b/vis-lua.c @@ -1831,7 +1831,10 @@ static const struct luaL_Reg registers_funcs[] = { /*** * Viewport currently being displayed. - * @tfield Range viewport + * Changing these values will not move the viewport. + * @table viewport + * @tfield Range bytes + * @tfield Range lines */ /*** * The window width. @@ -1867,8 +1870,18 @@ static int window_index(lua_State *L) { const char *key = lua_tostring(L, 2); if (strcmp(key, "viewport") == 0) { - Filerange r = view_viewport_get(win->view); - pushrange(L, &r); + Filerange b = view_viewport_get(win->view); + Filerange l; + l.start = view_lines_first(win->view)->lineno; + l.end = view_lines_last(win->view)->lineno; + + lua_createtable(L, 0, 2); + lua_pushstring(L, "bytes"); + pushrange(L, &b); + lua_settable(L, -3); + lua_pushstring(L, "lines"); + pushrange(L, &l); + lua_settable(L, -3); return 1; }