aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2016-04-05 20:47:44 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2016-04-05 20:47:44 -0400
commitdd67ffe17bc8b1a472124a72783f557c61473fef (patch)
treee4c63115435e8944e10ea611f6696daf7384b26f /modules/textadept
parent8eeef0af7f63b466c1ecb1cec0a7024bda5f5fae (diff)
downloadtextadept-dd67ffe17bc8b1a472124a72783f557c61473fef.tar.gz
textadept-dd67ffe17bc8b1a472124a72783f557c61473fef.zip
Use more accurate variable names in `events.CHAR_ADDED` events.
Diffstat (limited to 'modules/textadept')
-rw-r--r--modules/textadept/editing.lua22
-rw-r--r--modules/textadept/run.lua4
2 files changed, 13 insertions, 13 deletions
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua
index 8e6126a6..d024808b 100644
--- a/modules/textadept/editing.lua
+++ b/modules/textadept/editing.lua
@@ -140,9 +140,9 @@ M.autocompleters = {}
M.api_files = {}
-- Matches characters specified in char_matches.
-events.connect(events.CHAR_ADDED, function(c)
+events.connect(events.CHAR_ADDED, function(byte)
if not M.AUTOPAIR then return end
- local match = (M.char_matches[buffer:get_lexer(true)] or M.char_matches)[c]
+ local match = (M.char_matches[buffer:get_lexer(true)] or M.char_matches)[byte]
if match and buffer.selections == 1 then buffer:insert_text(-1, match) end
end)
@@ -151,8 +151,8 @@ events.connect(events.KEYPRESS, function(code)
if not M.AUTOPAIR or keys.KEYSYMS[code] ~= '\b' or buffer.selections ~= 1 then
return
end
- local pos, char = buffer.current_pos, buffer.char_at[buffer.current_pos - 1]
- local match = (M.char_matches[buffer:get_lexer(true)] or M.char_matches)[char]
+ local pos, byte = buffer.current_pos, buffer.char_at[buffer.current_pos - 1]
+ local match = (M.char_matches[buffer:get_lexer(true)] or M.char_matches)[byte]
if match and buffer.char_at[pos] == string.byte(match) then buffer:clear() end
end)
@@ -182,8 +182,8 @@ events.connect(events.KEYPRESS, function(code)
end)
-- Auto-indent on return.
-events.connect(events.CHAR_ADDED, function(char)
- if not M.AUTOINDENT or char ~= 10 then return end
+events.connect(events.CHAR_ADDED, function(byte)
+ if not M.AUTOINDENT or byte ~= 10 then return end
local line = buffer:line_from_position(buffer.current_pos)
local i = line - 1
while i >= 0 and buffer:get_line(i):find('^[\r\n]+$') do i = i - 1 end
@@ -229,9 +229,9 @@ events.connect(events.FILE_BEFORE_SAVE, function()
-- Strip trailing whitespace.
for line = 0, buffer.line_count - 1 do
local s, e = buffer:position_from_line(line), buffer.line_end_position[line]
- local i, c = e - 1, buffer.char_at[e - 1]
- while i >= s and (c == 9 or c == 32) do
- i, c = i - 1, buffer.char_at[i - 1]
+ local i, byte = e - 1, buffer.char_at[e - 1]
+ while i >= s and (byte == 9 or byte == 32) do
+ i, byte = i - 1, buffer.char_at[i - 1]
end
if i < e - 1 then buffer:delete_range(i + 1, e - i - 1) end
end
@@ -334,8 +334,8 @@ end
-- @name transpose_chars
function M.transpose_chars()
if buffer.current_pos == 0 then return end
- local pos, char = buffer.current_pos, buffer.char_at[buffer.current_pos]
- if char == 10 or char == 13 or pos == buffer.length then pos = pos - 1 end
+ local pos, byte = buffer.current_pos, buffer.char_at[buffer.current_pos]
+ if byte == 10 or byte == 13 or pos == buffer.length then pos = pos - 1 end
buffer:set_target_range(pos - 1, pos + 1)
buffer:replace_target(buffer.target_text:reverse())
buffer:goto_pos(pos + 1)
diff --git a/modules/textadept/run.lua b/modules/textadept/run.lua
index 66a57ba4..c907f754 100644
--- a/modules/textadept/run.lua
+++ b/modules/textadept/run.lua
@@ -260,9 +260,9 @@ events.connect(events.BUILD_OUTPUT, print_output)
function M.stop() if M.proc then M.proc:kill() end end
-- Send line as input to process stdin on return.
-events.connect(events.CHAR_ADDED, function(char)
+events.connect(events.CHAR_ADDED, function(byte)
local proc = M.proc
- if char == 10 and proc and proc.status and proc:status() == 'running' and
+ if byte == 10 and proc and proc.status and proc:status() == 'running' and
buffer._type == _L['[Message Buffer]'] then
local line_num = buffer:line_from_position(buffer.current_pos) - 1
proc:write((buffer:get_line(line_num)))