aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2010-10-15 17:19:49 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2010-10-15 17:19:49 -0400
commitc2e121cb38d84cbe6a1aa37b9f8ef9c7d81d5b66 (patch)
treebb8beb1bb15425ccc93640ee269ac6c6093d1133 /modules
parent903e94af9204eddeec3f50cd6d5b5c62e1d651ad (diff)
downloadtextadept-c2e121cb38d84cbe6a1aa37b9f8ef9c7d81d5b66.tar.gz
textadept-c2e121cb38d84cbe6a1aa37b9f8ef9c7d81d5b66.zip
Added key commands and changed LuaDoc for highlighting words.
Diffstat (limited to 'modules')
-rw-r--r--modules/textadept/editing.lua23
-rw-r--r--modules/textadept/keys.lua6
2 files changed, 16 insertions, 13 deletions
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua
index d611e982..b7645770 100644
--- a/modules/textadept/editing.lua
+++ b/modules/textadept/editing.lua
@@ -22,13 +22,14 @@ module('_m.textadept.editing', package.seeall)
-- * `SAVE_STRIPS_WS`: Flag indicating whether or not to strip trailing
-- whitespace on file save.
-- * `MARK_HIGHLIGHT`: The unique integer mark used to identify a line
--- containing a highlighted word.
+-- containing a highlighted word.
-- * `MARK_HIGHLIGHT_BACK`: The [Scintilla color][scintilla_color] used for a
--- line containing a highlighted word.
+-- line containing a highlighted word.
-- * `INDIC_HIGHLIGHT`: The unique integer indicator for highlighted words.
--- * `INDIC_HIGHLIGHT_BACK`: The [Scintilla color][scintilla_color] used for a
--- highlighted word.
--- * `INDIC_HIGHLIGHT_ALPHA`: The transparency used for a highlighted word.
+-- * `INDIC_HIGHLIGHT_BACK`: The [Scintilla color][scintilla_color] used for an
+-- indicator for a highlighted word.
+-- * `INDIC_HIGHLIGHT_ALPHA`: The transparency used for an indicator for a
+-- highlighted word.
-- settings
AUTOPAIR = true
@@ -503,16 +504,19 @@ function convert_indentation()
buffer:end_undo_action()
end
--- Clears highlighted words.
+-- Clears highlighted word indicators and markers.
local function clear_highlighted_words()
local buffer = buffer
buffer:marker_delete_all(MARK_HIGHLIGHT)
buffer.indicator_current = INDIC_HIGHLIGHT
buffer:indicator_clear_range(0, buffer.length)
end
+events.connect('keypress',
+ function(c) if c == 0xff1b then clear_highlighted_words() end end) -- Esc
---
--- Highlights all occurances of the word under the caret.
+-- Highlights all occurances of the word under the caret and adds markers to the
+-- lines they are on.
function highlight_word()
clear_highlighted_words()
local buffer = buffer
@@ -537,10 +541,7 @@ function highlight_word()
buffer:set_sel(s, e)
end
-events.connect('keypress',
- function(c) if c == 0xff1b then clear_highlighted_words() end end) -- Esc
-
--- Sets view properties for highlighted words.
+-- Sets view properties for highlighted word indicators and markers.
local function set_highlight_properties()
local buffer = buffer
buffer:marker_set_back(MARK_HIGHLIGHT, MARK_HIGHLIGHT_BACK)
diff --git a/modules/textadept/keys.lua b/modules/textadept/keys.lua
index a5e93225..cfc58f31 100644
--- a/modules/textadept/keys.lua
+++ b/modules/textadept/keys.lua
@@ -138,7 +138,7 @@ if not MAC then
-- Windows and Linux key commands.
--[[
- C: D H I J K M U
+ C: D I J K M U
A: A B C D E F G H J K L M N P R S T U V W X Y Z
CS: A B C D G H I J K L M N O Q T U V X Y Z
SA: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
@@ -178,6 +178,7 @@ if not MAC then
keys['c\n\r'] = { m_editing.autocomplete_word, '%w_' } -- win32
keys.cq = { m_editing.block_comment }
-- TODO: { m_editing.current_word, 'delete' }
+ keys.ch = { m_editing.highlight_word }
-- TODO: { m_editing.transpose_chars }
-- TODO: { m_editing.convert_indentation }
keys.ac = { -- enClose in...
@@ -296,7 +297,7 @@ else
A: D E H J K L U Y
CS: C D G H I J K L M O Q S T U V W X Y Z
SA: A B C D H I J K L M N O Q R T U V X Y
- CA: A C E J K L M N O Q R S T U V W X Y Z
+ CA: A C E J K L M N O Q R S U V W X Y Z
CSA: A C D E H J K L M N O P Q R S T U V W X Y Z
]]--
@@ -331,6 +332,7 @@ else
keys.esc = { m_editing.autocomplete_word, '%w_' }
keys.cq = { m_editing.block_comment }
-- TODO: { m_editing.current_word, 'delete' }
+ keys.cat = { m_editing.highlight_word }
keys.ct = { m_editing.transpose_chars }
-- TODO: { m_editing.convert_indentation }
keys.cc = { -- enClose in...