aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept
diff options
context:
space:
mode:
Diffstat (limited to 'modules/textadept')
-rw-r--r--modules/textadept/editing.lua10
-rw-r--r--modules/textadept/find.lua3
-rw-r--r--modules/textadept/snippets.lua2
3 files changed, 6 insertions, 9 deletions
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua
index 12c72d05..fd618c9f 100644
--- a/modules/textadept/editing.lua
+++ b/modules/textadept/editing.lua
@@ -199,8 +199,7 @@ function block_comment(comment)
comment = comment_string[buffer:get_lexer()]
if not comment then return end
end
- local caret, anchor = buffer.current_pos, buffer.anchor
- if caret < anchor then anchor, caret = caret, anchor end
+ local anchor, caret = buffer.selection_start, buffer.selection_end
local s = buffer:line_from_position(anchor)
local e = buffer:line_from_position(caret)
local mlines = s ~= e
@@ -378,9 +377,8 @@ end
-- selected.
function select_indented_block()
local buffer = buffer
- local s = buffer:line_from_position(buffer.anchor)
- local e = buffer:line_from_position(buffer.current_pos)
- if s > e then s, e = e, s end
+ local s = buffer:line_from_position(buffer.selection_start)
+ local e = buffer:line_from_position(buffer.selection_end)
local indent = buffer.line_indentation[s] - buffer.indent
if indent < 0 then return end
if buffer:get_sel_text() ~= '' then
@@ -451,7 +449,7 @@ events.connect('keypress',
function highlight_word()
clear_highlighted_words()
local buffer = buffer
- local s, e = buffer.anchor, buffer.current_pos
+ local s, e = buffer.selection_start, buffer.selection_end
if s == e then
s, e = buffer:word_start_position(s), buffer:word_end_position(s)
end
diff --git a/modules/textadept/find.lua b/modules/textadept/find.lua
index 202f7b49..3798ead9 100644
--- a/modules/textadept/find.lua
+++ b/modules/textadept/find.lua
@@ -256,9 +256,8 @@ local function replace_all(ftext, rtext, flags)
count = count + 1
end
else
- local anchor, current_pos = buffer.anchor, buffer.current_pos
+ local anchor, current_pos = buffer.selection_start, buffer.selection_end
local s, e = anchor, current_pos
- if s > e then s, e = e, s end
buffer:insert_text(e, '\n')
local end_marker = buffer:marker_add(buffer:line_from_position(e + 1),
MARK_FIND)
diff --git a/modules/textadept/snippets.lua b/modules/textadept/snippets.lua
index bcfc209c..cda54792 100644
--- a/modules/textadept/snippets.lua
+++ b/modules/textadept/snippets.lua
@@ -196,7 +196,7 @@ local function next_tab_stop()
snippet.snapshots[index] = s_text
if index > 0 then
buffer:begin_undo_action()
- local caret = math.max(buffer.anchor, buffer.current_pos)
+ local caret = buffer.selection_end
local ph_text = buffer:text_range(snippet.ph_pos, caret)
-- Transform mirror.