Merge remote-tracking branch 'rxi/master' into font-rendering-tests
This commit is contained in:
commit
fc148d7a51
|
@ -45,23 +45,24 @@ local function find(label, search_fn)
|
||||||
else
|
else
|
||||||
core.error("Couldn't find %q", text)
|
core.error("Couldn't find %q", text)
|
||||||
dv.doc:set_selection(table.unpack(sel))
|
dv.doc:set_selection(table.unpack(sel))
|
||||||
|
dv:scroll_to_make_visible(sel[1], sel[2])
|
||||||
end
|
end
|
||||||
|
|
||||||
end, function(text)
|
end, function(text)
|
||||||
local ok, line1, col1, line2, col2 = pcall(search_fn, dv.doc, sel[1], sel[2], text)
|
local ok, line1, col1, line2, col2 = pcall(search_fn, dv.doc, sel[1], sel[2], text)
|
||||||
if text == "" then
|
if ok and line1 and text ~= "" then
|
||||||
dv.doc:set_selection(table.unpack(sel))
|
|
||||||
elseif ok and line1 then
|
|
||||||
dv.doc:set_selection(line2, col2, line1, col1)
|
dv.doc:set_selection(line2, col2, line1, col1)
|
||||||
dv:scroll_to_line(line2, true)
|
dv:scroll_to_line(line2, true)
|
||||||
found = true
|
found = true
|
||||||
else
|
else
|
||||||
|
dv.doc:set_selection(table.unpack(sel))
|
||||||
found = false
|
found = false
|
||||||
end
|
end
|
||||||
|
|
||||||
end, function(explicit)
|
end, function(explicit)
|
||||||
if explicit then
|
if explicit then
|
||||||
dv.doc:set_selection(table.unpack(sel))
|
dv.doc:set_selection(table.unpack(sel))
|
||||||
|
dv:scroll_to_make_visible(sel[1], sel[2])
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
|
@ -46,7 +46,7 @@ end
|
||||||
|
|
||||||
|
|
||||||
function Highlighter:invalidate(idx)
|
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)
|
self.max_wanted_line = math.min(self.max_wanted_line, #self.doc.lines)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -139,6 +139,7 @@ keymap.add {
|
||||||
["ctrl+delete"] = "doc:delete-to-next-word-end",
|
["ctrl+delete"] = "doc:delete-to-next-word-end",
|
||||||
["ctrl+shift+delete"] = "doc:delete-to-next-word-end",
|
["ctrl+shift+delete"] = "doc:delete-to-next-word-end",
|
||||||
["return"] = { "command:submit", "doc:newline" },
|
["return"] = { "command:submit", "doc:newline" },
|
||||||
|
["keypad enter"] = { "command:submit", "doc:newline" },
|
||||||
["ctrl+return"] = "doc:newline-below",
|
["ctrl+return"] = "doc:newline-below",
|
||||||
["ctrl+shift+return"] = "doc:newline-above",
|
["ctrl+shift+return"] = "doc:newline-above",
|
||||||
["ctrl+j"] = "doc:join-lines",
|
["ctrl+j"] = "doc:join-lines",
|
||||||
|
|
|
@ -349,7 +349,9 @@ function Node:draw_tabs()
|
||||||
color = style.text
|
color = style.text
|
||||||
end
|
end
|
||||||
core.push_clip_rect(x, y, w, h)
|
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()
|
core.pop_clip_rect()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ syntax.add {
|
||||||
{ pattern = { "/%*", "%*/" }, type = "comment" },
|
{ pattern = { "/%*", "%*/" }, type = "comment" },
|
||||||
{ pattern = { '"', '"', '\\' }, type = "string" },
|
{ pattern = { '"', '"', '\\' }, type = "string" },
|
||||||
{ pattern = { "'", "'", '\\' }, type = "string" },
|
{ pattern = { "'", "'", '\\' }, type = "string" },
|
||||||
|
{ pattern = { "`", "`", '\\' }, type = "string" },
|
||||||
{ pattern = "0x[%da-fA-F]+", type = "number" },
|
{ pattern = "0x[%da-fA-F]+", type = "number" },
|
||||||
{ pattern = "-?%d+[%d%.eE]*", type = "number" },
|
{ pattern = "-?%d+[%d%.eE]*", type = "number" },
|
||||||
{ pattern = "-?%.?%d+", type = "number" },
|
{ pattern = "-?%.?%d+", type = "number" },
|
||||||
|
@ -16,7 +17,6 @@ syntax.add {
|
||||||
{ pattern = "[%a_][%w_]*", type = "symbol" },
|
{ pattern = "[%a_][%w_]*", type = "symbol" },
|
||||||
},
|
},
|
||||||
symbols = {
|
symbols = {
|
||||||
["arguments"] = "keyword2",
|
|
||||||
["async"] = "keyword",
|
["async"] = "keyword",
|
||||||
["await"] = "keyword",
|
["await"] = "keyword",
|
||||||
["break"] = "keyword",
|
["break"] = "keyword",
|
||||||
|
@ -32,7 +32,6 @@ syntax.add {
|
||||||
["else"] = "keyword",
|
["else"] = "keyword",
|
||||||
["export"] = "keyword",
|
["export"] = "keyword",
|
||||||
["extends"] = "keyword",
|
["extends"] = "keyword",
|
||||||
["false"] = "literal",
|
|
||||||
["finally"] = "keyword",
|
["finally"] = "keyword",
|
||||||
["for"] = "keyword",
|
["for"] = "keyword",
|
||||||
["function"] = "keyword",
|
["function"] = "keyword",
|
||||||
|
@ -40,26 +39,29 @@ syntax.add {
|
||||||
["if"] = "keyword",
|
["if"] = "keyword",
|
||||||
["import"] = "keyword",
|
["import"] = "keyword",
|
||||||
["in"] = "keyword",
|
["in"] = "keyword",
|
||||||
["Infinity"] = "keyword2",
|
|
||||||
["instanceof"] = "keyword",
|
["instanceof"] = "keyword",
|
||||||
["let"] = "keyword",
|
["let"] = "keyword",
|
||||||
["NaN"] = "keyword2",
|
|
||||||
["new"] = "keyword",
|
["new"] = "keyword",
|
||||||
["null"] = "literal",
|
|
||||||
["return"] = "keyword",
|
["return"] = "keyword",
|
||||||
["set"] = "keyword",
|
["set"] = "keyword",
|
||||||
|
["static"] = "keyword",
|
||||||
["super"] = "keyword",
|
["super"] = "keyword",
|
||||||
["switch"] = "keyword",
|
["switch"] = "keyword",
|
||||||
["this"] = "keyword2",
|
|
||||||
["throw"] = "keyword",
|
["throw"] = "keyword",
|
||||||
["true"] = "literal",
|
|
||||||
["try"] = "keyword",
|
["try"] = "keyword",
|
||||||
["typeof"] = "keyword",
|
["typeof"] = "keyword",
|
||||||
["undefined"] = "literal",
|
|
||||||
["var"] = "keyword",
|
["var"] = "keyword",
|
||||||
["void"] = "keyword",
|
["void"] = "keyword",
|
||||||
["while"] = "keyword",
|
["while"] = "keyword",
|
||||||
["with"] = "keyword",
|
["with"] = "keyword",
|
||||||
["yield"] = "keyword",
|
["yield"] = "keyword",
|
||||||
|
["true"] = "literal",
|
||||||
|
["false"] = "literal",
|
||||||
|
["null"] = "literal",
|
||||||
|
["undefined"] = "literal",
|
||||||
|
["arguments"] = "keyword2",
|
||||||
|
["Infinity"] = "keyword2",
|
||||||
|
["NaN"] = "keyword2",
|
||||||
|
["this"] = "keyword2",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,10 @@ int main(int argc, char **argv) {
|
||||||
SDL_EnableScreenSaver();
|
SDL_EnableScreenSaver();
|
||||||
SDL_EventState(SDL_DROPFILE, SDL_ENABLE);
|
SDL_EventState(SDL_DROPFILE, SDL_ENABLE);
|
||||||
atexit(SDL_Quit);
|
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)
|
#if SDL_VERSION_ATLEAST(2, 0, 5)
|
||||||
SDL_SetHint(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, "1");
|
SDL_SetHint(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, "1");
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue