aboutsummaryrefslogtreecommitdiffhomepage
path: root/modules
diff options
context:
space:
mode:
authorGravatar mitchell <none@none>2021-11-05 12:30:41 -0400
committerGravatar mitchell <none@none>2021-11-05 12:30:41 -0400
commitd7b230840e6fbc493da8075218d55186d4dab4b6 (patch)
treeaec28045b2b14c8cbed291cadafe5f070cb188f7 /modules
parent3a825add3b5c2919ea2f88e027e45c2172575e1f (diff)
Added '`' to autopair and typeover.
Also, small code cleanup.
Diffstat (limited to 'modules')
-rw-r--r--modules/lua/ta_api6
-rw-r--r--modules/lua/ta_tags6
-rw-r--r--modules/textadept/editing.lua31
3 files changed, 24 insertions, 19 deletions
diff --git a/modules/lua/ta_api b/modules/lua/ta_api
index ea4d7cee..c3a6c99a 100644
--- a/modules/lua/ta_api
+++ b/modules/lua/ta_api
@@ -376,7 +376,7 @@ auto_c_stops buffer.auto_c_stops(buffer, chars)\nAllows the user to type any cha
auto_c_type_separator buffer.auto_c_type_separator (number)\nThe character byte that separates autocompletion and user list items and their image types.\nAutocompletion and user list items can display both an image and text. Register images\nand their types using `view.register_image()` or `view.register_rgba_image()`\nbefore appending image types to list items after type separator characters.\nThe default value is 63 ('?').
auto_enclose textadept.editing.auto_enclose (bool)\nWhether or not to auto-enclose selected text when typing a punctuation character, taking\n`textadept.editing.auto_pairs` into account.\nThe default value is `false`.
auto_indent textadept.editing.auto_indent (bool)\nMatch the previous line's indentation level after inserting a new line.\nThe default value is `true`.
-auto_pairs textadept.editing.auto_pairs (table)\nMap of auto-paired characters like parentheses, brackets, braces, and quotes.\nThe ASCII values of opening characters are assigned to strings that contain complement\ncharacters. The default auto-paired characters are "()", "[]", "{}", "''", and\n"""".
+auto_pairs textadept.editing.auto_pairs (table)\nMap of auto-paired characters like parentheses, brackets, braces, and quotes.\nThe ASCII values of opening characters are assigned to strings that contain complement\ncharacters. The default auto-paired characters are "()", "[]", "{}", "''",\n"""", and "``".
autocomplete textadept.editing.autocomplete(name)\nDisplays an autocompletion list provided by the autocompleter function associated with string\n*name*, and returns `true` if completions were found.\n@param name The name of an autocompleter function in the `autocompleters` table to use for\n providing autocompletions.\n@see autocompleters
autocomplete_all_words textadept.editing.autocomplete_all_words (bool)\nAutocomplete the current word using words from all open buffers.\nIf `true`, performance may be slow when many buffers are open.\nThe default value is `false`.
autocomplete_snippets _M.ansi_c.autocomplete_snippets (boolean)\nWhether or not to include snippets in autocompletion lists.\nThe default value is `true`.
@@ -392,7 +392,7 @@ brace_bad_light_indicator view.brace_bad_light_indicator(view, use_indicator, in
brace_highlight view.brace_highlight(view, pos1, pos2)\nHighlights the characters at positions *pos1* and *pos2* as matching braces using the\n`'style.bracelight'` style.\nIf indent guides are enabled, locates the column with `buffer.column` and sets\n`view.highlight_guide` in order to highlight the indent guide.\n@param view A view.\n@param pos1 The first position in *view*'s buffer to highlight.\n@param pos2 The second position in *view*'s buffer to highlight.
brace_highlight_indicator view.brace_highlight_indicator(view, use_indicator, indicator)\nHighlights matching brace characters with indicator number *indicator*, in the range of `1`\nto `32`, instead of the `view.STYLE_BRACELIGHT` style if *use_indicator* is `true`.\n@param view A view.\n@param use_indicator Whether or not to use an indicator.\n@param indicator The indicator number to use.
brace_match buffer.brace_match(buffer, pos, max_re_style)\nReturns the position of the matching brace for the brace character at position *pos*, taking\nnested braces into account, or `-1`.\nThe brace characters recognized are '(', ')', '[', ']', '{', '}', '<', and '>' and must have\nthe same style.\n@param buffer A buffer.\n@param pos The position of the brace in *buffer* to match.\n@param max_re_style Must be `0`. Reserved for expansion.\n@return number
-brace_matches textadept.editing.brace_matches (table)\nTable of brace characters to highlight.\nThe ASCII values of brace characters are keys and are assigned non-`nil` values. The default\nbrace characters are '(', ')', '[', ']', '{', and '}'.
+brace_matches textadept.editing.brace_matches (table)\nTable of brace characters to highlight.\nThe ASCII values of brace characters are keys and are assigned `true`. The default brace\ncharacters are '(', ')', '[', ']', '{', and '}'.
buffer _G.buffer (module)\nA Textadept buffer object.\nConstants are documented in the fields they apply to.\nWhile you can work with individual buffer instances, it is really only useful to work with\nthe global one.\nMany of these functions and fields are derived from buffer-specific functionality of the\nScintilla editing component, and additional information can be found on the [Scintilla\nwebsite](https://scintilla.org/ScintillaDoc.html). Note that with regard to Scintilla-specific\nfunctionality, this API is a _suggestion_, not a hard requirement. All of that functionality\nalso exists in `view`, even if undocumented.\nAny buffer fields set on startup (e.g. in *~/.textadept/init.lua*) will be the default,\ninitial values for all buffers.
buffer _G.buffer (table)\nThe current buffer in the current view.
buffer view.buffer (table)\nThe buffer the view currently contains. (Read-only)
@@ -980,7 +980,7 @@ toggle_fold view.toggle_fold(view, line)\nToggles the fold point on line number
toggle_fold_show_text view.toggle_fold_show_text(view, line, text)\nToggles a fold point on line number *line* between expanded (where all of its child lines are\ndisplayed) and contracted (where all of its child lines are hidden), and shows string *text*\nnext to that line.\n*text* is drawn with style number `view.STYLE_FOLDDISPLAYTEXT`.\n@param view A view.\n@param line The line number in *view* to toggle the fold on and display *text* after.\n@param text The text to display after the line.
token lexer.token(name, patt)\nCreates and returns a token pattern with token name *name* and pattern *patt*.\nIf *name* is not a predefined token name, its style must be defined via `lexer.add_style()`.\n@param name The name of token. If this name is not a predefined token name, then a style\n needs to be assiciated with it via `lexer.add_style()`.\n@param patt The LPeg pattern associated with the token.\n@usage local ws = token(lexer.WHITESPACE, lexer.space^1)\n@usage local annotation = token('annotation', '@' * lexer.word)\n@return pattern
transpose_chars textadept.editing.transpose_chars()\nTransposes characters intelligently.\nIf the caret is at the end of a line, transposes the two characters before the caret. Otherwise,\nthe characters to the left and right are.
-typeover_chars textadept.editing.typeover_chars (table)\nTable of characters to move over when typed.\nThe ASCII values of characters are keys and are assigned non-`nil` values. The default\ncharacters are ')', ']', '}', ''', and '"'.
+typeover_chars textadept.editing.typeover_chars (table)\nTable of characters to move over when typed.\nThe ASCII values of characters are keys and are assigned `true` values. The default characters\nare ')', ']', '}', ''', '"', and '`'.
ui _G.ui (module)\nUtilities for interacting with Textadept's user interface.
undo buffer.undo(buffer)\nUndoes the most recent action.\n@param buffer A buffer.
unsplit view.unsplit(view)\nUnsplits the view if possible, returning `true` on success.\n@param view The view to unsplit.\n@return boolean if the view was unsplit or not.
diff --git a/modules/lua/ta_tags b/modules/lua/ta_tags
index faef2e34..3d9864fd 100644
--- a/modules/lua/ta_tags
+++ b/modules/lua/ta_tags
@@ -378,7 +378,7 @@ auto_c_stops _HOME/core/.buffer.luadoc /^function auto_c_stops(buffer, chars) en
auto_c_type_separator _HOME/core/.buffer.luadoc /^module('buffer')$/;" F class:buffer
auto_enclose _HOME/modules/textadept/editing.lua /^module('textadept.editing')]]$/;" F class:textadept.editing
auto_indent _HOME/modules/textadept/editing.lua /^module('textadept.editing')]]$/;" F class:textadept.editing
-auto_pairs _HOME/modules/textadept/editing.lua /^M.auto_pairs = {[40] = ')', [91] = ']', [123] = '}', [39] = "'", [34] = '"'}$/;" t class:textadept.editing
+auto_pairs _HOME/modules/textadept/editing.lua /^M.auto_pairs = {}$/;" t class:textadept.editing
autocomplete _HOME/modules/textadept/editing.lua /^function M.autocomplete(name)$/;" f class:textadept.editing
autocomplete_all_words _HOME/modules/textadept/editing.lua /^module('textadept.editing')]]$/;" F class:textadept.editing
autocomplete_snippets _HOME/modules/ansi_c/init.lua /^module('_M.ansi_c')]]$/;" F class:_M.ansi_c
@@ -394,7 +394,7 @@ brace_bad_light_indicator _HOME/core/.view.luadoc /^function brace_bad_light_ind
brace_highlight _HOME/core/.view.luadoc /^function brace_highlight(view, pos1, pos2) end$/;" f class:view
brace_highlight_indicator _HOME/core/.view.luadoc /^function brace_highlight_indicator(view, use_indicator, indicator) end$/;" f class:view
brace_match _HOME/core/.buffer.luadoc /^function brace_match(buffer, pos, max_re_style) end$/;" f class:buffer
-brace_matches _HOME/modules/textadept/editing.lua /^M.brace_matches = {[40] = 1, [41] = 1, [91] = 1, [93] = 1, [123] = 1, [125] = 1}$/;" t class:textadept.editing
+brace_matches _HOME/modules/textadept/editing.lua /^M.brace_matches = {}$/;" t class:textadept.editing
buffer _HOME/core/.buffer.luadoc /^module('buffer')$/;" m
buffer _HOME/core/.view.luadoc /^local buffer$/;" t class:view
buffer _HOME/core/init.lua /^local buffer$/;" t
@@ -992,7 +992,7 @@ toggle_fold _HOME/core/.view.luadoc /^function toggle_fold(view, line) end$/;" f
toggle_fold_show_text _HOME/core/.view.luadoc /^function toggle_fold_show_text(view, line, text) end$/;" f class:view
token _HOME/lexers/lexer.lua /^function M.token(name, patt)$/;" f class:lexer
transpose_chars _HOME/modules/textadept/editing.lua /^function M.transpose_chars()$/;" f class:textadept.editing
-typeover_chars _HOME/modules/textadept/editing.lua /^M.typeover_chars = {[41] = 1, [93] = 1, [125] = 1, [39] = 1, [34] = 1}$/;" t class:textadept.editing
+typeover_chars _HOME/modules/textadept/editing.lua /^M.typeover_chars = {}$/;" t class:textadept.editing
ui _HOME/core/ui.lua /^module('ui')]]$/;" m
ui.command_entry _HOME/modules/textadept/command_entry.lua /^module('ui.command_entry')]]$/;" m
ui.dialogs _HOME/core/.ui.dialogs.luadoc /^module('ui.dialogs')$/;" m
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua
index d115d1e1..f4f46f37 100644
--- a/modules/textadept/editing.lua
+++ b/modules/textadept/editing.lua
@@ -83,32 +83,37 @@ M.comment_string = {actionscript='//',ada='--',apdl='!',ansi_c='/*|*/',antlr='//
---
-- Map of auto-paired characters like parentheses, brackets, braces, and quotes.
-- The ASCII values of opening characters are assigned to strings that contain complement
--- characters. The default auto-paired characters are "()", "[]", "{}", "&apos;&apos;", and
--- "&quot;&quot;".
+-- characters. The default auto-paired characters are "()", "[]", "{}", "&apos;&apos;",
+-- "&quot;&quot;", and "``".
-- @class table
-- @name auto_pairs
--- @usage textadept.editing.auto_pairs[60] = '>' -- pair '<' and '>'
+-- @usage textadept.editing.auto_pairs[string.byte('<')] = '>'
-- @usage textadept.editing.auto_pairs = nil -- disable completely
-M.auto_pairs = {[40] = ')', [91] = ']', [123] = '}', [39] = "'", [34] = '"'}
+M.auto_pairs = {}
+for k, v in pairs{['('] = ')', ['['] = ']', ['{'] = '}', ["'"] = "'", ['"'] = '"', ['`'] = '`'} do
+ M.auto_pairs[string.byte(k)] = v
+end
---
-- Table of brace characters to highlight.
--- The ASCII values of brace characters are keys and are assigned non-`nil` values. The default
--- brace characters are '(', ')', '[', ']', '{', and '}'.
+-- The ASCII values of brace characters are keys and are assigned `true`. The default brace
+-- characters are '(', ')', '[', ']', '{', and '}'.
-- @class table
-- @name brace_matches
--- @usage textadept.editing.brace_matches[60] = true -- '<'
--- @usage textadept.editing.brace_matches[62] = true -- '>'
-M.brace_matches = {[40] = 1, [41] = 1, [91] = 1, [93] = 1, [123] = 1, [125] = 1}
+-- @usage textadept.editing.brace_matches[string.byte('<')] = true
+-- @usage textadept.editing.brace_matches[string.byte('>')] = true
+M.brace_matches = {}
+for _, c in utf8.codes('()[]{}') do M.brace_matches[c] = true end
---
-- Table of characters to move over when typed.
--- The ASCII values of characters are keys and are assigned non-`nil` values. The default
--- characters are ')', ']', '}', '&apos;', and '&quot;'.
+-- The ASCII values of characters are keys and are assigned `true` values. The default characters
+-- are ')', ']', '}', '&apos;', '&quot;', and '`'.
-- @class table
-- @name typeover_chars
--- @usage textadept.editing.typeover_chars[62] = true -- '>'
-M.typeover_chars = {[41] = 1, [93] = 1, [125] = 1, [39] = 1, [34] = 1}
+-- @usage textadept.editing.typeover_chars[string.byte('>')] = true
+M.typeover_chars = {}
+for _, c in utf8.codes([[)]}'"`]]) do M.typeover_chars[c] = true end
---
-- Map of autocompleter names to autocompletion functions.