diff options
author | 2008-07-21 18:31:30 -0400 | |
---|---|---|
committer | 2008-07-21 18:31:30 -0400 | |
commit | 363a3420d1eef11e753860d431912e2f8e4bea1a (patch) | |
tree | 271a5c434ab3478688014e90a42ed76bb266ae55 /modules/textadept/editing.lua | |
parent | dc834b3f99281c19c495a97d0da7818c57e186ea (diff) | |
download | textadept-363a3420d1eef11e753860d431912e2f8e4bea1a.tar.gz textadept-363a3420d1eef11e753860d431912e2f8e4bea1a.zip |
Moved block comment key commands from language modules to _m.textadept.editing.
Diffstat (limited to 'modules/textadept/editing.lua')
-rw-r--r-- | modules/textadept/editing.lua | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua index 3609aa34..9251a507 100644 --- a/modules/textadept/editing.lua +++ b/modules/textadept/editing.lua @@ -55,6 +55,19 @@ local enclosure = { single_tag = { left = '<', right = ' />' } } +--- +-- [Local table] Comment strings for various lexer languages. +-- Used for the block_comment function. +-- @class table +-- @name comment_strings +-- @see block_comment +local comment_strings = { + cpp = '//~', + lua = '--~', + python = '#~', + ruby = '#~', +} + textadept.events.add_handler('char_added', function(c) -- matches characters specified in char_matches if char_matches[c] then @@ -191,6 +204,10 @@ textadept.events.add_handler('call_tip_click', -- each line in the selection. function block_comment(comment) local buffer = buffer + if not comment then + comment = comment_strings[ buffer:get_lexer_language() ] + 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 s = buffer:line_from_position(anchor) |