Merge remote-tracking branch 'rxi/master' into font-rendering-tests

This commit is contained in:
Francesco Abbate 2020-06-07 00:19:03 +02:00
commit fc148d7a51
6 changed files with 23 additions and 13 deletions

View File

@ -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

View File

@ -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

View File

@ -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",

View File

@ -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

View File

@ -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",
},
}

View File

@ -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