diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/cpp/commands.lua | 1 | ||||
-rw-r--r-- | modules/lua/commands.lua | 1 | ||||
-rw-r--r-- | modules/textadept/editing.lua | 17 |
3 files changed, 17 insertions, 2 deletions
diff --git a/modules/cpp/commands.lua b/modules/cpp/commands.lua index 4b35fcac..db4197c5 100644 --- a/modules/cpp/commands.lua +++ b/modules/cpp/commands.lua @@ -15,7 +15,6 @@ if type(keys) == 'table' then buffer:add_text(';') buffer:new_line() end }, - cq = { m_editing.block_comment, '//~' }, ['('] = { function() m_editing.show_call_tip(_m.cpp.api, true) return false diff --git a/modules/lua/commands.lua b/modules/lua/commands.lua index 96bac9ab..1b4ff90e 100644 --- a/modules/lua/commands.lua +++ b/modules/lua/commands.lua @@ -79,7 +79,6 @@ if type(keys) == 'table' then g = { goto_required } }, ['s\n'] = { try_to_autocomplete_end }, - cq = { m_editing.block_comment, '--~' }, cg = { run }, ['('] = { function() buffer.word_chars = 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) |