diff options
author | 2020-07-14 18:22:13 -0400 | |
---|---|---|
committer | 2020-07-14 18:22:13 -0400 | |
commit | 13bd039c243ef4e44bd037d1c3506d350f682c09 (patch) | |
tree | 57d8d1a0b78df2622c1789b13e4da00aaf188f3a | |
parent | b821d05d828aec6ac6c070f00c9115f27f62f9c0 (diff) | |
download | textadept-13bd039c243ef4e44bd037d1c3506d350f682c09.tar.gz textadept-13bd039c243ef4e44bd037d1c3506d350f682c09.zip |
Renamed `textadept.editing.block_comment()` to `toggle_comment()`.
-rw-r--r-- | CHANGELOG.md | 3 | ||||
-rw-r--r-- | doc/manual.md | 6 | ||||
-rw-r--r-- | modules/textadept/editing.lua | 8 | ||||
-rw-r--r-- | modules/textadept/keys.lua | 2 | ||||
-rw-r--r-- | modules/textadept/menu.lua | 2 | ||||
-rw-r--r-- | test/test.lua | 18 |
6 files changed, 20 insertions, 19 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 74cee61f..336ef7e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2880,7 +2880,7 @@ Changes: * Renamed Adeptsense image fields. * Renamed `_M.textadept.editing.STRIP_WHITESPACE_ON_SAVE` to `STRIP_TRAILING_SPACES`. -* [`_M.textadept.editing.block_comment()`][] supports block comment delimiters. +* `_M.textadept.editing.block_comment()` supports block comment delimiters. * Block comments for languages is now built-in. The supplemental ones on the wiki are no longer needed. * `gui.set_theme()` accepts key-value argument pairs for overriding theme @@ -2903,7 +2903,6 @@ Changes: [PGP -- 7.0 alpha 2 Linux x86_64]: download/textadept_7.0_alpha_2.x86_64.tgz.asc [PGP -- 7.0 alpha 2 Modules]: download/textadept_7.0_alpha_2.modules.zip.asc [compiling]: manual.html#Compiling -[`_M.textadept.editing.block_comment()`]: api.html#textadept.editing.block_comment [`_M.textadept.bookmarks.goto_mark()`]: api.html#textadept.bookmarks.goto_mark [LuaJIT]: http://luajit.org [nightly builds]: README.html#Download diff --git a/doc/manual.md b/doc/manual.md index 4f6feed5..aaa326b3 100644 --- a/doc/manual.md +++ b/doc/manual.md @@ -2036,10 +2036,11 @@ N/A |Added |[number][] N/A |Added |[colors][] N/A |Added |[styles][] **lfs** | | -dir\_foreach() |Replaced|for filename in [`lfs.walk()`][] do ... end +dir\_foreach() |Replaced|for filename in [lfs.walk()][] do ... end **textadept.bookmarks** | | toggle(line, on) |Changed |[toggle()][] **textadept.editing** | | +block\_comment() |Renamed |[toggle_comment()][] highlight_word() |Replaced|[ui.highlight_words][] INDIC\_HIGHLIGHT |Replaced|[ui.INDIC_HIGHLIGHT][] **textadept.file_types** | | @@ -2075,8 +2076,9 @@ section below. [number]: api.html#lexer.number [colors]: api.html#lexer.colors [styles]: api.html#lexer.styles -[`lfs.walk()`]: api.html#lfs.walk +[lfs.walk()]: api.html#lfs.walk [toggle()]: api.html#textadept.bookmarks.toggle +[toggle_comment()]: api.html#textadept.editing.toggle_comment [ui.highlight_words]: api.html#ui.highlight_words [ui.INDIC_HIGHLIGHT]: api.html#ui.INDIC_HIGHLIGHT [insert()]: api.html#textadept.snippets.insert diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua index 20b0c0bd..96e4e351 100644 --- a/modules/textadept/editing.lua +++ b/modules/textadept/editing.lua @@ -57,12 +57,12 @@ for _ = 1, #M.XPM_IMAGES do _SCINTILLA.next_image_type() end -- sync --- -- Map of lexer names to line comment strings for programming languages, used by --- the `block_comment()` function. +-- the `toggle_comment()` function. -- Keys are lexer names and values are either the language's line comment -- prefixes or block comment delimiters separated by a '|' character. -- @class table -- @name comment_string --- @see block_comment +-- @see toggle_comment M.comment_string = {actionscript='//',ada='--',apdl='!',ansi_c='/*|*/',antlr='//',apl='#',applescript='--',asp='\'',autoit=';',awk='#',b_lang='//',bash='#',batch=':',bibtex='%',boo='#',chuck='//',cmake='#',coffeescript='#',context='%',cpp='//',crystal='#',csharp='//',css='/*|*/',cuda='//',desktop='#',django='{#|#}',dmd='//',dockerfile='#',dot='//',eiffel='--',elixir='#',erlang='%',faust='//',fennel=';',fish='#',forth='|\\',fortran='!',fsharp='//',gap='#',gettext='#',gherkin='#',glsl='//',gnuplot='#',go='//',groovy='//',gtkrc='#',haskell='--',html='<!--|-->',icon='#',idl='//',inform='!',ini='#',Io='#',java='//',javascript='//',json='/*|*/',jsp='//',latex='%',ledger='#',less='//',lilypond='%',lisp=';',logtalk='%',lua='--',makefile='#',matlab='#',moonscript='--',myrddin='//',nemerle='//',nim='#',nsis='#',objective_c='//',pascal='//',perl='#',php='//',pico8='//',pike='//',pkgbuild='#',prolog='%',props='#',protobuf='//',ps='%',pure='//',python='#',rails='#',rc='#',rebol=';',rest='.. ',rexx='--',rhtml='<!--|-->',rstats='#',ruby='#',rust='//',sass='//',scala='//',scheme=';',smalltalk='"|"',sml='(*)',snobol4='#',sql='--',tcl='#',tex='%',text='',toml='#',vala='//',vb='\'',vbscript='\'',verilog='//',vhdl='--',wsf='<!--|-->',xml='<!--|-->',yaml='#'} --- @@ -305,8 +305,8 @@ end -- As long as any part of a line is selected, the entire line is eligible for -- commenting/uncommenting. -- @see comment_string --- @name block_comment -function M.block_comment() +-- @name toggle_comment +function M.toggle_comment() local comment = M.comment_string[buffer:get_lexer(true)] or '' local prefix, suffix = comment:match('^([^|]+)|?([^|]*)$') if not prefix then return end diff --git a/modules/textadept/keys.lua b/modules/textadept/keys.lua index f70a7027..90cb2000 100644 --- a/modules/textadept/keys.lua +++ b/modules/textadept/keys.lua @@ -312,7 +312,7 @@ local bindings = { [m_edit[_L['Match Brace']][2]] = {'ctrl+m', 'ctrl+m', 'meta+m'}, [m_edit[_L['Complete Word']][2]] = {'ctrl+\n', 'ctrl+esc', {'ctrl+meta+j', 'ctrl+\n'}}, - [textadept.editing.block_comment] = {'ctrl+/', 'ctrl+/', 'meta+/'}, + [textadept.editing.toggle_comment] = {'ctrl+/', 'ctrl+/', 'meta+/'}, [textadept.editing.transpose_chars] = {'ctrl+t', 'ctrl+t', 'ctrl+t'}, [textadept.editing.join_lines] = {'ctrl+J', 'ctrl+j', 'meta+j'}, [m_edit[_L['Filter Through']][2]] = {'ctrl+|', 'cmd+|', 'ctrl+\\'}, diff --git a/modules/textadept/menu.lua b/modules/textadept/menu.lua index 4d461abb..98f0f1cc 100644 --- a/modules/textadept/menu.lua +++ b/modules/textadept/menu.lua @@ -97,7 +97,7 @@ local default_menubar = { {_L['Complete Word'], function() textadept.editing.autocomplete('word') end}, - {_L['Toggle Block Comment'], textadept.editing.block_comment}, + {_L['Toggle Block Comment'], textadept.editing.toggle_comment}, {_L['Transpose Characters'], textadept.editing.transpose_chars}, {_L['Join Lines'], textadept.editing.join_lines}, {_L['Filter Through'], function() diff --git a/test/test.lua b/test/test.lua index 155a4a1e..e4e93604 100644 --- a/test/test.lua +++ b/test/test.lua @@ -1491,10 +1491,10 @@ function test_editing_paste_reindent_tabs_to_spaces() end expected_failure(test_editing_paste_reindent_tabs_to_spaces) -function test_editing_block_comment_lines() +function test_editing_toggle_comment_lines() buffer.new() buffer:add_text('foo') - textadept.editing.block_comment() + textadept.editing.toggle_comment() assert_equal(buffer:get_text(), 'foo') buffer:set_lexer('lua') local text = table.concat({ @@ -1505,7 +1505,7 @@ function test_editing_block_comment_lines() }, '\n') buffer:set_text(text) buffer:goto_pos(buffer:position_from_line(LINE(2))) - textadept.editing.block_comment() + textadept.editing.toggle_comment() assert_equal(buffer:get_text(), table.concat({ '', '--local foo = "bar"', @@ -1513,12 +1513,12 @@ function test_editing_block_comment_lines() '' }, '\n')) assert_equal(buffer.current_pos, buffer:position_from_line(LINE(2)) + 2) - textadept.editing.block_comment() -- uncomment + textadept.editing.toggle_comment() -- uncomment assert_equal(buffer:get_line(LINE(2)), 'local foo = "bar"\n') assert_equal(buffer.current_pos, buffer:position_from_line(LINE(2))) local offset = 5 buffer:set_sel(buffer:position_from_line(LINE(2)) + offset, buffer:position_from_line(LINE(4)) - offset) - textadept.editing.block_comment() + textadept.editing.toggle_comment() assert_equal(buffer:get_text(), table.concat({ '', '--local foo = "bar"', @@ -1527,7 +1527,7 @@ function test_editing_block_comment_lines() }, '\n')) assert_equal(buffer.selection_start, buffer:position_from_line(LINE(2)) + offset + 2) assert_equal(buffer.selection_end, buffer:position_from_line(LINE(4)) - offset) - textadept.editing.block_comment() -- uncomment + textadept.editing.toggle_comment() -- uncomment assert_equal(buffer:get_text(), table.concat({ '', 'local foo = "bar"', @@ -1542,7 +1542,7 @@ function test_editing_block_comment_lines() buffer:close(true) end -function test_editing_block_comment() +function test_editing_toggle_comment() buffer.new() buffer:set_lexer('ansi_c') buffer:set_text(table.concat({ @@ -1552,7 +1552,7 @@ function test_editing_block_comment() '' }, '\n')) buffer:set_sel(buffer:position_from_line(LINE(2)), buffer:position_from_line(LINE(4))) - textadept.editing.block_comment() + textadept.editing.toggle_comment() assert_equal(buffer:get_text(), table.concat({ '', ' /*const char *foo = "bar";*/', @@ -1561,7 +1561,7 @@ function test_editing_block_comment() }, '\n')) assert_equal(buffer.selection_start, buffer:position_from_line(LINE(2)) + 2) assert_equal(buffer.selection_end, buffer:position_from_line(LINE(4))) - textadept.editing.block_comment() -- uncomment + textadept.editing.toggle_comment() -- uncomment assert_equal(buffer:get_text(), table.concat({ '', ' const char *foo = "bar";', |