aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2013-04-15 19:26:43 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2013-04-15 19:26:43 -0400
commit88419625268cce03b606584624b731ba10e37f21 (patch)
tree9046c561aa295b0ca21e9d0a52b5859d68b869cb /modules/textadept
parentd89352d1b3330a4578c81892b6e4e425f3665f2e (diff)
downloadtextadept-88419625268cce03b606584624b731ba10e37f21.tar.gz
textadept-88419625268cce03b606584624b731ba10e37f21.zip
Function in `finish_mode()` is optional; modules/textadept/command_entry.lua
Diffstat (limited to 'modules/textadept')
-rw-r--r--modules/textadept/command_entry.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/textadept/command_entry.lua b/modules/textadept/command_entry.lua
index 005af837..c3dfd963 100644
--- a/modules/textadept/command_entry.lua
+++ b/modules/textadept/command_entry.lua
@@ -61,16 +61,16 @@ end
---
-- Exits the current key mode, closes the command entry, and calls function *f*
--- with the command entry text as an argument.
+-- (if given) with the command entry text as an argument.
-- This is useful for binding keys to exit a command entry mode and perform an
-- action with the entered text.
--- @param f The function to call. It should accept the command entry text as an
--- argument.
+-- @param f Optional function to call. It should accept the command entry text
+-- as an argument.
-- @usage keys['\n'] = {gui.command_entry.finish_mode, gui.print}
-- @name finish_mode
function M.finish_mode(f)
M.enter_mode(nil)
- f(M.entry_text)
+ if f then f(M.entry_text) end
if CURSES then return false end -- propagate to exit CDK entry on Enter
end