aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept/editing.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2012-01-05 06:44:30 -0500
committermitchell <70453897+667e-11@users.noreply.github.com>2012-01-05 06:44:30 -0500
commitbd351f0bef198d981b67830ddb5e4cd42c3aca37 (patch)
treeb3a8e3b902a1f585e4f486ff2f4e38f1995476a6 /modules/textadept/editing.lua
parent8c1f243ec135e2d2eec79961534f0a6df7c16efa (diff)
downloadtextadept-bd351f0bef198d981b67830ddb5e4cd42c3aca37.tar.gz
textadept-bd351f0bef198d981b67830ddb5e4cd42c3aca37.zip
Renamed editing module's 'current_word' to 'select_word'.
Also added utils function for deleting the current word.
Diffstat (limited to 'modules/textadept/editing.lua')
-rw-r--r--modules/textadept/editing.lua21
1 files changed, 9 insertions, 12 deletions
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
@@ -296,18 +296,6 @@ 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
-- transposed. Otherwise, the characters to the left and right are.
@@ -382,6 +370,15 @@ function M.grow_selection(amount)
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
function M.select_line()