diff --git a/sys/modules/opus/entry.lua b/sys/modules/opus/entry.lua index aa2397f..48c34fb 100644 --- a/sys/modules/opus/entry.lua +++ b/sys/modules/opus/entry.lua @@ -366,6 +366,7 @@ local mappings = { -- [ 'control-y' ] = Entry.paste, -- well this won't work... [ 'mouse_doubleclick' ] = Entry.markWord, + [ 'mouse_tripleclick' ] = Entry.markAll, [ 'shift-left' ] = Entry.markLeft, [ 'shift-right' ] = Entry.markRight, [ 'mouse_down' ] = Entry.markAnchor, diff --git a/sys/modules/opus/fuzzy.lua b/sys/modules/opus/fuzzy.lua index 7a6082d..c71ac08 100644 --- a/sys/modules/opus/fuzzy.lua +++ b/sys/modules/opus/fuzzy.lua @@ -4,8 +4,8 @@ -- not very fuzzy anymore local SCORE_WEIGHT = 1000 -local LEADING_LETTER_PENALTY = -3 -local LEADING_LETTER_PENALTY_MAX = -9 +local LEADING_LETTER_PENALTY = -30 +local LEADING_LETTER_PENALTY_MAX = -90 local _find = string.find local _max = math.max @@ -14,6 +14,8 @@ return function(str, pattern) local start = _find(str, pattern, 1, true) if start then -- All letters before the current one are considered leading, so add them to our penalty - return SCORE_WEIGHT + _max(LEADING_LETTER_PENALTY * (start - 1), LEADING_LETTER_PENALTY_MAX) + return SCORE_WEIGHT + + _max(LEADING_LETTER_PENALTY * (start - 1), LEADING_LETTER_PENALTY_MAX) + - (#str - #pattern) end end diff --git a/sys/modules/opus/input.lua b/sys/modules/opus/input.lua index b6a9b8f..95298ef 100644 --- a/sys/modules/opus/input.lua +++ b/sys/modules/opus/input.lua @@ -146,18 +146,26 @@ function input:translate(event, code, p1, p2) p1 == self.x and p2 == self.y and (clock - self.timer < .5) then - self.mch = 'mouse_doubleclick' - self.timer = nil + self.clickCount = self.clickCount + 1 + if self.clickCount == 3 then + self.mch = 'mouse_tripleclick' + self.timer = nil + self.clickCount = 1 + else + self.mch = 'mouse_doubleclick' + end else self.timer = os.clock() self.x = p1 self.y = p2 + self.clickCount = 1 end self.mfired = input:toCode(self.mch, 255) else self.mch = 'mouse_up' self.mfired = input:toCode(self.mch, 255) end + _syslog(self.mfired) return { code = self.mfired, button = code, diff --git a/sys/modules/opus/ui.lua b/sys/modules/opus/ui.lua index 58c14db..0ece43b 100644 --- a/sys/modules/opus/ui.lua +++ b/sys/modules/opus/ui.lua @@ -465,6 +465,9 @@ function UI.Window:init(args) until not m end +UI.Window.docs.postInit = [[postInit(VOID) +Called once the window has all the properties set. +Override to calculate properties or to dynamically add children]] function UI.Window:postInit() if self.parent then -- this will cascade down the whole tree of elements starting at the @@ -604,6 +607,8 @@ function UI.Window:reposition(x, y, w, h) end end +UI.Window.docs.raise = [[raise(VOID) +Raise this window to the top]] function UI.Window:raise() Array.removeByValue(self.parent.children, self) table.insert(self.parent.children, self) @@ -905,7 +910,7 @@ function UI.Window:pointToChild(x, y) } end -UI.Window.docs.getFocusables = [[getxables(VOID) +UI.Window.docs.getFocusables = [[getFocusables(VOID) Returns a list of children that can accept focus.]] function UI.Window:getFocusables() local focusable = { } diff --git a/sys/modules/opus/ui/components/TextEntry.lua b/sys/modules/opus/ui/components/TextEntry.lua index 7470ea2..e638338 100644 --- a/sys/modules/opus/ui/components/TextEntry.lua +++ b/sys/modules/opus/ui/components/TextEntry.lua @@ -74,7 +74,9 @@ function UI.TextEntry:draw() text = self.shadowText end - self:write(1, 1, ' ' .. Util.widthify(text, self.width - 2) .. ' ', bg, tc) + local ss = self.entry.scroll > 0 and '\183' or ' ' + self:write(2, 1, Util.widthify(text, self.width - 2) .. ' ', bg, tc) + self:write(1, 1, ss, bg, self.shadowTextColor) if self.entry.mark.active then local tx = math.max(self.entry.mark.x - self.entry.scroll, 0)