From a6f52197d0581a94aa8f71778044829cb6191b45 Mon Sep 17 00:00:00 2001 From: Victor Gridnevsky Date: Tue, 2 Jun 2020 13:26:16 +0300 Subject: [PATCH 1/7] Fixes keypad enter issue (#131) --- data/core/keymap.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/data/core/keymap.lua b/data/core/keymap.lua index 19c2fdd8..4d48ed4e 100644 --- a/data/core/keymap.lua +++ b/data/core/keymap.lua @@ -139,6 +139,7 @@ keymap.add { ["ctrl+delete"] = "doc:delete-to-next-word-end", ["ctrl+shift+delete"] = "doc:delete-to-next-word-end", ["return"] = { "command:submit", "doc:newline" }, + ["keypad enter"] = { "command:submit", "doc:newline" }, ["ctrl+return"] = "doc:newline-below", ["ctrl+shift+return"] = "doc:newline-above", ["ctrl+j"] = "doc:join-lines", From 4b167e86c6db8c922bde10b42ecbf5e24601f364 Mon Sep 17 00:00:00 2001 From: rxi Date: Tue, 2 Jun 2020 22:50:03 +0100 Subject: [PATCH 2/7] Fixed bug in Highlighter.invalidate() when setting first_invalid_line The value should not be updated if the current first_invalid_line is less than the new invalid line index --- data/core/doc/highlighter.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/core/doc/highlighter.lua b/data/core/doc/highlighter.lua index 718392a1..e7650d01 100644 --- a/data/core/doc/highlighter.lua +++ b/data/core/doc/highlighter.lua @@ -46,7 +46,7 @@ end function Highlighter:invalidate(idx) - self.first_invalid_line = idx + self.first_invalid_line = math.min(self.first_invalid_line, idx) self.max_wanted_line = math.min(self.max_wanted_line, #self.doc.lines) end From 18de4552e2313a902b9448432dfd6802b47d3d56 Mon Sep 17 00:00:00 2001 From: rxi Date: Wed, 3 Jun 2020 13:34:10 +0100 Subject: [PATCH 3/7] Made tab's text left-aligned if wider than the tab --- data/core/rootview.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/data/core/rootview.lua b/data/core/rootview.lua index 0b505663..389525f6 100644 --- a/data/core/rootview.lua +++ b/data/core/rootview.lua @@ -349,7 +349,9 @@ function Node:draw_tabs() color = style.text end core.push_clip_rect(x, y, w, h) - common.draw_text(style.font, color, text, "center", x, y, w, h) + x, w = x + style.padding.x, w - style.padding.x * 2 + local align = style.font:get_width(text) > w and "left" or "center" + common.draw_text(style.font, color, text, align, x, y, w, h) core.pop_clip_rect() end From 7aa462e43d6f3e1c4f7ab035ae07353d60387f71 Mon Sep 17 00:00:00 2001 From: Daniele Laudani Date: Wed, 3 Jun 2020 14:38:44 +0200 Subject: [PATCH 4/7] Don't tell the system to disable compositing under X11 Fixes #123 --- src/main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main.c b/src/main.c index c739f5f9..69ff28c9 100644 --- a/src/main.c +++ b/src/main.c @@ -69,6 +69,11 @@ int main(int argc, char **argv) { #endif SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS); + +#ifdef SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR /* Available since 2.0.8 */ + SDL_SetHint(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, "0"); +#endif + SDL_EnableScreenSaver(); SDL_EventState(SDL_DROPFILE, SDL_ENABLE); atexit(SDL_Quit); From 95ee03fb373806fcfc01a91113d3aef41ed50a4b Mon Sep 17 00:00:00 2001 From: Daniele Laudani Date: Wed, 3 Jun 2020 15:05:55 +0200 Subject: [PATCH 5/7] move BYPASS_COMPOSITOR near other SetHint --- src/main.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main.c b/src/main.c index 69ff28c9..abafd2bb 100644 --- a/src/main.c +++ b/src/main.c @@ -69,14 +69,13 @@ int main(int argc, char **argv) { #endif SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS); - -#ifdef SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR /* Available since 2.0.8 */ - SDL_SetHint(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, "0"); -#endif - SDL_EnableScreenSaver(); SDL_EventState(SDL_DROPFILE, SDL_ENABLE); atexit(SDL_Quit); + +#ifdef SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR /* Available since 2.0.8 */ + SDL_SetHint(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, "0"); +#endif #if SDL_VERSION_ATLEAST(2, 0, 5) SDL_SetHint(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, "1"); #endif From bd0644a5bb95f85e0d11c87ebdfd61c8fd82fae8 Mon Sep 17 00:00:00 2001 From: rxi Date: Thu, 4 Jun 2020 13:57:27 +0100 Subject: [PATCH 6/7] Added resetting of selection on intermediate find-text failure --- data/core/commands/findreplace.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/data/core/commands/findreplace.lua b/data/core/commands/findreplace.lua index e3e31a37..937c410a 100644 --- a/data/core/commands/findreplace.lua +++ b/data/core/commands/findreplace.lua @@ -45,23 +45,24 @@ local function find(label, search_fn) else core.error("Couldn't find %q", text) dv.doc:set_selection(table.unpack(sel)) + dv:scroll_to_make_visible(sel[1], sel[2]) end end, function(text) local ok, line1, col1, line2, col2 = pcall(search_fn, dv.doc, sel[1], sel[2], text) - if text == "" then - dv.doc:set_selection(table.unpack(sel)) - elseif ok and line1 then + if ok and line1 and text ~= "" then dv.doc:set_selection(line2, col2, line1, col1) dv:scroll_to_line(line2, true) found = true else + dv.doc:set_selection(table.unpack(sel)) found = false end end, function(explicit) if explicit then dv.doc:set_selection(table.unpack(sel)) + dv:scroll_to_make_visible(sel[1], sel[2]) end end) end From 877d940c0e3426526c1a60785851e1958880314e Mon Sep 17 00:00:00 2001 From: rxi Date: Fri, 5 Jun 2020 22:37:51 +0100 Subject: [PATCH 7/7] language_js improvements --- data/plugins/language_js.lua | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/data/plugins/language_js.lua b/data/plugins/language_js.lua index 24e71016..cf1b124a 100644 --- a/data/plugins/language_js.lua +++ b/data/plugins/language_js.lua @@ -8,6 +8,7 @@ syntax.add { { pattern = { "/%*", "%*/" }, type = "comment" }, { pattern = { '"', '"', '\\' }, type = "string" }, { pattern = { "'", "'", '\\' }, type = "string" }, + { pattern = { "`", "`", '\\' }, type = "string" }, { pattern = "0x[%da-fA-F]+", type = "number" }, { pattern = "-?%d+[%d%.eE]*", type = "number" }, { pattern = "-?%.?%d+", type = "number" }, @@ -16,7 +17,6 @@ syntax.add { { pattern = "[%a_][%w_]*", type = "symbol" }, }, symbols = { - ["arguments"] = "keyword2", ["async"] = "keyword", ["await"] = "keyword", ["break"] = "keyword", @@ -32,7 +32,6 @@ syntax.add { ["else"] = "keyword", ["export"] = "keyword", ["extends"] = "keyword", - ["false"] = "literal", ["finally"] = "keyword", ["for"] = "keyword", ["function"] = "keyword", @@ -40,26 +39,29 @@ syntax.add { ["if"] = "keyword", ["import"] = "keyword", ["in"] = "keyword", - ["Infinity"] = "keyword2", ["instanceof"] = "keyword", ["let"] = "keyword", - ["NaN"] = "keyword2", ["new"] = "keyword", - ["null"] = "literal", ["return"] = "keyword", ["set"] = "keyword", + ["static"] = "keyword", ["super"] = "keyword", ["switch"] = "keyword", - ["this"] = "keyword2", ["throw"] = "keyword", - ["true"] = "literal", ["try"] = "keyword", ["typeof"] = "keyword", - ["undefined"] = "literal", ["var"] = "keyword", ["void"] = "keyword", ["while"] = "keyword", ["with"] = "keyword", ["yield"] = "keyword", + ["true"] = "literal", + ["false"] = "literal", + ["null"] = "literal", + ["undefined"] = "literal", + ["arguments"] = "keyword2", + ["Infinity"] = "keyword2", + ["NaN"] = "keyword2", + ["this"] = "keyword2", }, }