From 27aa1621488b5301d80c02f58a0884843cc4db97 Mon Sep 17 00:00:00 2001 From: cukmekerb Date: Sun, 16 May 2021 10:57:54 -0700 Subject: [PATCH 1/4] add `of` keyword to language_js.lua and improve js string syntax highlighting in --- data/plugins/language_js.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/data/plugins/language_js.lua b/data/plugins/language_js.lua index a258bb3c..671e1bd8 100644 --- a/data/plugins/language_js.lua +++ b/data/plugins/language_js.lua @@ -7,7 +7,7 @@ syntax.add { patterns = { { pattern = "//.-\n", type = "comment" }, { pattern = { "/%*", "%*/" }, type = "comment" }, - { pattern = { '/', '/', '\\' }, type = "string" }, + { pattern = { '/%g', '/', '\\' }, type = "string" }, { pattern = { '"', '"', '\\' }, type = "string" }, { pattern = { "'", "'", '\\' }, type = "string" }, { pattern = { "`", "`", '\\' }, type = "string" }, @@ -41,6 +41,7 @@ syntax.add { ["if"] = "keyword", ["import"] = "keyword", ["in"] = "keyword", + ["of"] = "keyword", ["instanceof"] = "keyword", ["let"] = "keyword", ["new"] = "keyword", From e9e1214e5959303cd87aa61e127fac6ebd1bc270 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Thu, 17 Jun 2021 20:58:22 -0400 Subject: [PATCH 2/4] [plugin/scale] fixed wrong increase and decrease If the user manually set the desired scale by calling scale.set(1.60) the scale_level was not set accordingly which meant that later doing a Scale:Increase/Decrease command yielded incorrect scale amount. --- data/plugins/scale.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/data/plugins/scale.lua b/data/plugins/scale.lua index 5a1a69bd..a5f5aaee 100644 --- a/data/plugins/scale.lua +++ b/data/plugins/scale.lua @@ -32,6 +32,9 @@ local function set_scale(scale) local s = scale / current_scale current_scale = scale + -- we set scale_level in case this was called by user + scale_level = (scale - default_scale) / scale_steps + if config.scale_mode == "ui" then SCALE = scale @@ -58,7 +61,7 @@ local function set_scale(scale) core.redraw = true end -local function get_scale() +local function get_scale() return current_scale end @@ -101,9 +104,9 @@ keymap.add { ["ctrl+="] = "scale:increase", } -return { - ["set"] = set_scale, - ["get"] = get_scale, +return { + ["set"] = set_scale, + ["get"] = get_scale, ["increase"] = inc_scale, ["decrease"] = dec_scale, ["reset"] = res_scale From e1d85af69b96db7fdbdcc42222619dcfa7029155 Mon Sep 17 00:00:00 2001 From: cukmekerb Date: Thu, 17 Jun 2021 18:35:36 -0700 Subject: [PATCH 3/4] added config.tab_close_button option to hide X on tabs --- data/core/config.lua | 1 + data/core/rootview.lua | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/data/core/config.lua b/data/core/config.lua index 36a67add..949fe8a0 100644 --- a/data/core/config.lua +++ b/data/core/config.lua @@ -24,6 +24,7 @@ config.animation_rate = 1.0 config.blink_period = 0.8 config.draw_whitespace = false config.borderless = false +config.tab_close_button = true -- Disable plugin loading setting to false the config entry -- of the same name. diff --git a/data/core/rootview.lua b/data/core/rootview.lua index aa9a40cb..41c5f407 100644 --- a/data/core/rootview.lua +++ b/data/core/rootview.lua @@ -529,7 +529,7 @@ function Node:draw_tabs() renderer.draw_rect(x - ds, y, ds, h, style.divider) end local cx, cw, cspace = close_button_location(x, w) - local show_close_button = (view == self.active_view or i == self.hovered_tab) + local show_close_button = ((view == self.active_view or i == self.hovered_tab) and config.tab_close_button) if show_close_button then local close_style = self.hovered_close == i and style.text or style.dim common.draw_text(style.icon_font, close_style, "C", nil, cx, y, 0, h) From e493fa1b0adb3150dfb797a46ccd8bb48359e374 Mon Sep 17 00:00:00 2001 From: cukmekerb Date: Thu, 17 Jun 2021 21:15:30 -0700 Subject: [PATCH 4/4] clicking the empty space where the x was no longer closes the tab --- data/core/rootview.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/core/rootview.lua b/data/core/rootview.lua index 41c5f407..037e7580 100644 --- a/data/core/rootview.lua +++ b/data/core/rootview.lua @@ -295,7 +295,7 @@ function Node:tab_hovered_update(px, py) if tab_index then local x, y, w, h = self:get_tab_rect(tab_index) local cx, cw = close_button_location(x, w) - if px >= cx and px < cx + cw and py >= y and py < y + h then + if px >= cx and px < cx + cw and py >= y and py < y + h and config.tab_close_button then self.hovered_close = tab_index end else