From 1be7d50f3cee5aa4a06c083d195290e8fe8cacaf Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Sun, 5 Oct 2014 00:28:18 -0400 Subject: Replaced command entry text field with a Scintilla buffer. `ui.command_entry` now has the same functions and fields as `buffer`s as well as an additional `height` property. Note that when the command entry is active, `_G.buffer` is unchanged, so many existing key commands cannot be bound to command entry key modes. See `keys.lua_command` in *modules/textadept/command_entry.lua* for the proper way to bind them. Removed `ui.command_entry.entry_text` and `ui.command_entry.show_completions()`. --- core/.buffer.luadoc | 4 ++-- core/keys.lua | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'core') diff --git a/core/.buffer.luadoc b/core/.buffer.luadoc index 871d32f0..c5e5e2fd 100644 --- a/core/.buffer.luadoc +++ b/core/.buffer.luadoc @@ -512,8 +512,8 @@ -- * `buffer.MARGIN_RTEXT` -- A right-justified text margin. -- --- The default values are `true`, `false`, `false`, `false`, and `false`, for --- a line number margin and symbol margins. +-- The default value for the first margin is `buffer.MARGIN_NUMBER`, followed +-- by `buffer.MARGIN_SYMBOL` for the rest. -- @field margin_width_n (table) -- Table of pixel margin widths for margin numbers from zero to four. -- @field marker_alpha (table, Write-only) diff --git a/core/keys.lua b/core/keys.lua index 0761cfa1..ce19c1fe 100644 --- a/core/keys.lua +++ b/core/keys.lua @@ -167,9 +167,8 @@ M.keychain = setmetatable({}, { }) -- Clears the current key sequence. --- This is also used by *modules/textadept/command_entry.lua*. -M.clear_key_sequence = function() - -- Clearing a table is faster than re-creating one. +local function clear_key_sequence() + -- Clearing a table is sometimes faster than re-creating one. if #keychain == 1 then keychain[1] = nil else keychain = {} end end @@ -187,7 +186,7 @@ M.run_command = function(command, command_type) -- If the argument is a view or buffer, use the current one instead. if type(args[2]) == 'table' then local mt, buffer, view = getmetatable(args[2]), buffer, view - if mt == getmetatable(buffer) then + if mt == getmetatable(buffer) and args[2] ~= ui.command_entry then args[2] = buffer elseif mt == getmetatable(view) then args[2] = view @@ -242,7 +241,7 @@ local function keypress(code, shift, control, alt, meta) --if CURSES then ui.statusbar_text = '"'..key_seq..'"' end local keychain_size = #keychain if keychain_size > 0 and key_seq == M.CLEAR then - M.clear_key_sequence() + clear_key_sequence() return true end keychain[keychain_size + 1] = key_seq @@ -254,7 +253,7 @@ local function keypress(code, shift, control, alt, meta) else status = key_command(M.MODE) end - if status ~= CHAIN then M.clear_key_sequence() end + if status ~= CHAIN then clear_key_sequence() end if status > PROPAGATE then return true end -- CHAIN or HALT if status == INVALID and keychain_size > 0 then ui.statusbar_text = _L['Invalid sequence'] -- cgit v1.2.3