aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2012-11-20 13:46:03 -0500
committermitchell <70453897+667e-11@users.noreply.github.com>2012-11-20 13:46:03 -0500
commit8cb3bef141c7c2b781ce5d559a2ea27b77e88271 (patch)
tree203c0fae89962b3ff671b0dc565d0892466497d0 /modules
parent5f98f4e9afdc411dd492d103ff7e26c258d9b935 (diff)
downloadtextadept-8cb3bef141c7c2b781ce5d559a2ea27b77e88271.tar.gz
textadept-8cb3bef141c7c2b781ce5d559a2ea27b77e88271.zip
Be consistent with regard to "caret" vs. "current position".
Diffstat (limited to 'modules')
-rw-r--r--modules/textadept/adeptsense.lua2
-rw-r--r--modules/textadept/editing.lua46
-rw-r--r--modules/textadept/mime_types.lua4
3 files changed, 26 insertions, 26 deletions
diff --git a/modules/textadept/adeptsense.lua b/modules/textadept/adeptsense.lua
index 5f42fcdc..7f042f98 100644
--- a/modules/textadept/adeptsense.lua
+++ b/modules/textadept/adeptsense.lua
@@ -315,7 +315,7 @@ local M = {}
-- ### Child Language Adeptsenses
--
-- When Adeptsense completion is triggered, the Adeptsense for the language at
--- the *current caret position* is used, not necessarily the parent language's
+-- the *caret position* is used, not necessarily the parent language's
-- Adeptsense. For example, when editing CSS inside of an HTML file, the user
-- expects the CSS Adeptsense to be used. However, child language Adeptsenses
-- are not loaded automatically and must be loaded by the parent language
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua
index c7c6b381..0b90369f 100644
--- a/modules/textadept/editing.lua
+++ b/modules/textadept/editing.lua
@@ -139,10 +139,10 @@ end)
-- Autocomplete multiple selections.
events_connect(events.AUTO_C_SELECTION, function(text, position)
local buffer = buffer
- local caret = buffer.selection_n_caret[buffer.main_selection]
+ local pos = buffer.selection_n_caret[buffer.main_selection]
buffer:begin_undo_action()
for i = 0, buffer.selections - 1 do
- buffer.target_start = buffer.selection_n_anchor[i] - (caret - position)
+ buffer.target_start = buffer.selection_n_anchor[i] - (pos - position)
buffer.target_end = buffer.selection_n_caret[i]
buffer:replace_target(text)
buffer.selection_n_anchor[i] = buffer.selection_n_anchor[i] + #text
@@ -187,15 +187,15 @@ end)
-- @name match_brace
function M.match_brace(select)
local buffer = buffer
- local caret = buffer.current_pos
- local match_pos = buffer:brace_match(caret)
+ local pos = buffer.current_pos
+ local match_pos = buffer:brace_match(pos)
if match_pos == -1 then return end
if not select then
buffer:goto_pos(match_pos)
- elseif match_pos > caret then
- buffer:set_sel(caret, match_pos + 1)
+ elseif match_pos > pos then
+ buffer:set_sel(pos, match_pos + 1)
else
- buffer:set_sel(caret + 1, match_pos)
+ buffer:set_sel(pos + 1, match_pos)
end
end
@@ -216,10 +216,10 @@ end
-- @name autocomplete_word
function M.autocomplete_word(word_chars, default_words)
local buffer = buffer
- local caret, length = buffer.current_pos, buffer.length
+ local pos, length = buffer.current_pos, buffer.length
local completions, c_list = {}, {}
local buffer_text = buffer:get_text(buffer.length)
- local root = buffer_text:sub(1, caret):match('['..word_chars..']+$')
+ local root = buffer_text:sub(1, pos):match('['..word_chars..']+$')
if not root or root == '' then return end
for _, word in ipairs(default_words or {}) do
if word:match('^'..root) then
@@ -255,7 +255,7 @@ function M.autocomplete_word(word_chars, default_words)
-- Scintilla does not emit AUTO_C_SELECTION in this case. This is
-- necessary for autocompletion with multiple selections.
local text = c_list[1]:match('^(.-)%??%d*$')
- events.emit(events.AUTO_C_SELECTION, text, caret - #root)
+ events.emit(events.AUTO_C_SELECTION, text, pos - #root)
end
return true
end
@@ -277,25 +277,25 @@ function M.block_comment(prefix)
prefix = M.comment_string[buffer:get_lexer(true)]
if not prefix then return end
end
- local anchor, caret = buffer.selection_start, buffer.selection_end
+ local anchor, pos = buffer.selection_start, buffer.selection_end
local s = buffer:line_from_position(anchor)
- local e = buffer:line_from_position(caret)
+ local e = buffer:line_from_position(pos)
local mlines = s ~= e
- if mlines and caret == buffer:position_from_line(e) then e = e - 1 end
+ if mlines and pos == buffer:position_from_line(e) then e = e - 1 end
buffer:begin_undo_action()
for line = s, e do
local pos = buffer:position_from_line(line)
if buffer:text_range(pos, pos + #prefix) == prefix then
buffer:set_sel(pos, pos + #prefix)
buffer:replace_sel('')
- caret = caret - #prefix
+ pos = pos - #prefix
else
buffer:insert_text(pos, prefix)
- caret = caret + #prefix
+ pos = pos + #prefix
end
end
buffer:end_undo_action()
- if mlines then buffer:set_sel(anchor, caret) else buffer:goto_pos(caret) end
+ if mlines then buffer:set_sel(anchor, pos) else buffer:goto_pos(pos) end
end
---
@@ -383,16 +383,16 @@ end
-- @name grow_selection
function M.grow_selection(amount)
local buffer = buffer
- local anchor, caret = buffer.anchor, buffer.current_pos
- if anchor < caret then
- buffer:set_sel(anchor - amount, caret + amount)
+ local anchor, pos = buffer.anchor, buffer.current_pos
+ if anchor < pos then
+ buffer:set_sel(anchor - amount, pos + amount)
else
- buffer:set_sel(anchor + amount, caret - amount)
+ buffer:set_sel(anchor + amount, pos - amount)
end
end
---
--- Selects the current word under the caret.
+-- Selects the current word.
-- @see buffer.word_chars
-- @name select_word
function M.select_word()
@@ -489,8 +489,8 @@ events_connect(events.KEYPRESS, function(code)
end)
---
--- Highlights all occurrences of the selected text or the word under the caret
--- and adds markers to the lines they are on.
+-- Highlights all occurrences of the selected text or the current word and adds
+-- markers to the lines they are on.
-- @see buffer.word_chars
-- @name highlight_word
function M.highlight_word()
diff --git a/modules/textadept/mime_types.lua b/modules/textadept/mime_types.lua
index 2e07a3a4..8193bc52 100644
--- a/modules/textadept/mime_types.lua
+++ b/modules/textadept/mime_types.lua
@@ -109,8 +109,8 @@ local function get_style_name(buffer, style_num)
end
-- Contains the whitespace styles for lexers.
--- These whitespace styles are used to determine the lexer at the current caret
--- position since the styles have the name "[lang]_whitespace".
+-- These whitespace styles are used to determine the lexer at the caret position
+-- since the styles have the name "[lang]_whitespace".
-- @class table
-- @name ws_styles
local ws_styles = {}