diff options
author | 2012-06-06 21:15:25 -0400 | |
---|---|---|
committer | 2012-06-06 21:15:25 -0400 | |
commit | 0ba47873ec725db8f4ba83bac2c33664ea8fd8c1 (patch) | |
tree | 90f8f9d5026b43c7d1eab01c611689d0fba1697f /core | |
parent | 2d95903f2e519bca81a4f66ca2865e66d458a1c4 (diff) | |
download | textadept-0ba47873ec725db8f4ba83bac2c33664ea8fd8c1.tar.gz textadept-0ba47873ec725db8f4ba83bac2c33664ea8fd8c1.zip |
`gui.statusbar_text` is write-only again.
Diffstat (limited to 'core')
-rw-r--r-- | core/gui.lua | 2 | ||||
-rw-r--r-- | core/keys.lua | 19 |
2 files changed, 7 insertions, 14 deletions
diff --git a/core/gui.lua b/core/gui.lua index a81877b0..8eaa80ed 100644 --- a/core/gui.lua +++ b/core/gui.lua @@ -10,7 +10,7 @@ local gui = gui -- A GTK menu defining the editor's context menu. -- @field clipboard_text (string, Read-only) -- The text on the clipboard. --- @field statusbar_text (string) +-- @field statusbar_text (string, Write-only) -- The text displayed by the statusbar. -- @field docstatusbar_text (string, Write-only) -- The text displayed by the doc statusbar. diff --git a/core/keys.lua b/core/keys.lua index 08181c49..c8850fbe 100644 --- a/core/keys.lua +++ b/core/keys.lua @@ -158,8 +158,8 @@ local keychain = {} -- Clears the current key sequence. local function clear_key_sequence() - if #keychain > 0 then keychain = {} end - gui.statusbar_text = '' + -- Clearing a table is faster than re-creating one. + if #keychain == 1 then keychain[1] = nil else keychain = {} end end -- Runs a given command. @@ -237,6 +237,7 @@ local function keypress(code, shift, control, alt, meta) (meta and OSX and META or '')..(shift and SHIFT or '')..key --print(key_seq) + gui.statusbar_text = '' if #keychain > 0 and key_seq == M.CLEAR then clear_key_sequence() return true @@ -247,22 +248,14 @@ local function keypress(code, shift, control, alt, meta) for i = 1, 2 do local status = run_key_command(i == 1 and buffer:get_lexer(true)) if status > 0 then -- CHAIN or HALT - if status == HALT then - -- Clear the key sequence, but keep any status messages from the key - -- command itself. - keychain = {} - local text = gui.statusbar_text or '' - if text == _L['Invalid sequence'] or text:find(_L['Keychain:']) then - gui.statusbar_text = '' - end - end + if status == HALT then clear_key_sequence() end return true end success = success or status ~= -1 end - local size = #keychain - 1 + local size = #keychain clear_key_sequence() - if not success and size > 0 then -- INVALID keychain sequence + if not success and size > 1 then -- INVALID keychain sequence gui.statusbar_text = _L['Invalid sequence'] return true end |