aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/core/commands/findreplace.lua7
-rw-r--r--data/core/doc/highlighter.lua2
-rw-r--r--data/core/keymap.lua1
-rw-r--r--data/core/rootview.lua4
-rw-r--r--data/plugins/language_js.lua18
-rw-r--r--src/main.c4
6 files changed, 23 insertions, 13 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
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
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",
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
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",
},
}
diff --git a/src/main.c b/src/main.c
index c739f5f9..abafd2bb 100644
--- a/src/main.c
+++ b/src/main.c
@@ -72,6 +72,10 @@ int main(int argc, char **argv) {
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