diff --git a/data/core/commands/core.lua b/data/core/commands/core.lua index 3f466292..9ba809c4 100644 --- a/data/core/commands/core.lua +++ b/data/core/commands/core.lua @@ -145,7 +145,7 @@ command.add(nil, { else return true end - end) + end, true) end, ["core:open-log"] = function() diff --git a/data/core/commandview.lua b/data/core/commandview.lua index e3eb3dc9..0d19f82d 100644 --- a/data/core/commandview.lua +++ b/data/core/commandview.lua @@ -44,6 +44,7 @@ function CommandView:new() self.font = "font" self.size.y = 0 self.label = "" + self.wrap_on_overflow = false end @@ -89,11 +90,18 @@ function CommandView:set_text(text, select) end end - function CommandView:move_suggestion_idx(dir) + local function overflow_suggestion_idx(n, count) + if self.wrap_on_overflow then + return (n - 1) % count + 1 + else + return common.clamp(n, 1, count) + end + end + if self.show_suggestions then local n = self.suggestion_idx + dir - self.suggestion_idx = common.clamp(n, 1, #self.suggestions) + self.suggestion_idx = overflow_suggestion_idx(n, #self.suggestions) self:complete() self.last_change_id = self.doc:get_change_id() else @@ -104,7 +112,7 @@ function CommandView:move_suggestion_idx(dir) if n == 0 and self.save_suggestion then self:set_text(self.save_suggestion) else - self.suggestion_idx = common.clamp(n, 1, #self.suggestions) + self.suggestion_idx = overflow_suggestion_idx(n, #self.suggestions) self:complete() end else @@ -135,10 +143,11 @@ function CommandView:submit() end -function CommandView:enter(text, submit, suggest, cancel, validate) +function CommandView:enter(text, submit, suggest, cancel, validate, wrap_on_overflow) if self.state ~= default_state then return end + self.wrap_on_overflow = wrap_on_overflow or false; self.state = { submit = submit or noop, suggest = suggest or noop, diff --git a/data/plugins/lineguide.lua b/data/plugins/lineguide.lua index 83c35a8d..61f817f1 100644 --- a/data/plugins/lineguide.lua +++ b/data/plugins/lineguide.lua @@ -13,7 +13,7 @@ function DocView:draw_overlay(...) local y = self.position.y local w = math.ceil(SCALE * 1) local h = self.size.y - + local color = style.guide or style.selection renderer.draw_rect(x, y, w, h, color) end