aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+667e-11@users.noreply.github.com>2012-11-20 13:46:03 -0500
committerGravatar mitchell <70453897+667e-11@users.noreply.github.com>2012-11-20 13:46:03 -0500
commit8cb3bef141c7c2b781ce5d559a2ea27b77e88271 (patch)
tree203c0fae89962b3ff671b0dc565d0892466497d0
parent5f98f4e9afdc411dd492d103ff7e26c258d9b935 (diff)
Be consistent with regard to "caret" vs. "current position".
-rw-r--r--core/.buffer.luadoc40
-rw-r--r--modules/textadept/adeptsense.lua2
-rw-r--r--modules/textadept/editing.lua46
-rw-r--r--modules/textadept/mime_types.lua4
4 files changed, 45 insertions, 47 deletions
diff --git a/core/.buffer.luadoc b/core/.buffer.luadoc
index fe1cfa3b..c405d4a1 100644
--- a/core/.buffer.luadoc
+++ b/core/.buffer.luadoc
@@ -969,9 +969,8 @@ module('buffer')
function add_selection(buffer, caret, anchor) end
---
--- Adds string *text* to the buffer at the current position and moves the
--- current position to the end of the added text, but does not scroll it into
--- view.
+-- Adds string *text* to the buffer at the caret and moves the caret to the end
+-- of the added text, but does not scroll it into view.
-- @param buffer The global buffer.
-- @param text The text to add.
function add_text(buffer, text) end
@@ -1227,7 +1226,7 @@ function char_right_rect_extend(buffer) end
function choose_caret_x(buffer) end
---
--- Deletes the selected text or the character at the current position.
+-- Deletes the selected text or the character at the caret.
-- @param buffer The global buffer.
function clear(buffer) end
@@ -1328,12 +1327,12 @@ function count_characters(buffer, start_pos, end_pos) end
function cut(buffer) end
---
--- Deletes text from the current position to the beginning of the line.
+-- Deletes text from the caret to the beginning of the line.
-- @param buffer The global buffer.
function del_line_left(buffer) end
---
--- Deletes text from the current position to the end of the line.
+-- Deletes text from the caret to the end of the line.
-- @param buffer The global buffer.
function del_line_right(buffer) end
@@ -1457,7 +1456,7 @@ function ensure_visible_enforce_policy(buffer, line) end
function find_column(buffer, line, column) end
---
--- Inserts a Form Feed ("\f") character at the current position.
+-- Inserts a Form Feed ("\f") character at the caret.
-- @param buffer The global buffer.
function form_feed(buffer) end
@@ -1647,10 +1646,9 @@ function indicator_start(buffer, indicator, pos) end
function indicator_value_at(buffer, indicator, pos) end
---
--- Inserts string *text* at position *pos* or the current position if *pos* is
--- `-1`.
--- If the current position is after the *pos*, it is moved appropriately, but
--- not scrolled into view.
+-- Inserts string *text* at position *pos* or the caret if *pos* is `-1`.
+-- If the caret is after the *pos*, it is moved appropriately, but not scrolled
+-- into view.
-- @param buffer The global buffer.
-- @param pos The position to insert text at or `-1` for the current position.
-- @param text The text to insert.
@@ -1759,12 +1757,12 @@ function line_length(buffer, line) end
function line_scroll(buffer, columns, lines) end
---
--- Scroll the buffer down one line, keeping the current position visible.
+-- Scroll the buffer down one line, keeping the caret visible.
-- @param buffer The global buffer.
function line_scroll_down(buffer) end
---
--- Scroll the buffer up one line, keeping the current position visible.
+-- Scroll the buffer up one line, keeping the caret visible.
-- @param buffer The global buffer.
function line_scroll_up(buffer) end
@@ -1950,8 +1948,8 @@ function marker_previous(buffer, start_line, marker_mask) end
function marker_symbol_defined(buffer, marker_num) end
---
--- Moves the current position to be visible inside the view if it is not
--- already, removing any selections.
+-- Moves the caret to be visible inside the view if it is not already, removing
+-- any selections.
-- @param buffer The global buffer.
function move_caret_inside_view(buffer) end
@@ -1966,8 +1964,8 @@ function move_selected_lines_down(buffer) end
function move_selected_lines_up(buffer) end
---
--- Inserts a new line character(s) at the current position depending on the end
--- of line mode.
+-- Inserts a new line character(s) at the caret depending on the end of line
+-- mode.
-- @param buffer The global buffer.
function new_line(buffer) end
@@ -2149,7 +2147,7 @@ function replace_target_re(buffer, text) end
function rotate_selection(buffer) end
---
--- Scrolls the current position into view based on the policies set with
+-- Scrolls the caret into view based on the policies set with
-- `buffer:set_x_caret_policy()` and `buffer:set_y_caret_policy()`.
-- @param buffer The global buffer.
-- @see set_x_caret_policy
@@ -2427,7 +2425,7 @@ function swap_main_anchor_caret(buffer) end
---
-- Indents the selected lines, replaces the selected text on a line with a Tab
--- character ("\t"), or inserts a Tab character at the current position.
+-- character ("\t"), or inserts a Tab character at the caret.
-- @param buffer The global buffer.
function tab(buffer) end
@@ -2574,8 +2572,8 @@ function word_end_position(buffer, pos, only_word_chars) end
function word_left(buffer) end
---
--- Moves the caret left one word, positioning the current position at the end of
--- the previous word.
+-- Moves the caret left one word, positioning the caret at the end of the
+-- previous word.
-- `buffer.word_chars` contains word characters.
-- @param buffer The global buffer.
function word_left_end(buffer) end
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 = {}