From bd351f0bef198d981b67830ddb5e4cd42c3aca37 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Thu, 5 Jan 2012 06:44:30 -0500 Subject: Renamed editing module's 'current_word' to 'select_word'. Also added utils function for deleting the current word. --- modules/textadept/editing.lua | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'modules/textadept/editing.lua') diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua index ffd1ff78..2ac5a763 100644 --- a/modules/textadept/editing.lua +++ b/modules/textadept/editing.lua @@ -295,18 +295,6 @@ function M.prepare_for_save() end events_connect(events.FILE_BEFORE_SAVE, M.prepare_for_save) ---- --- Selects the current word under the caret and if action indicates, deletes it. --- @param action Optional action to perform with selected word. If `delete`, it --- is deleted. --- @name current_word -function M.current_word(action) - local buffer = buffer - buffer:set_sel(buffer:word_start_position(buffer.current_pos), - buffer:word_end_position(buffer.current_pos)) - if action == 'delete' then buffer:delete_back() end -end - --- -- Transposes characters intelligently. -- If the caret is at the end of a line, the two characters before the caret are @@ -381,6 +369,15 @@ function M.grow_selection(amount) end end +--- +-- Selects the current word under the caret. +-- @name select_word +function M.select_word(action) + local buffer = buffer + buffer:set_sel(buffer:word_start_position(buffer.current_pos), + buffer:word_end_position(buffer.current_pos)) +end + --- -- Selects the current line. -- @name select_line -- cgit v1.2.3