aboutsummaryrefslogtreecommitdiffhomepage
path: root/core
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+orbitalquark@users.noreply.github.com>2021-04-11 09:34:17 -0400
committerGravatar mitchell <70453897+orbitalquark@users.noreply.github.com>2021-04-11 09:34:17 -0400
commitde3a745e1af2e441de868c2aa4849102d376acb5 (patch)
treec2d7767600dc519b2613ddecaf7e53fb5e8867a2 /core
parent03fab17277fee7387fd93a9c2774b1ebf3f80fe4 (diff)
Initial pass reformatting all code.
Use clang-format, LuaFormatter, and 100 character limit on lines.
Diffstat (limited to 'core')
-rw-r--r--core/._M.luadoc92
-rw-r--r--core/.buffer.luadoc797
-rw-r--r--core/.iconv.luadoc27
-rw-r--r--core/.os.luadoc84
-rw-r--r--core/.ui.dialogs.luadoc588
-rw-r--r--core/.view.luadoc595
-rw-r--r--core/args.lua53
-rw-r--r--core/assert.lua48
-rw-r--r--core/events.lua184
-rw-r--r--core/file_io.lua173
-rw-r--r--core/iface.lua34
-rw-r--r--core/init.lua57
-rw-r--r--core/keys.lua144
-rw-r--r--core/lfs_ext.lua83
-rw-r--r--core/locale.conf114
-rw-r--r--core/locale.lua17
-rw-r--r--core/ui.lua350
17 files changed, 1504 insertions, 1936 deletions
diff --git a/core/._M.luadoc b/core/._M.luadoc
index 8f94a93d..b720d336 100644
--- a/core/._M.luadoc
+++ b/core/._M.luadoc
@@ -1,19 +1,16 @@
-- Copyright 2007-2020 Mitchell. See LICENSE.
--- This is a DUMMY FILE used for making LuaDoc for built-in functions in the
--- global _M table.
+-- This is a DUMMY FILE used for making LuaDoc for built-in functions in the global _M table.
---[[ This comment is for LuaDoc.
---
-- A table of loaded Textadept language modules.
--
--- Language modules are a special kind of module that Textadept automatically
--- loads when editing source code in a particular programming language. The only
--- thing "special" about them is they are named after a lexer. Otherwise they
--- are plain Lua modules. The *~/.textadept/modules/* directory houses language
--- modules (along with other modules).
+-- Language modules are a special kind of module that Textadept automatically loads when editing
+-- source code in a particular programming language. The only thing "special" about them is they
+-- are named after a lexer. Otherwise they are plain Lua modules. The *~/.textadept/modules/*
+-- directory houses language modules (along with other modules).
--
--- A language module is designed to provide extra functionality for a single
--- programming language. Some examples of what language modules can do:
+-- A language module is designed to provide extra functionality for a single programming
+-- language. Some examples of what language modules can do:
--
-- * Specify block comment syntax for lines of code
-- * Define compile and run commands for source files
@@ -27,31 +24,27 @@
--
-- ### Block Comment
--
--- Many languages have different syntaxes for single line comments and
--- multi-line comments in source code. Textadept's block comment feature only
--- uses one of those syntaxes for a given language. If you prefer the other
--- syntax, or if Textadept does not support block comments for a particular
--- language, modify the [`textadept.editing.comment_string`]() table. For
--- example:
+-- Many languages have different syntaxes for single line comments and multi-line comments in
+-- source code. Textadept's block comment feature only uses one of those syntaxes for a given
+-- language. If you prefer the other syntax, or if Textadept does not support block comments
+-- for a particular language, modify the [`textadept.editing.comment_string`]() table. For example:
--
-- textadept.editing.comment_string.ansi_c = '//' -- change from /* ... */
--
-- ### Compile and Run
--
--- Textadept knows most of the commands that compile and/or run code in source
--- files. However, it does not know all of them, and the ones that it does know
--- may not be completely accurate in all cases. Compile and run commands are
--- read from the [`textadept.run.compile_commands`]() and
--- [`textadept.run.run_commands`]() tables using the appropriate lexer name key,
--- and thus can be defined or modified. For Lua, it would look like:
+-- Textadept knows most of the commands that compile and/or run code in source files. However,
+-- it does not know all of them, and the ones that it does know may not be completely accurate
+-- in all cases. Compile and run commands are read from the [`textadept.run.compile_commands`]()
+-- and [`textadept.run.run_commands`]() tables using the appropriate lexer name key, and thus
+-- can be defined or modified. For Lua, it would look like:
--
-- textadept.run.compile_commands.lua = 'luac "%f"'
-- textadept.run.run_commands.lua = 'lua "%f"'
--
--- Double-clicking on compile or runtime errors jumps to the error's location.
--- If Textadept does not recognize your language's errors properly, add an error
--- pattern to [`textadept.run.error_patterns`](). The Lua error pattern looks
--- like:
+-- Double-clicking on compile or runtime errors jumps to the error's location. If
+-- Textadept does not recognize your language's errors properly, add an error pattern to
+-- [`textadept.run.error_patterns`](). The Lua error pattern looks like:
--
-- local patterns = textadept.run.error_patterns
-- if not patterns.lua then patterns.lua = {} end
@@ -59,31 +52,30 @@
--
-- ### Buffer Properties
--
--- By default, Textadept uses 2 spaces for indentation. Some languages have
--- different indentation guidelines, however. As described in the manual, use
--- `events.LEXER_LOADED` to change this and any other language-specific editor
--- properties. For example:
+-- By default, Textadept uses 2 spaces for indentation. Some languages have different indentation
+-- guidelines, however. As described in the manual, use `events.LEXER_LOADED` to change this
+-- and any other language-specific editor properties. For example:
--
-- events.connect(events.LEXER_LOADED, function(name)
-- if name ~= 'python' then return end
-- buffer.tab_width = 4
-- buffer.use_tabs = false
-- view.view_ws = view.WS_VISIBLEALWAYS
--- end
+-- end)
--
-- ### Autocompletion and Documentation
--
-- Textadept has the capability to autocomplete symbols for programming
-- languages and display API documentation. In order for these to work for a
--- given language, an [autocompleter](#textadept.editing.autocompleters) and
--- [API file(s)](#textadept.editing.api_files) must exist. All of Textadept's
--- included language modules have examples of autocompleters and API
--- documentation, as well as most of its officially supported language modules.
+-- given language, an [autocompleter](#textadept.editing.autocompleters) and [API
+-- file(s)](#textadept.editing.api_files) must exist. All of Textadept's included language
+-- modules have examples of autocompleters and API documentation, as well as most of its
+-- officially supported language modules.
--
-- ### Snippets
--
--- [Snippets](#textadept.snippets) for common language constructs are useful.
--- Some snippets for common Lua control structures look like this:
+-- [Snippets](#textadept.snippets) for common language constructs are useful. Some snippets
+-- for common Lua control structures look like this:
--
-- snippets.lua = {
-- f = "function %1(name)(%2(args))\n\t%0\nend",
@@ -94,10 +86,10 @@
--
-- ### Commands
--
--- Additional editing features for the language can be useful. For example, a
--- C++ module might have a feature to add a ';' to the end of the current line
--- and insert a new line. This command could be bound to the `Shift+Enter` (`⇧↩`
--- on macOS | `S-Enter` in the terminal version) key for easy access:
+-- Additional editing features for the language can be useful. For example, a C++ module might
+-- have a feature to add a ';' to the end of the current line and insert a new line. This command
+-- could be bound to the `Shift+Enter` (`⇧↩` on macOS | `S-Enter` in the terminal version)
+-- key for easy access:
--
-- keys.cpp['shift+\n'] = function()
-- buffer:line_end()
@@ -105,12 +97,11 @@
-- buffer:new_line()
-- end
--
--- When defining key bindings for other commands, you may make use of a `Ctrl+L`
--- (`⌘L` on macOS | `M-L` in the terminal version) keychain. Traditionally this
--- prefix has been reserved for use by language modules (although neither
--- Textadept nor its modules utilize it at the moment). Users may define this
--- keychain for new or existing modules and it will not conflict with any
--- default key bindings. For example:
+-- When defining key bindings for other commands, you may make use of a `Ctrl+L` (`⌘L` on
+-- macOS | `M-L` in the terminal version) keychain. Traditionally this prefix has been reserved
+-- for use by language modules (although neither Textadept nor its modules utilize it at the
+-- moment). Users may define this keychain for new or existing modules and it will not conflict
+-- with any default key bindings. For example:
--
-- keys.lua[CURSES and 'meta+l' or OSX and 'cmd+l' or 'ctrl+l'] = {
-- ...
@@ -118,9 +109,8 @@
--
-- ### Menus
--
--- It may be useful to add language-specific menu options to the top-level menu
--- and/or right-click context menu in order to access module features without
--- using key bindings. For example:
+-- It may be useful to add language-specific menu options to the top-level menu and/or right-click
+-- context menu in order to access module features without using key bindings. For example:
--
-- local lua_menu = {
-- title = 'Lua',
@@ -130,4 +120,4 @@
-- local tools = textadept.menu.menubar[_L['Tools']]
-- tools[#tools + 1] = lua_menu
-- textadept.menu.context_menu[#textadept.menu.context_menu + 1] = lua_menu
-module('_M')]]
+module('_M')
diff --git a/core/.buffer.luadoc b/core/.buffer.luadoc
index e2d45e71..8a136a3a 100644
--- a/core/.buffer.luadoc
+++ b/core/.buffer.luadoc
@@ -4,17 +4,15 @@
---
-- A Textadept buffer object.
-- Constants are documented in the fields they apply to.
--- While you can work with individual buffer instances, it is really only useful
--- to work with the global one.
--- Many of these functions and fields are derived from buffer-specific
--- functionality of the Scintilla editing component, and additional information
--- can be found on the
--- [Scintilla website](https://scintilla.org/ScintillaDoc.html).
--- Note that with regard to Scintilla-specific functionality, this API is a
--- _suggestion_, not a hard requirement. All of that functionality also exists
--- in [`view`](), even if undocumented.
--- Any buffer fields set on startup (e.g. in *~/.textadept/init.lua*) will be
--- the default, initial values for all buffers.
+-- While you can work with individual buffer instances, it is really only useful to work with
+-- the global one.
+-- Many of these functions and fields are derived from buffer-specific functionality of the
+-- Scintilla editing component, and additional information can be found on the [Scintilla
+-- website](https://scintilla.org/ScintillaDoc.html). Note that with regard to Scintilla-specific
+-- functionality, this API is a _suggestion_, not a hard requirement. All of that functionality
+-- also exists in [`view`](), even if undocumented.
+-- Any buffer fields set on startup (e.g. in *~/.textadept/init.lua*) will be the default,
+-- initial values for all buffers.
-- @field additional_selection_typing (bool)
-- Type into multiple selections.
-- The default value is `false`.
@@ -24,17 +22,16 @@
-- Table of the number of annotation text lines per line number.
-- @field annotation_style (table)
-- Table of style numbers for annotation text per line number.
--- Only some style attributes are active in annotations: font,
--- size/size_fractional, bold/weight, italics, fore, back, and character_set.
+-- Only some style attributes are active in annotations: font, size/size_fractional, bold/weight,
+-- italics, fore, back, and character_set.
-- @field annotation_text (table)
-- Table of annotation text per line number.
-- @field auto_c_auto_hide (bool)
--- Automatically cancel an autocompletion or user list when no entries match
--- typed text.
+-- Automatically cancel an autocompletion or user list when no entries match typed text.
-- The default value is `true`.
-- @field auto_c_cancel_at_start (bool)
--- Cancel an autocompletion list when backspacing to a position before where
--- autocompletion started (instead of before the word being completed).
+-- Cancel an autocompletion list when backspacing to a position before where autocompletion
+-- started (instead of before the word being completed).
-- This option has no effect for a user list.
-- The default value is `true`.
-- @field auto_c_case_insensitive_behavior (number)
@@ -59,8 +56,8 @@
-- Delete any word characters immediately to the right of autocompleted text.
-- The default value is `false`.
-- @field auto_c_fill_ups (string, Write-only)
--- The set of characters that choose the currently selected item in an
--- autocompletion or user list when the user types one of them.
+-- The set of characters that choose the currently selected item in an autocompletion or user
+-- list when the user types one of them.
-- The default value is `''`.
-- @field auto_c_ignore_case (bool)
-- Ignore case when searching an autocompletion or user list for matches.
@@ -78,8 +75,7 @@
-- The order setting for autocompletion and user lists.
--
-- * `buffer.ORDER_PRESORTED`
--- Lists passed to [`buffer.auto_c_show()`]() are in sorted, alphabetical
--- order.
+-- Lists passed to [`buffer.auto_c_show()`]() are in sorted, alphabetical order.
-- * `buffer.ORDER_PERFORMSORT`
-- Sort autocompletion lists passed to [`buffer.auto_c_show()`]().
-- * `buffer.ORDER_CUSTOM`
@@ -87,16 +83,13 @@
--
-- The default value is `buffer.ORDER_PRESORTED`.
-- @field auto_c_separator (number)
--- The byte value of the character that separates autocompletion and user list
--- list items.
+-- The byte value of the character that separates autocompletion and user list list items.
-- The default value is `32` (' ').
-- @field auto_c_type_separator (number)
--- The character byte that separates autocompletion and user list items and
--- their image types.
--- Autocompletion and user list items can display both an image and text.
--- Register images and their types using [`view.register_image()`]() or
--- [`view.register_rgba_image()`]() before appending image types to list
--- items after type separator characters.
+-- The character byte that separates autocompletion and user list items and their image types.
+-- Autocompletion and user list items can display both an image and text. Register images
+-- and their types using [`view.register_image()`]() or [`view.register_rgba_image()`]()
+-- before appending image types to list items after type separator characters.
-- The default value is 63 ('?').
-- @field back_space_un_indents (bool)
-- Un-indent text when backspacing within indentation.
@@ -107,11 +100,10 @@
-- * `buffer.CARETSTICKY_OFF`
-- Use the same position the caret had on the previous line.
-- * `buffer.CARETSTICKY_ON`
--- Use the last position the caret was moved to via the mouse, left/right
--- arrow keys, home/end keys, etc. Typing text does not affect the position.
+-- Use the last position the caret was moved to via the mouse, left/right arrow keys,
+-- home/end keys, etc. Typing text does not affect the position.
-- * `buffer.CARETSTICKY_WHITESPACE`
--- Use the position the caret had on the previous line, but prior to any
--- inserted indentation.
+-- Use the position the caret had on the previous line, but prior to any inserted indentation.
--
-- The default value is `buffer.CARETSTICKY_OFF`.
-- @field char_at (table, Read-only)
@@ -125,18 +117,17 @@
-- @field encoding (string or nil)
-- The string encoding of the file, or `nil` for binary files.
-- @field end_styled (number, Read-only)
--- The current styling position or the last correctly styled character's
--- position.
+-- The current styling position or the last correctly styled character's position.
-- @field eol_annotation_style (table)
-- Table of style numbers for EOL annotation text per line number.
--- Only some style attributes are active in annotations: font,
--- size/size_fractional, bold/weight, italics, fore, back, and character_set.
+-- Only some style attributes are active in annotations: font, size/size_fractional, bold/weight,
+-- italics, fore, back, and character_set.
-- @field eol_annotation_text (table)
-- Table of EOL annotation text per line number.
-- @field eol_mode (number)
--- The current end of line mode. Changing the current mode does not convert
--- any of the buffer's existing end of line characters.
--- Use [`buffer.convert_eols()`]() to do so.
+-- The current end of line mode.
+-- Changing the current mode does not convert any of the buffer's existing end of line
+-- characters. Use [`buffer.convert_eols()`]() to do so.
--
-- * `buffer.EOL_CRLF`
-- Carriage return with line feed ("\r\n").
@@ -145,14 +136,12 @@
-- * `buffer.EOL_LF`
-- Line feed ("\n").
--
--- The default value is `buffer.EOL_CRLF` on Windows platforms,
--- `buffer.EOL_LF` otherwise.
+-- The default value is `buffer.EOL_CRLF` on Windows platforms, `buffer.EOL_LF` otherwise.
-- @field filename (string)
-- The absolute file path associated with the buffer.
-- @field fold_level (table)
-- Table of fold level bit-masks per line number.
--- Fold level masks comprise of an integer level combined with any of the
--- following bit flags:
+-- Fold level masks comprise of an integer level combined with any of the following bit flags:
--
-- * `buffer.FOLDLEVELBASE`
-- The initial fold level.
@@ -167,17 +156,16 @@
-- The number of spaces in one level of indentation.
-- The default value is `0`, which uses the value of [`buffer.tab_width`]().
-- @field indicator_current (number)
--- The indicator number in the range of `1` to `32` used by
--- [`buffer.indicator_fill_range()`]() and
--- [`buffer.indicator_clear_range()`]().
+-- The indicator number in the range of `1` to `32` used by [`buffer.indicator_fill_range()`]()
+-- and [`buffer.indicator_clear_range()`]().
-- @field length (number, Read-only)
-- The number of bytes in the buffer.
-- @field line_count (number, Read-only)
-- The number of lines in the buffer.
-- There is always at least one.
-- @field line_end_position (table, Read-only)
--- Table of positions at the ends of lines, but before any end of line
--- characters, per line number.
+-- Table of positions at the ends of lines, but before any end of line characters, per
+-- line number.
-- @field line_indent_position (table, Read-only)
-- Table of positions at the ends of indentation per line number.
-- @field line_indentation (table)
@@ -189,8 +177,8 @@
-- Table of text displayed in text margins per line number.
-- @field margin_style (table)
-- Table of style numbers in the text margin per line number.
--- Only some style attributes are active in text margins: font, size, bold,
--- italics, fore, and back.
+-- Only some style attributes are active in text margins: font, size, bold, italics, fore,
+-- and back.
-- @field modify (bool, Read-only)
-- Whether or not the buffer has unsaved changes.
-- @field move_extends_selection (bool, Read-only)
@@ -214,8 +202,7 @@
-- @field punctuation_chars (string)
-- The string set of characters recognized as punctuation characters.
-- Set this only after setting [`buffer.word_chars`]().
--- The default value is a string that contains all non-word and non-whitespace
--- characters.
+-- The default value is a string that contains all non-word and non-whitespace characters.
-- @field read_only (bool)
-- Whether or not the buffer is read-only.
-- The default value is `false`.
@@ -235,8 +222,7 @@
-- * `buffer.FIND_MATCHCASE`
-- Match search text case sensitively.
-- * `buffer.FIND_WORDSTART`
--- Match search text only when the previous character is a non-word
--- character.
+-- Match search text only when the previous character is a non-word character.
-- * `buffer.FIND_REGEXP`
-- Interpret search text as a regular expression.
--
@@ -258,36 +244,33 @@
-- * `buffer.SEL_LINES`
-- Line selection.
-- * `buffer.SEL_THIN`
--- Thin rectangular selection. This is the mode after a rectangular
--- selection has been typed into and ensures that no characters are
--- selected.
+-- Thin rectangular selection. This is the mode after a rectangular selection has been
+-- typed into and ensures that no characters are selected.
--
--- When set, caret movement alters the selected text until this field is set
--- again to the same value or until [`buffer.cancel()`]() is called.
+-- When set, caret movement alters the selected text until this field is set again to the
+-- same value or until [`buffer.cancel()`]() is called.
-- @field selection_n_anchor (table)
--- Table of positions at the beginning of existing selections numbered from
--- `1`, the main selection.
+-- Table of positions at the beginning of existing selections numbered from `1`, the main
+-- selection.
-- @field selection_n_anchor_virtual_space (table)
--- Table of positions at the beginning of virtual space selected in existing
--- selections numbered from `1`, the main selection.
+-- Table of positions at the beginning of virtual space selected in existing selections
+-- numbered from `1`, the main selection.
-- @field selection_n_caret (table)
--- Table of positions at the end of existing selections numbered from `1`,
--- the main selection.
+-- Table of positions at the end of existing selections numbered from `1`, the main selection.
-- @field selection_n_caret_virtual_space (table)
--- Table of positions at the end of virtual space selected in existing
--- selections numbered from `1`, the main selection.
+-- Table of positions at the end of virtual space selected in existing selections numbered from
+-- `1`, the main selection.
-- @field selection_n_end (table)
--- Table of positions at the end of existing selections numbered from `1`,
--- the main selection.
+-- Table of positions at the end of existing selections numbered from `1`, the main selection.
-- @field selection_n_start (table)
--- Table of positions at the beginning of existing selections numbered from
--- `1`, the main selection.
+-- Table of positions at the beginning of existing selections numbered from `1`, the main
+-- selection.
-- @field selection_n_end_virtual_space (number, Read-only)
--- Table of positions at the end of virtual space selected in existing
--- selections numbered from `1`, the main selection.
+-- Table of positions at the end of virtual space selected in existing selections numbered from
+-- `1`, the main selection.
-- @field selection_n_start_virtual_space (number, Read-only)
--- Table of positions at the beginning of virtual space selected in existing
--- selections numbered from `1`, the main selection.
+-- Table of positions at the beginning of virtual space selected in existing selections
+-- numbered from `1`, the main selection.
-- @field selection_start (number)
-- The position of the beginning of the selected text.
-- When set, becomes the anchor, but is not scrolled into view.
@@ -310,24 +293,22 @@
-- This is also set by a successful [`buffer.search_in_target()`]().
-- @field target_end_virtual_space (number)
-- The position of the end of virtual space in the target range.
--- This is set to `1` when [`buffer.target_start`]() or
--- [`buffer.target_end`]() is set, or when [`buffer.set_target_range()`]() is
--- called.
+-- This is set to `1` when [`buffer.target_start`]() or [`buffer.target_end`]() is set,
+-- or when [`buffer.set_target_range()`]() is called.
-- @field target_start (number)
-- The position of the beginning of the target range.
-- This is also set by a successful [`buffer.search_in_target()`]().
-- @field target_start_virtual_space (number)
-- The position of the beginning of virtual space in the target range.
--- This is set to `1` when [`buffer.target_start`]() or
--- [`buffer.target_end`]() is set, or when [`buffer.set_target_range()`]() is
--- called.
+-- This is set to `1` when [`buffer.target_start`]() or [`buffer.target_end`]() is set,
+-- or when [`buffer.set_target_range()`]() is called.
-- @field target_text (string, Read-only)
-- The text in the target range.
-- @field text_length (number, Read-only)
-- The number of bytes in the buffer.
-- @field use_tabs (bool)
--- Use tabs instead of spaces in indentation. Changing the current setting
--- does not convert any of the buffer's existing indentation. Use
+-- Use tabs instead of spaces in indentation.
+-- Changing the current setting does not convert any of the buffer's existing indentation. Use
-- [`textadept.editing.convert_indentation()`]() to do so.
-- The default value is `true`.
-- @field virtual_space_options (number)
@@ -340,23 +321,21 @@
-- * `buffer.VS_USERACCESSIBLE`
-- Enable virtual space.
-- * `buffer.VS_NOWRAPLINESTART`
--- Prevent the caret from wrapping to the previous line via
--- `buffer:char_left()` and `buffer:char_left_extend()`. This option is not
--- restricted to virtual space and should be added to any of the above
--- options.
+-- Prevent the caret from wrapping to the previous line via `buffer:char_left()` and
+-- `buffer:char_left_extend()`. This option is not restricted to virtual space and should
+-- be added to any of the above options.
--
--- When virtual space is enabled, the caret may move into the space past end
--- of line characters.
+-- When virtual space is enabled, the caret may move into the space past end of line characters.
-- The default value is `buffer.VS_NONE`.
-- @field whitespace_chars (string)
-- The string set of characters recognized as whitespace characters.
-- Set this only after setting [`buffer.word_chars`]().
--- The default value is a string that contains all non-newline characters less
--- than ASCII value 33.
+-- The default value is a string that contains all non-newline characters less than ASCII
+-- value 33.
-- @field word_chars (string)
-- The string set of characters recognized as word characters.
--- The default value is a string that contains alphanumeric characters, an
--- underscore, and all characters greater than ASCII value 127.
+-- The default value is a string that contains alphanumeric characters, an underscore, and
+-- all characters greater than ASCII value 127.
-- @field FIND_MATCHCASE (number, Read-only)
--
-- @field FIND_REGEXP (number, Read-only)
@@ -444,21 +423,19 @@
module('buffer')
---
--- Selects the range of text between positions *start_pos* to *end_pos* as the
--- main selection, retaining all other selections as additional selections.
--- Since an empty selection (i.e. the current position) still counts as a
--- selection, use `buffer.set_selection()` first when setting a list of
--- selections.
+-- Selects the range of text between positions *start_pos* to *end_pos* as the main selection,
+-- retaining all other selections as additional selections.
+-- Since an empty selection (i.e. the current position) still counts as a selection, use
+-- `buffer.set_selection()` first when setting a list of selections.
-- @param buffer A buffer.
-- @param end_pos The caret position of the range of text to select in *buffer*.
--- @param start_pos The anchor position of the range of text to select in
--- *buffer*.
+-- @param start_pos The anchor position of the range of text to select in *buffer*.
-- @see set_selection
function add_selection(buffer, end_pos, start_pos) end
---
--- Adds string *text* to the buffer at the caret position and moves the caret to
--- the end of the added text without scrolling it into view.
+-- Adds string *text* to the buffer at the caret position and moves the caret to the end of
+-- the added text without scrolling it into view.
-- @param buffer A buffer.
-- @param text The text to add.
function add_text(buffer, text) end
@@ -469,8 +446,8 @@ function add_text(buffer, text) end
function annotation_clear_all(buffer) end
---
--- Appends string *text* to the end of the buffer without modifying any existing
--- selections or scrolling the text into view.
+-- Appends string *text* to the end of the buffer without modifying any existing selections or
+-- scrolling the text into view.
-- @param buffer A buffer.
-- @param text The text to append.
function append_text(buffer, text) end
@@ -492,42 +469,38 @@ function auto_c_cancel(buffer) end
function auto_c_complete(buffer) end
---
--- Returns the position where autocompletion started or where a user list was
--- shown.
+-- Returns the position where autocompletion started or where a user list was shown.
-- @param buffer A buffer.
-- @return number
function auto_c_pos_start(buffer) end
---
--- Selects the first item that starts with string *prefix* in an autocompletion
--- or user list, using the case sensitivity setting `buffer.auto_c_ignore_case`.
+-- Selects the first item that starts with string *prefix* in an autocompletion or user list,
+-- using the case sensitivity setting `buffer.auto_c_ignore_case`.
-- @param buffer A buffer.
-- @param prefix The item in the list to select.
function auto_c_select(buffer, prefix) end
---
--- Displays an autocompletion list constructed from string *items* (whose items
--- are delimited by `buffer.auto_c_separator` characters) using *len_entered*
--- number of characters behind the caret as the prefix of the word to be
--- autocompleted.
--- The sorted order of *items* (`buffer.auto_c_order`) must have already been
--- defined.
+-- Displays an autocompletion list constructed from string *items* (whose items are delimited by
+-- `buffer.auto_c_separator` characters) using *len_entered* number of characters behind the
+-- caret as the prefix of the word to be autocompleted.
+-- The sorted order of *items* (`buffer.auto_c_order`) must have already been defined.
-- @param buffer A buffer.
--- @param len_entered The number of characters before the caret used to provide
--- the context.
--- @param items The sorted string of words to show, separated by
--- `buffer.auto_c_separator` characters (initially spaces).
+-- @param len_entered The number of characters before the caret used to provide the context.
+-- @param items The sorted string of words to show, separated by `buffer.auto_c_separator`
+-- characters (initially spaces).
-- @see auto_c_separator
-- @see auto_c_order
function auto_c_show(buffer, len_entered, items) end
---
--- Allows the user to type any character in string set *chars* in order to
--- cancel an autocompletion or user list.
+-- Allows the user to type any character in string set *chars* in order to cancel an autocompletion
+-- or user list.
-- The default set is empty.
-- @param buffer A buffer.
--- @param chars The string of characters that cancel autocompletion. This string
--- is empty by default.
+-- @param chars The string of characters that cancel autocompletion. This string is empty
+-- by default.
function auto_c_stops(buffer, chars) end
---
@@ -542,10 +515,10 @@ function back_tab(buffer) end
function begin_undo_action(buffer) end
---
--- Returns the position of the matching brace for the brace character at
--- position *pos*, taking nested braces into account, or `-1`.
--- The brace characters recognized are '(', ')', '[', ']', '{', '}', '<', and
--- '>' and must have the same style.
+-- Returns the position of the matching brace for the brace character at position *pos*, taking
+-- nested braces into account, or `-1`.
+-- The brace characters recognized are '(', ')', '[', ']', '{', '}', '<', and '>' and must have
+-- the same style.
-- @param buffer A buffer.
-- @param pos The position of the brace in *buffer* to match.
-- @param max_re_style Must be `0`. Reserved for expansion.
@@ -565,8 +538,7 @@ function can_redo(buffer) end
function can_undo(buffer) end
---
--- Cancels the active selection mode, autocompletion or user list, call tip,
--- etc.
+-- Cancels the active selection mode, autocompletion or user list, call tip, etc.
-- @param buffer A buffer.
function cancel(buffer) end
@@ -576,14 +548,12 @@ function cancel(buffer) end
function char_left(buffer) end
---
--- Moves the caret left one character, extending the selected text to the new
--- position.
+-- Moves the caret left one character, extending the selected text to the new position.
-- @param buffer A buffer.
function char_left_extend(buffer) end
---
--- Moves the caret left one character, extending the rectangular selection to
--- the new position.
+-- Moves the caret left one character, extending the rectangular selection to the new position.
-- @param buffer A buffer.
function char_left_rect_extend(buffer) end
@@ -593,20 +563,18 @@ function char_left_rect_extend(buffer) end
function char_right(buffer) end
---
--- Moves the caret right one character, extending the selected text to the new
--- position.
+-- Moves the caret right one character, extending the selected text to the new position.
-- @param buffer A buffer.
function char_right_extend(buffer) end
---
--- Moves the caret right one character, extending the rectangular selection to
--- the new position.
+-- Moves the caret right one character, extending the rectangular selection to the new position.
-- @param buffer A buffer.
function char_right_rect_extend(buffer) end
---
--- Identifies the current horizontal caret position as the caret's preferred
--- horizontal position when moving between lines.
+-- Identifies the current horizontal caret position as the caret's preferred horizontal position
+-- when moving between lines.
-- @param buffer A buffer.
-- @see caret_sticky
function choose_caret_x(buffer) end
@@ -627,14 +595,13 @@ function clear_all(buffer) end
function clear_document_style(buffer) end
---
--- Instructs the lexer to style and mark fold points in the range of text
--- between *start_pos* and *end_pos*.
+-- Instructs the lexer to style and mark fold points in the range of text between *start_pos*
+-- and *end_pos*.
-- If *end_pos* is `-1`, styles and marks to the end of the buffer.
-- @param buffer A buffer.
--- @param start_pos The start position of the range of text in *buffer* to
--- process.
--- @param end_pos The end position of the range of text in *buffer* to process,
--- or `-1` to process from *start_pos* to the end of *buffer*.
+-- @param start_pos The start position of the range of text in *buffer* to process.
+-- @param end_pos The end position of the range of text in *buffer* to process, or `-1` to
+-- process from *start_pos* to the end of *buffer*.
function colorize(buffer, start_pos, end_pos) end
---
@@ -648,15 +615,13 @@ function convert_eols(buffer, mode) end
---
-- Copies the selected text to the clipboard.
--- Multiple selections are copied in order with no delimiters. Rectangular
--- selections are copied from top to bottom with end of line characters. Virtual
--- space is not copied.
+-- Multiple selections are copied in order with no delimiters. Rectangular selections are copied
+-- from top to bottom with end of line characters. Virtual space is not copied.
-- @param buffer A buffer.
function copy(buffer) end
---
--- Copies to the clipboard the range of text between positions *start_pos* and
--- *end_pos*.
+-- Copies to the clipboard the range of text between positions *start_pos* and *end_pos*.
-- @param buffer A buffer.
-- @param start_pos The start position of the range of text in *buffer* to copy.
-- @param end_pos The end position of the range of text in *buffer* to copy.
@@ -669,27 +634,23 @@ function copy_range(buffer, start_pos, end_pos) end
function copy_text(buffer, text) end
---
--- Returns the number of whole characters (taking multi-byte characters into
--- account) between positions *start_pos* and *end_pos*.
+-- Returns the number of whole characters (taking multi-byte characters into account) between
+-- positions *start_pos* and *end_pos*.
-- @param buffer A buffer.
--- @param start_pos The start position of the range of text in *buffer* to start
--- counting at.
--- @param end_pos The end position of the range of text in *buffer* to stop
--- counting at.
+-- @param start_pos The start position of the range of text in *buffer* to start counting at.
+-- @param end_pos The end position of the range of text in *buffer* to stop counting at.
-- @return number
function count_characters(buffer, start_pos, end_pos) end
---
-- Cuts the selected text to the clipboard.
--- Multiple selections are copied in order with no delimiters. Rectangular
--- selections are copied from top to bottom with end of line characters. Virtual
--- space is not copied.
+-- Multiple selections are copied in order with no delimiters. Rectangular selections are copied
+-- from top to bottom with end of line characters. Virtual space is not copied.
-- @param buffer A buffer.
function cut(buffer) end
---
--- Deletes the range of text from the caret to the beginning of the current
--- line.
+-- Deletes the range of text from the caret to the beginning of the current line.
-- @param buffer A buffer.
function del_line_left(buffer) end
@@ -699,22 +660,19 @@ function del_line_left(buffer) end
function del_line_right(buffer) end
---
--- Deletes the word to the left of the caret, including any leading non-word
--- characters.
+-- Deletes the word to the left of the caret, including any leading non-word characters.
-- `buffer.word_chars` contains the set of characters that constitute words.
-- @param buffer A buffer.
function del_word_left(buffer) end
---
--- Deletes the word to the right of the caret, including any trailing non-word
--- characters.
+-- Deletes the word to the right of the caret, including any trailing non-word characters.
-- `buffer.word_chars` contains the set of characters that constitute words.
-- @param buffer A buffer.
function del_word_right(buffer) end
---
--- Deletes the word to the right of the caret, excluding any trailing non-word
--- characters.
+-- Deletes the word to the right of the caret, excluding any trailing non-word characters.
-- `buffer.word_chars` contains the set of characters that constitute words.
-- @param buffer A buffer.
function del_word_right_end(buffer) end
@@ -726,8 +684,8 @@ function del_word_right_end(buffer) end
function delete_back(buffer) end
---
--- Deletes the character behind the caret unless either the caret is at the
--- beginning of a line or text is selected.
+-- Deletes the character behind the caret unless either the caret is at the beginning of a line
+-- or text is selected.
-- If text is selected, deletes it.
-- @param buffer A buffer.
function delete_back_not_line(buffer) end
@@ -745,8 +703,7 @@ function delete_range(buffer, pos, length) end
function document_end(buffer) end
---
--- Moves the caret to the end of the buffer, extending the selected text to the
--- new position.
+-- Moves the caret to the end of the buffer, extending the selected text to the new position.
-- @param buffer A buffer.
function document_end_extend(buffer) end
@@ -756,8 +713,7 @@ function document_end_extend(buffer) end
function document_start(buffer) end
---
--- Moves the caret to the beginning of the buffer, extending the selected text
--- to the new position.
+-- Moves the caret to the beginning of the buffer, extending the selected text to the new position.
-- @param buffer A buffer.
function document_start_extend(buffer) end
@@ -788,9 +744,8 @@ function end_undo_action(buffer) end
function eol_annotation_clear_all(buffer) end
---
--- Returns the position of column number *column* on line number *line* (taking
--- tab and multi-byte characters into account), or the position at the end of
--- line *line*.
+-- Returns the position of column number *column* on line number *line* (taking tab and multi-byte
+-- characters into account), or the position at the end of line *line*.
-- @param buffer A buffer.
-- @param line The line number in *buffer* to use.
-- @param column The column number to use.
@@ -803,8 +758,8 @@ function find_column(buffer, line, column) end
function get_cur_line(buffer) end
---
--- Returns the line number of the last line after line number *line* whose fold
--- level is greater than *level*.
+-- Returns the line number of the last line after line number *line* whose fold level is greater
+-- than *level*.
-- If *level* is `-1`, returns the level of *line*.
-- @param buffer A buffer.
-- @param line The line number in *buffer* of a header line.
@@ -820,9 +775,8 @@ function get_line(buffer, line) end
---
-- Returns the selected text.
--- Multiple selections are included in order with no delimiters. Rectangular
--- selections are included from top to bottom with end of line characters.
--- Virtual space is not included.
+-- Multiple selections are included in order with no delimiters. Rectangular selections are
+-- included from top to bottom with end of line characters. Virtual space is not included.
-- @param buffer A buffer.
-- @return string, number
function get_sel_text(buffer) end
@@ -833,8 +787,8 @@ function get_sel_text(buffer) end
function get_text(buffer) end
---
--- Moves the caret to the beginning of line number *line* and scrolls it into
--- view, event if *line* is hidden.
+-- Moves the caret to the beginning of line number *line* and scrolls it into view, event if
+-- *line* is hidden.
-- @param buffer A buffer.
-- @param line The line number in *buffer* to go to.
function goto_line(buffer, line) end
@@ -856,26 +810,26 @@ function home(buffer) end
function home_display(buffer) end
---
--- Moves the caret to the beginning of the current wrapped line, extending the
--- selected text to the new position.
+-- Moves the caret to the beginning of the current wrapped line, extending the selected text
+-- to the new position.
-- @param buffer A buffer.
function home_display_extend(buffer) end
---
--- Moves the caret to the beginning of the current line, extending the selected
--- text to the new position.
+-- Moves the caret to the beginning of the current line, extending the selected text to the
+-- new position.
-- @param buffer A buffer.
function home_extend(buffer) end
---
--- Moves the caret to the beginning of the current line, extending the
--- rectangular selection to the new position.
+-- Moves the caret to the beginning of the current line, extending the rectangular selection
+-- to the new position.
-- @param buffer A buffer.
function home_rect_extend(buffer) end
---
--- Moves the caret to the beginning of the current wrapped line or, if already
--- there, to the beginning of the actual line.
+-- Moves the caret to the beginning of the current wrapped line or, if already there, to the
+-- beginning of the actual line.
-- @param buffer A buffer.
function home_wrap(buffer) end
@@ -886,26 +840,23 @@ function home_wrap_extend(buffer) end
---
-- Returns a bit-mask that represents which indicators are on at position *pos*.
--- The first bit is set if indicator 1 is on, the second bit for indicator 2,
--- etc.
+-- The first bit is set if indicator 1 is on, the second bit for indicator 2, etc.
-- @param buffer A buffer.
-- @param pos The position in *buffer* to get indicators at.
-- @return number
function indicator_all_on_for(buffer, pos) end
---
--- Clears indicator number `buffer.indicator_current` over the range of text
--- from position *pos* to *pos* + *length*.
+-- Clears indicator number `buffer.indicator_current` over the range of text from position *pos*
+-- to *pos* + *length*.
-- @param buffer A buffer.
--- @param pos The start position of the range of text in *buffer* to clear
--- indicators over.
--- @param length The number of characters in the range of text to clear
--- indicators over.
+-- @param pos The start position of the range of text in *buffer* to clear indicators over.
+-- @param length The number of characters in the range of text to clear indicators over.
function indicator_clear_range(buffer, pos, length) end
---
--- Returns the next boundary position, starting from position *pos*, of
--- indicator number *indicator*, in the range of `1` to `32`.
+-- Returns the next boundary position, starting from position *pos*, of indicator number
+-- *indicator*, in the range of `1` to `32`.
-- Returns `1` if *indicator* was not found.
-- @param buffer A buffer.
-- @param indicator An indicator number in the range of `1` to `32`.
@@ -913,18 +864,16 @@ function indicator_clear_range(buffer, pos, length) end
function indicator_end(buffer, indicator, pos) end
---
--- Fills the range of text from position *pos* to *pos* + *length* with
--- indicator number `buffer.indicator_current`.
+-- Fills the range of text from position *pos* to *pos* + *length* with indicator number
+-- `buffer.indicator_current`.
-- @param buffer A buffer.
--- @param pos The start position of the range of text in *buffer* to set
--- indicators over.
--- @param length The number of characters in the range of text to set indicators
--- over.
+-- @param pos The start position of the range of text in *buffer* to set indicators over.
+-- @param length The number of characters in the range of text to set indicators over.
function indicator_fill_range(buffer, pos, length) end
---
--- Returns the previous boundary position, starting from position *pos*, of
--- indicator number *indicator*, in the range of `1` to `32`.
+-- Returns the previous boundary position, starting from position *pos*, of indicator number
+-- *indicator*, in the range of `1` to `32`.
-- Returns `1` if *indicator* was not found.
-- @param buffer A buffer.
-- @param indicator An indicator number in the range of `1` to `32`.
@@ -934,22 +883,19 @@ function indicator_start(buffer, indicator, pos) end
---
-- Inserts string *text* at position *pos*, removing any selections.
-- If *pos* is `-1`, inserts *text* at the caret position.
--- If the caret is after the *pos*, it is moved appropriately, but not scrolled
--- into view.
+-- If the caret is after the *pos*, it is moved appropriately, but not scrolled into view.
-- @param buffer A buffer.
--- @param pos The position in *buffer* to insert text at, or `-1` for the
--- current position.
+-- @param pos The position in *buffer* to insert text at, or `-1` for the current position.
-- @param text The text to insert.
function insert_text(buffer, pos, text) end
---
--- Returns whether or not the the positions *start_pos* and *end_pos* are at
--- word boundaries.
+-- Returns whether or not the the positions *start_pos* and *end_pos* are at word boundaries.
-- @param buffer A buffer.
--- @param start_pos The start position of the range of text in *buffer* to
--- check for a word boundary at.
--- @param end_pos The end position of the range of text in *buffer* to check for
--- a word boundary at.
+-- @param start_pos The start position of the range of text in *buffer* to check for a word
+-- boundary at.
+-- @param end_pos The end position of the range of text in *buffer* to check for a word
+-- boundary at.
function is_range_word(buffer, start_pos, end_pos) end
---
@@ -973,14 +919,12 @@ function line_delete(buffer) end
function line_down(buffer) end
---
--- Moves the caret down one line, extending the selected text to the new
--- position.
+-- Moves the caret down one line, extending the selected text to the new position.
-- @param buffer A buffer.
function line_down_extend(buffer) end
---
--- Moves the caret down one line, extending the rectangular selection to the new
--- position.
+-- Moves the caret down one line, extending the rectangular selection to the new position.
-- @param buffer A buffer.
function line_down_rect_extend(buffer) end
@@ -1000,49 +944,46 @@ function line_end(buffer) end
function line_end_display(buffer) end
---
--- Moves the caret to the end of the current wrapped line, extending the
--- selected text to the new position.
+-- Moves the caret to the end of the current wrapped line, extending the selected text to the
+-- new position.
-- @param buffer A buffer.
function line_end_display_extend(buffer) end
---
--- Moves the caret to the end of the current line, extending the selected text
--- to the new position.
+-- Moves the caret to the end of the current line, extending the selected text to the new position.
-- @param buffer A buffer.
function line_end_extend(buffer) end
---
--- Moves the caret to the end of the current line, extending the rectangular
--- selection to the new position.
+-- Moves the caret to the end of the current line, extending the rectangular selection to the
+-- new position.
-- @param buffer A buffer.
function line_end_rect_extend(buffer) end
---
--- Moves the caret to the end of the current wrapped line or, if already there,
--- to the end of the actual line.
+-- Moves the caret to the end of the current wrapped line or, if already there, to the end of
+-- the actual line.
-- @param buffer A buffer.
function line_end_wrap(buffer) end
---
--- Like `buffer.line_end_wrap()`, but extends the selected text to the new
--- position.
+-- Like `buffer.line_end_wrap()`, but extends the selected text to the new position.
-- @param buffer A buffer.
function line_end_wrap_extend(buffer) end
---
-- Returns the line number of the line that contains position *pos*.
--- Returns `1` if *pos* is less than 1 or `buffer.line_count` if *pos* is
--- greater than `buffer.length + 1`.
+-- Returns `1` if *pos* is less than 1 or `buffer.line_count` if *pos* is greater than
+-- `buffer.length + 1`.
-- @param buffer A buffer.
-- @param pos The position in *buffer* to get the line number of.
-- @return number
function line_from_position(buffer, pos) end
---
--- Returns the number of bytes on line number *line*, including end of line
--- characters.
--- To get line length excluding end of line characters, use
--- `buffer.line_end_position[line] - buffer.position_from_line(line)`.
+-- Returns the number of bytes on line number *line*, including end of line characters.
+-- To get line length excluding end of line characters, use `buffer.line_end_position[line]
+-- - buffer.position_from_line(line)`.
-- @param buffer A buffer.
-- @param line The line number in *buffer* to get the length of.
-- @return number
@@ -1069,24 +1010,21 @@ function line_up(buffer) end
function line_up_extend(buffer) end
---
--- Moves the caret up one line, extending the rectangular selection to the new
--- position.
+-- Moves the caret up one line, extending the rectangular selection to the new position.
-- @param buffer A buffer.
function line_up_rect_extend(buffer) end
---
--- Joins the lines in the target range, inserting spaces between the words
--- joined at line boundaries.
+-- Joins the lines in the target range, inserting spaces between the words joined at line
+-- boundaries.
-- @param buffer A buffer.
function lines_join(buffer) end
---
-- Splits the lines in the target range into lines *width* pixels wide.
--- If *width* is `0`, splits the lines in the target range into lines as wide as
--- the view.
+-- If *width* is `0`, splits the lines in the target range into lines as wide as the view.
-- @param buffer A buffer.
--- @param width The pixel width to split lines at. When `0`, uses the width of
--- the view.
+-- @param width The pixel width to split lines at. When `0`, uses the width of the view.
function lines_split(buffer, pixel_width) end
---
@@ -1100,10 +1038,9 @@ function lower_case(buffer) end
function margin_text_clear_all(buffer) end
---
--- Adds marker number *marker*, in the range of `1` to `32`, to line number
--- *line*, returning the added marker's handle which can be used in
--- `buffer.marker_delete_handle()` and `buffer.marker_line_from_handle()`, or
--- `-1` if *line* is invalid.
+-- Adds marker number *marker*, in the range of `1` to `32`, to line number *line*, returning
+-- the added marker's handle which can be used in `buffer.marker_delete_handle()` and
+-- `buffer.marker_line_from_handle()`, or `-1` if *line* is invalid.
-- @param buffer A buffer.
-- @param line The line number to add the marker on.
-- @param marker The marker number in the range of `1` to `32` to add.
@@ -1111,32 +1048,30 @@ function margin_text_clear_all(buffer) end
function marker_add(buffer, line, marker) end
---
--- Adds the markers specified in marker bit-mask *marker_mask* to line number
--- *line*.
--- The first bit is set to add marker number 1, the second bit for marker number
--- 2, and so on up to marker number 32.
+-- Adds the markers specified in marker bit-mask *marker_mask* to line number *line*.
+-- The first bit is set to add marker number 1, the second bit for marker number 2, and so on
+-- up to marker number 32.
-- @param buffer A buffer.
-- @param line The line number to add the markers on.
--- @param marker_mask The mask of markers to set. Set the first bit to set
--- marker 1, the second bit for marker 2 and so on.
+-- @param marker_mask The mask of markers to set. Set the first bit to set marker 1, the second
+-- bit for marker 2 and so on.
function marker_add_set(buffer, line, marker_mask) end
---
--- Deletes marker number *marker*, in the range of `1` to `32`, from line number
--- *line*. If *marker* is `-1`, deletes all markers from *line*.
+-- Deletes marker number *marker*, in the range of `1` to `32`, from line number *line*. If
+-- *marker* is `-1`, deletes all markers from *line*.
-- @param buffer A buffer.
-- @param line The line number to delete the marker on.
--- @param marker The marker number in the range of `1` to `32` to delete from
--- *line*, or `-1` to delete all markers from the line.
+-- @param marker The marker number in the range of `1` to `32` to delete from *line*, or `-1`
+-- to delete all markers from the line.
function marker_delete(buffer, line, marker) end
---
--- Deletes marker number *marker*, in the range of `1` to `32`, from any line
--- that has it.
+-- Deletes marker number *marker*, in the range of `1` to `32`, from any line that has it.
-- If *marker* is `-1`, deletes all markers from all lines.
-- @param buffer A buffer.
--- @param marker The marker number in the range of `1` to `32` to delete from
--- all lines, or `-1` to delete all markers from all lines.
+-- @param marker The marker number in the range of `1` to `32` to delete from all lines, or
+-- `-1` to delete all markers from all lines.
function marker_delete_all(buffer, marker) end
---
@@ -1147,60 +1082,56 @@ function marker_delete_handle(buffer, handle) end
---
-- Returns a bit-mask that represents the markers on line number *line*.
--- The first bit is set if marker number 1 is present, the second bit for marker
--- number 2, and so on.
+-- The first bit is set if marker number 1 is present, the second bit for marker number 2,
+-- and so on.
-- @param buffer A buffer.
-- @param line The line number to get markers on.
-- @return number
function marker_get(buffer, line) end
---
--- Returns the handle of the *n*th marker on line number *line*, or `-1` if no
--- such marker exists.
+-- Returns the handle of the *n*th marker on line number *line*, or `-1` if no such marker exists.
-- @param buffer A buffer.
-- @param line The line number to get markers on.
-- @param n The marker to get the handle of.
function marker_handle_from_line(buffer, line, n) end
---
--- Returns the line number of the line that contains the marker with handle
--- *handle* (returned `buffer.marker_add()`), or `-1` if the line was not found.
+-- Returns the line number of the line that contains the marker with handle *handle* (returned
+-- `buffer.marker_add()`), or `-1` if the line was not found.
-- @param buffer A buffer.
-- @param handle The identifier of a marker returned by `buffer.marker_add()`.
-- @return number
function marker_line_from_handle(buffer, handle) end
---
--- Returns the first line number, starting at line number *line*, that contains
--- all of the markers represented by marker bit-mask *marker_mask*.
+-- Returns the first line number, starting at line number *line*, that contains all of the
+-- markers represented by marker bit-mask *marker_mask*.
-- Returns `-1` if no line was found.
--- The first bit is set if marker 1 is set, the second bit for marker 2, etc.,
--- up to marker 32.
+-- The first bit is set if marker 1 is set, the second bit for marker 2, etc., up to marker 32.
-- @param buffer A buffer.
-- @param line The start line to search from.
--- @param marker_mask The mask of markers to find. Set the first bit to find
--- marker 1, the second bit for marker 2, and so on.
+-- @param marker_mask The mask of markers to find. Set the first bit to find marker 1, the
+-- second bit for marker 2, and so on.
-- @return number
function marker_next(buffer, line, marker_mask) end
---
--- Returns the number of the *n*th marker on line number *line*, or `-1` if no
--- such marker exists.
+-- Returns the number of the *n*th marker on line number *line*, or `-1` if no such marker exists.
-- @param buffer A buffer.
-- @param line The line number to get markers on.
-- @param n The marker to get the number of.
function marker_number_from_line(buffer, line, n) end
---
--- Returns the last line number, before or on line number *line*, that contains
--- all of the markers represented by marker bit-mask *marker_mask*.
+-- Returns the last line number, before or on line number *line*, that contains all of the
+-- markers represented by marker bit-mask *marker_mask*.
-- Returns `-1` if no line was found.
--- The first bit is set if marker 1 is set, the second bit for marker 2, etc.,
--- up to marker 32.
+-- The first bit is set if marker 1 is set, the second bit for marker 2, etc., up to marker 32.
-- @param buffer A buffer.
-- @param line The start line to search from.
--- @param marker_mask The mask of markers to find. Set the first bit to find
--- marker 1, the second bit for marker 2, and so on.
+-- @param marker_mask The mask of markers to find. Set the first bit to find marker 1, the
+-- second bit for marker 2, and so on.
-- @return number
function marker_previous(buffer, line, marker_mask) end
@@ -1220,16 +1151,14 @@ function move_selected_lines_down(buffer) end
function move_selected_lines_up(buffer) end
---
--- Adds to the set of selections each occurrence of the main selection within
--- the target range.
+-- Adds to the set of selections each occurrence of the main selection within the target range.
-- If there is no selected text, the current word is used.
-- @param buffer A buffer.
function multiple_select_add_each(buffer) end
---
--- Adds to the set of selections the next occurrence of the main selection
--- within the target range, makes that occurrence the new main selection, and
--- scrolls it into view.
+-- Adds to the set of selections the next occurrence of the main selection within the target
+-- range, makes that occurrence the new main selection, and scrolls it into view.
-- If there is no selected text, the current word is used.
-- @param buffer A buffer.
function multiple_select_add_next(buffer) end
@@ -1252,14 +1181,12 @@ function new_line(buffer) end
function page_down(buffer) end
---
--- Moves the caret down one page, extending the selected text to the new
--- position.
+-- Moves the caret down one page, extending the selected text to the new position.
-- @param buffer A buffer.
function page_down_extend(buffer) end
---
--- Moves the caret down one page, extending the rectangular selection to the new
--- position.
+-- Moves the caret down one page, extending the rectangular selection to the new position.
-- @param buffer A buffer.
function page_down_rect_extend(buffer) end
@@ -1274,8 +1201,7 @@ function page_up(buffer) end
function page_up_extend(buffer) end
---
--- Moves the caret up one page, extending the rectangular selection to the new
--- position.
+-- Moves the caret up one page, extending the rectangular selection to the new position.
-- @param buffer A buffer.
function page_up_rect_extend(buffer) end
@@ -1286,8 +1212,7 @@ function page_up_rect_extend(buffer) end
function para_down(buffer) end
---
--- Moves the caret down one paragraph, extending the selected text to the new
--- position.
+-- Moves the caret down one paragraph, extending the selected text to the new position.
-- Paragraphs are surrounded by one or more blank lines.
-- @param buffer A buffer.
function para_down_extend(buffer) end
@@ -1299,30 +1224,27 @@ function para_down_extend(buffer) end
function para_up(buffer) end
---
--- Moves the caret up one paragraph, extending the selected text to the new
--- position.
+-- Moves the caret up one paragraph, extending the selected text to the new position.
-- Paragraphs are surrounded by one or more blank lines.
-- @param buffer A buffer.
function para_up_extend(buffer) end
---
--- Pastes the clipboard's contents into the buffer, replacing any selected text
--- according to `buffer.multi_paste`.
+-- Pastes the clipboard's contents into the buffer, replacing any selected text according to
+-- `buffer.multi_paste`.
-- @param buffer A buffer.
function paste(buffer) end
---
--- Returns the position of the character after position *pos* (taking multi-byte
--- characters into account), or `buffer.length + 1` if there is no character
--- after *pos*.
+-- Returns the position of the character after position *pos* (taking multi-byte characters
+-- into account), or `buffer.length + 1` if there is no character after *pos*.
-- @param buffer A buffer.
-- @param pos The position in *buffer* to get the position after from.
function position_after(buffer, pos) end
---
--- Returns the position of the character before position *pos* (taking
--- multi-byte characters into account), or `1` if there is no character before
--- *pos*.
+-- Returns the position of the character before position *pos* (taking multi-byte characters
+-- into account), or `1` if there is no character before *pos*.
-- @param buffer A buffer.
-- @param pos The position in *buffer* to get the position before from.
-- @return number
@@ -1337,15 +1259,13 @@ function position_before(buffer, pos) end
function position_from_line(buffer, line) end
---
--- Returns the position *n* characters before or after position *pos* (taking
--- multi-byte characters into account).
--- Returns `1` if the position is less than 1 or greater than
--- `buffer.length + 1`.
+-- Returns the position *n* characters before or after position *pos* (taking multi-byte
+-- characters into account).
+-- Returns `1` if the position is less than 1 or greater than `buffer.length + 1`.
-- @param buffer A buffer.
-- @param pos The position in *buffer* to get the relative position from.
--- @param n The relative number of characters to get the position for. A
--- negative number indicates a position before while a positive number
--- indicates a position after.
+-- @param n The relative number of characters to get the position for. A negative number
+-- indicates a position before while a positive number indicates a position after.
-- @return number
function position_relative(buffer, pos, n) end
@@ -1361,20 +1281,18 @@ function redo(buffer) end
function replace_sel(buffer, text) end
---
--- Replaces the text in the target range with string *text* sans modifying any
--- selections or scrolling the view.
--- Setting the target and calling this function with an empty string is another
--- way to delete text.
+-- Replaces the text in the target range with string *text* sans modifying any selections or
+-- scrolling the view.
+-- Setting the target and calling this function with an empty string is another way to delete text.
-- @param buffer A buffer.
-- @param text The text to replace the target range with.
-- @return number
function replace_target(buffer, text) end
---
--- Replaces the text in the target range with string *text* but first replaces
--- any "\d" sequences with the text of capture number *d* from the regular
--- expression (or the entire match for *d* = 0), and then returns the
--- replacement text's length.
+-- Replaces the text in the target range with string *text* but first replaces any "\d" sequences
+-- with the text of capture number *d* from the regular expression (or the entire match for *d*
+-- = 0), and then returns the replacement text's length.
-- @param buffer A buffer.
-- @param text The text to replace the target range with.
-- @return number
@@ -1386,16 +1304,16 @@ function replace_target_re(buffer, text) end
function rotate_selection(buffer) end
---
--- Anchors the position that `buffer.search_next()` and `buffer.search_prev()`
--- start at to the beginning of the current selection or caret position.
+-- Anchors the position that `buffer.search_next()` and `buffer.search_prev()` start at to the
+-- beginning of the current selection or caret position.
-- @param buffer A buffer.
function search_anchor(buffer) end
---
--- Searches for the first occurrence of string *text* in the target range
--- bounded by `buffer.target_start` and `buffer.target_end` using search flags
--- `buffer.search_flags` and, if found, sets the new target range to that
--- occurrence, returning its position or `-1` if *text* was not found.
+-- Searches for the first occurrence of string *text* in the target range bounded by
+-- `buffer.target_start` and `buffer.target_end` using search flags `buffer.search_flags`
+-- and, if found, sets the new target range to that occurrence, returning its position or `-1`
+-- if *text* was not found.
-- @param buffer A buffer.
-- @param text The text to search the target range for.
-- @return number
@@ -1403,9 +1321,9 @@ function search_anchor(buffer) end
function search_in_target(buffer, text) end
---
--- Searches for and selects the first occurrence of string *text* starting at
--- the search anchor using search flags *flags*, returning that occurrence's
--- position or `-1` if *text* was not found.
+-- Searches for and selects the first occurrence of string *text* starting at the search
+-- anchor using search flags *flags*, returning that occurrence's position or `-1` if *text*
+-- was not found.
-- Selected text is not scrolled into view.
-- @param buffer A buffer.
-- @param flags The search flags to use. See `buffer.search_flags`.
@@ -1415,9 +1333,8 @@ function search_in_target(buffer, text) end
function search_next(buffer, flags, text) end
---
--- Searches for and selects the last occurrence of string *text* before the
--- search anchor using search flags *flags*, returning that occurrence's
--- position or `-1` if *text* was not found.
+-- Searches for and selects the last occurrence of string *text* before the search anchor using
+-- search flags *flags*, returning that occurrence's position or `-1` if *text* was not found.
-- @param buffer A buffer.
-- @param flags The search flags to use. See `buffer.search_flags`.
-- @param text The text to search for.
@@ -1437,8 +1354,8 @@ function select_all(buffer) end
function selection_duplicate(buffer) end
---
--- Resets `buffer.word_chars`, `buffer.whitespace_chars`, and
--- `buffer.punctuation_chars` to their respective defaults.
+-- Resets `buffer.word_chars`, `buffer.whitespace_chars`, and `buffer.punctuation_chars` to
+-- their respective defaults.
-- @param buffer A buffer.
-- @see word_chars
-- @see whitespace_chars
@@ -1446,8 +1363,7 @@ function selection_duplicate(buffer) end
function set_chars_default(buffer) end
---
--- Moves the caret to position *pos* without scrolling the view and removes any
--- selections.
+-- Moves the caret to position *pos* without scrolling the view and removes any selections.
-- @param buffer A buffer
-- @param pos The position in *buffer* to move to.
function set_empty_selection(buffer, pos) end
@@ -1458,29 +1374,26 @@ function set_empty_selection(buffer, pos) end
function set_save_point(buffer) end
---
--- Selects the range of text between positions *start_pos* and *end_pos*,
--- scrolling the selected text into view.
+-- Selects the range of text between positions *start_pos* and *end_pos*, scrolling the selected
+-- text into view.
-- @param buffer A buffer.
--- @param start_pos The start position of the range of text in *buffer* to
--- select. If negative, it means the end of the buffer.
--- @param end_pos The end position of the range of text in *buffer* to select.
--- If negative, it means remove any selection (i.e. set the `anchor` to the
--- same position as `current_pos`).
+-- @param start_pos The start position of the range of text in *buffer* to select. If negative,
+-- it means the end of the buffer.
+-- @param end_pos The end position of the range of text in *buffer* to select. If negative,
+-- it means remove any selection (i.e. set the `anchor` to the same position as `current_pos`).
function set_sel(buffer, start_pos, end_pos) end
---
--- Selects the range of text between positions *start_pos* to *end_pos*,
--- removing all other selections.
+-- Selects the range of text between positions *start_pos* to *end_pos*, removing all other
+-- selections.
-- @param buffer A buffer.
-- @param end_pos The caret position of the range of text to select in *buffer*.
--- @param start_pos The anchor position of the range of text to select in
--- *buffer*.
+-- @param start_pos The anchor position of the range of text to select in *buffer*.
function set_selection(buffer, end_pos, start_pos) end
---
--- Assigns style number *style*, in the range from `1` to `256`, to the next
--- *length* characters, starting from the current styling position, and
--- increments the styling position by *length*.
+-- Assigns style number *style*, in the range from `1` to `256`, to the next *length* characters,
+-- starting from the current styling position, and increments the styling position by *length*.
-- [`buffer:start_styling`]() should be called before `buffer:set_styling()`.
-- @param buffer A buffer.
-- @param length The number of characters to style.
@@ -1488,8 +1401,8 @@ function set_selection(buffer, end_pos, start_pos) end
function set_styling(buffer, length, style) end
---
--- Defines the target range's beginning and end positions as *start_pos* and
--- *end_pos*, respectively.
+-- Defines the target range's beginning and end positions as *start_pos* and *end_pos*,
+-- respectively.
-- @param buffer A buffer.
-- @param start_pos The position of the beginning of the target range.
-- @param end_pos The position of the end of the target range.
@@ -1503,8 +1416,7 @@ function set_text(buffer, text) end
---
-- Begins styling at position *position* with styling bit-mask *style_mask*.
--- *style_mask* specifies which style bits can be set with
--- `buffer.set_styling()`.
+-- *style_mask* specifies which style bits can be set with `buffer.set_styling()`.
-- @param buffer A buffer.
-- @param position The position in *buffer* to start styling at.
-- @param unused Unused number. `0` can be safely used.
@@ -1513,14 +1425,12 @@ function set_text(buffer, text) end
function start_styling(buffer, position, unused) end
---
--- Moves the caret to the bottom of the page or, if already there, down one
--- page.
+-- Moves the caret to the bottom of the page or, if already there, down one page.
-- @param buffer A buffer.
function stuttered_page_down(buffer) end
---
--- Like `buffer.stuttered_page_down()`, but extends the selected text to the new
--- position.
+-- Like `buffer.stuttered_page_down()`, but extends the selected text to the new position.
-- @param buffer A buffer.
function stuttered_page_down_extend(buffer) end
@@ -1530,8 +1440,7 @@ function stuttered_page_down_extend(buffer) end
function stuttered_page_up(buffer) end
---
--- Like `buffer.stuttered_page_up()`, but extends the selected text to the new
--- position.
+-- Like `buffer.stuttered_page_up()`, but extends the selected text to the new position.
-- @param buffer A buffer.
function stuttered_page_up_extend(buffer) end
@@ -1541,26 +1450,25 @@ function stuttered_page_up_extend(buffer) end
function swap_main_anchor_caret(buffer) end
---
--- Indents the text on the selected lines or types a Tab character ("\t") at
--- the caret position.
+-- Indents the text on the selected lines or types a Tab character ("\t") at the caret position.
-- @param buffer A buffer.
function tab(buffer) end
---
--- Defines the target range's beginning and end positions as the beginning and
--- end positions of the main selection, respectively.
+-- Defines the target range's beginning and end positions as the beginning and end positions
+-- of the main selection, respectively.
-- @param buffer A buffer.
function target_from_selection(buffer) end
---
--- Defines the target range's beginning and end positions as the beginning and
--- end positions of the document, respectively.
+-- Defines the target range's beginning and end positions as the beginning and end positions
+-- of the document, respectively.
-- @param buffer A buffer.
function target_whole_document(buffer) end
---
--- Cycles between `buffer.caret_sticky` option settings `buffer.CARETSTICKY_ON`
--- and `buffer.CARETSTICKY_OFF`.
+-- Cycles between `buffer.caret_sticky` option settings `buffer.CARETSTICKY_ON` and
+-- `buffer.CARETSTICKY_OFF`.
-- @param buffer A buffer.
-- @see caret_sticky
function toggle_caret_sticky(buffer) end
@@ -1576,35 +1484,32 @@ function undo(buffer) end
function upper_case(buffer) end
---
--- Displays a user list identified by list identifier number *id* and
--- constructed from string *items* (whose items are delimited by
--- `buffer.auto_c_separator` characters).
--- The sorted order of *items* (`buffer.auto_c_order`) must have already been
--- defined. When the user selects an item, *id* is sent in a
--- `USER_LIST_SELECTION` event along with the selection.
+-- Displays a user list identified by list identifier number *id* and constructed from string
+-- *items* (whose items are delimited by `buffer.auto_c_separator` characters).
+-- The sorted order of *items* (`buffer.auto_c_order`) must have already been defined. When the
+-- user selects an item, *id* is sent in a `USER_LIST_SELECTION` event along with the selection.
-- @param buffer A buffer.
-- @param id The list identifier number greater than zero to use.
--- @param items The sorted string of words to show, separated by
--- `buffer.auto_c_separator` characters (initially spaces).
+-- @param items The sorted string of words to show, separated by `buffer.auto_c_separator`
+-- characters (initially spaces).
-- @see _SCINTILLA.next_user_list_type
-- @see events.USER_LIST_SELECTION
function user_list_show(buffer, id, items) end
---
--- Moves the caret to the first visible character on the current line or, if
--- already there, to the beginning of the current line.
+-- Moves the caret to the first visible character on the current line or, if already there,
+-- to the beginning of the current line.
-- @param buffer A buffer.
function vc_home(buffer) end
---
--- Moves the caret to the first visible character on the current wrapped line
--- or, if already there, to the beginning of the current wrapped line.
+-- Moves the caret to the first visible character on the current wrapped line or, if already
+-- there, to the beginning of the current wrapped line.
-- @param buffer A buffer.
function vc_home_display(buffer) end
---
--- Like `buffer.vc_home_display()`, but extends the selected text to the new
--- position.
+-- Like `buffer.vc_home_display()`, but extends the selected text to the new position.
-- @param buffer A buffer.
function vc_home_display_extend(buffer) end
@@ -1614,35 +1519,32 @@ function vc_home_display_extend(buffer) end
function vc_home_extend(buffer) end
---
--- Like `buffer.vc_home()`, but extends the rectangular selection to the new
--- position.
+-- Like `buffer.vc_home()`, but extends the rectangular selection to the new position.
-- @param buffer A buffer.
function vc_home_rect_extend(buffer) end
---
--- Moves the caret to the first visible character on the current wrapped line
--- or, if already there, to the beginning of the actual line.
+-- Moves the caret to the first visible character on the current wrapped line or, if already
+-- there, to the beginning of the actual line.
-- @param buffer A buffer.
function vc_home_wrap(buffer) end
---
--- Like `buffer.vc_home_wrap()`, but extends the selected text to the new
--- position.
+-- Like `buffer.vc_home_wrap()`, but extends the selected text to the new position.
-- @param buffer A buffer.
function vc_home_wrap_extend(buffer) end
---
-- Returns the position of the end of the word at position *pos*.
--- `buffer.word_chars` contains the set of characters that constitute words. If
--- *pos* has a non-word character to its right and *only_word_chars* is `false`,
--- returns the first word character's position.
+-- `buffer.word_chars` contains the set of characters that constitute words. If *pos* has a
+-- non-word character to its right and *only_word_chars* is `false`, returns the first word
+-- character's position.
-- @param buffer A buffer.
-- @param pos The position in *buffer* of the word.
--- @param only_word_chars If `true`, stops searching at the first non-word
--- character in the search direction. Otherwise, the first character in the
--- search direction sets the type of the search as word or non-word and the
--- search stops at the first non-matching character. Searches are also
--- terminated by the start or end of the buffer.
+-- @param only_word_chars If `true`, stops searching at the first non-word character in
+-- the search direction. Otherwise, the first character in the search direction sets the
+-- type of the search as word or non-word and the search stops at the first non-matching
+-- character. Searches are also terminated by the start or end of the buffer.
function word_end_position(buffer, pos, only_word_chars) end
---
@@ -1652,55 +1554,48 @@ function word_end_position(buffer, pos, only_word_chars) end
function word_left(buffer) end
---
--- Moves the caret left one word, positioning it at the end of the previous
--- word.
+-- Moves the caret left one word, positioning it at the end of the previous word.
-- `buffer.word_chars` contains the set of characters that constitute words.
-- @param buffer A buffer.
function word_left_end(buffer) end
---
--- Like `buffer.word_left_end()`, but extends the selected text to the new
--- position.
+-- Like `buffer.word_left_end()`, but extends the selected text to the new position.
-- @param buffer A buffer.
function word_left_end_extend(buffer) end
---
--- Moves the caret left one word, extending the selected text to the new
--- position.
+-- Moves the caret left one word, extending the selected text to the new position.
-- `buffer.word_chars` contains the set of characters that constitute words.
-- @param buffer A buffer.
function word_left_extend(buffer) end
---
-- Moves the caret to the previous part of the current word.
--- Word parts are delimited by underscore characters or changes in
--- capitalization.
+-- Word parts are delimited by underscore characters or changes in capitalization.
-- `buffer.word_chars` contains the set of characters that constitute words.
-- @param buffer A buffer.
function word_part_left(buffer) end
---
--- Moves the caret to the previous part of the current word, extending the
--- selected text to the new position.
--- Word parts are delimited by underscore characters or changes in
--- capitalization.
+-- Moves the caret to the previous part of the current word, extending the selected text to
+-- the new position.
+-- Word parts are delimited by underscore characters or changes in capitalization.
-- `buffer.word_chars` contains the set of characters that constitute words.
-- @param buffer A buffer.
function word_part_left_extend(buffer) end
---
-- Moves the caret to the next part of the current word.
--- Word parts are delimited by underscore characters or changes in
--- capitalization.
+-- Word parts are delimited by underscore characters or changes in capitalization.
-- `buffer.word_chars` contains the set of characters that constitute words.
-- @param buffer A buffer.
function word_part_right(buffer) end
---
--- Moves the caret to the next part of the current word, extending the selected
--- text to the new position.
--- Word parts are delimited by underscore characters or changes in
--- capitalization.
+-- Moves the caret to the next part of the current word, extending the selected text to the
+-- new position.
+-- Word parts are delimited by underscore characters or changes in capitalization.
-- `buffer.word_chars` contains the set of characters that constitute words.
-- @param buffer A buffer.
function word_part_right_extend(buffer) end
@@ -1712,45 +1607,40 @@ function word_part_right_extend(buffer) end
function word_right(buffer) end
---
--- Moves the caret right one word, positioning it at the end of the current
--- word.
+-- Moves the caret right one word, positioning it at the end of the current word.
-- `buffer.word_chars` contains the set of characters that constitute words.
-- @param buffer A buffer.
function word_right_end(buffer) end
---
--- Like `buffer.word_right_end()`, but extends the selected text to the new
--- position.
+-- Like `buffer.word_right_end()`, but extends the selected text to the new position.
-- @param buffer A buffer.
function word_right_end_extend(buffer) end
---
--- Moves the caret right one word, extending the selected text to the new
--- position.
+-- Moves the caret right one word, extending the selected text to the new position.
-- `buffer.word_chars` contains the set of characters that constitute words.
-- @param buffer A buffer.
function word_right_extend(buffer) end
---
-- Returns the position of the beginning of the word at position *pos*.
--- `buffer.word_chars` contains the set of characters that constitute words. If
--- *pos* has a non-word character to its left and *only_word_chars* is `false`,
--- returns the last word character's position.
+-- `buffer.word_chars` contains the set of characters that constitute words. If *pos* has
+-- a non-word character to its left and *only_word_chars* is `false`, returns the last word
+-- character's position.
-- @param buffer A buffer.
-- @param pos The position in *buffer* of the word.
--- @param only_word_chars If `true`, stops searching at the first non-word
--- character in the search direction. Otherwise, the first character in the
--- search direction sets the type of the search as word or non-word and the
--- search stops at the first non-matching character. Searches are also
--- terminated by the start or end of the buffer.
+-- @param only_word_chars If `true`, stops searching at the first non-word character in
+-- the search direction. Otherwise, the first character in the search direction sets the
+-- type of the search as word or non-word and the search stops at the first non-matching
+-- character. Searches are also terminated by the start or end of the buffer.
function word_start_position(buffer, pos, only_word_chars) end
-- External functions.
---
-- Deletes the buffer.
--- **Do not call this function.** Call `buffer:close()` instead. Emits a
--- `BUFFER_DELETED` event.
+-- **Do not call this function.** Call `buffer:close()` instead. Emits a `BUFFER_DELETED` event.
-- @param buffer A buffer.
-- @see events.BUFFER_DELETED
function delete(buffer) end
@@ -1771,8 +1661,8 @@ function new() end
function text_range(buffer, start_pos, end_pos) end
---
--- Returns the style number associated with string *style_name*, or
--- `view.STYLE_DEFAULT` if *style_name* is not in use.
+-- Returns the style number associated with string *style_name*, or `view.STYLE_DEFAULT` if
+-- *style_name* is not in use.
-- @param buffer A buffer.
-- @param string The style name to get the number of.
-- @return style number, between `1` and `256`.
@@ -1781,8 +1671,7 @@ function style_of_name(buffer, style_name) end
---
-- Reloads the buffer's file contents, discarding any changes.
--- Emits `FILE_BEFORE_RELOAD` and `FILE_AFTER_RELOAD` events if the buffer is
--- the current one.
+-- Emits `FILE_BEFORE_RELOAD` and `FILE_AFTER_RELOAD` events if the buffer is the current one.
-- @param buffer A buffer.
-- @name reload
function reload(buffer) end
@@ -1799,18 +1688,17 @@ function save(buffer) end
-- Saves the buffer to file *filename* or the user-specified filename.
-- Emits a `FILE_AFTER_SAVE` event.
-- @param buffer A buffer.
--- @param filename Optional new filepath to save the buffer to. If `nil`, the
--- user is prompted for one.
+-- @param filename Optional new filepath to save the buffer to. If `nil`, the user is prompted
+-- for one.
-- @name save_as
function save_as(buffer, filename) end
---
--- Closes the buffer, prompting the user to continue if there are unsaved
--- changes (unless *force* is `true`), and returns `true` if the buffer was
--- closed.
+-- Closes the buffer, prompting the user to continue if there are unsaved changes (unless *force*
+-- is `true`), and returns `true` if the buffer was closed.
-- @param buffer A buffer.
--- @param force Optional flag that discards unsaved changes without prompting
--- the user. The default value is `false`.
+-- @param force Optional flag that discards unsaved changes without prompting the user. The
+-- default value is `false`.
-- @return `true` if the buffer was closed; `nil` otherwise.
-- @name close
function close(buffer, force) end
@@ -1818,27 +1706,26 @@ function close(buffer, force) end
---
-- Converts the buffer's contents to encoding *encoding*.
-- @param buffer A buffer.
--- @param encoding The string encoding to set. Valid encodings are ones that GNU
--- iconv accepts. If `nil`, assumes a binary encoding.
+-- @param encoding The string encoding to set. Valid encodings are ones that GNU iconv accepts. If
+-- `nil`, assumes a binary encoding.
-- @usage buffer:set_encoding('CP1252')
function set_encoding(buffer, encoding) end
---
-- Returns the buffer's lexer name.
--- If *current* is `true`, returns the name of the lexer under the caret in
--- a multiple-language lexer.
+-- If *current* is `true`, returns the name of the lexer under the caret in a multiple-language
+-- lexer.
-- @param buffer A buffer.
--- @param current Whether or not to get the lexer at the current caret position
--- in multi-language lexers. The default is `false` and returns the parent
--- lexer.
+-- @param current Whether or not to get the lexer at the current caret position in multi-language
+-- lexers. The default is `false` and returns the parent lexer.
function get_lexer(buffer, current) end
---
--- Associates string lexer name *name* or the auto-detected lexer name with the
--- buffer and then loads the appropriate language module if that module exists.
+-- Associates string lexer name *name* or the auto-detected lexer name with the buffer and then
+-- loads the appropriate language module if that module exists.
-- @param buffer A buffer.
--- @param name Optional string lexer name to set. If `nil`, attempts to
--- auto-detect the buffer's lexer.
+-- @param name Optional string lexer name to set. If `nil`, attempts to auto-detect the
+-- buffer's lexer.
-- @usage buffer:set_lexer('lexer_name')
function set_lexer(buffer, name) end
diff --git a/core/.iconv.luadoc b/core/.iconv.luadoc
index adaeaea3..89471c59 100644
--- a/core/.iconv.luadoc
+++ b/core/.iconv.luadoc
@@ -1,26 +1,23 @@
-- Copyright 2007-2020 Mitchell. See LICENSE.
--- This is a DUMMY FILE used for making LuaDoc for built-in functions in the
--- string table.
+-- This is a DUMMY FILE used for making LuaDoc for built-in functions in the string table.
--- Extends Lua's `string` library to provide character set conversions.
module('string')
---
--- Converts string *text* from encoding *old* to encoding *new* using GNU
--- libiconv, returning the string result.
+-- Converts string *text* from encoding *old* to encoding *new* using GNU libiconv, returning
+-- the string result.
-- Raises an error if the encoding conversion failed.
-- Valid encodings are [GNU libiconv's encodings][] and include:
--
--- * European: ASCII, ISO-8859-{1,2,3,4,5,7,9,10,13,14,15,16}, KOI8-R, KOI8-U,
--- KOI8-RU, CP{1250,1251,1252,1253,1254,1257}, CP{850,866,1131},
--- Mac{Roman,CentralEurope,Iceland,Croatian,Romania},
--- Mac{Cyrillic,Ukraine,Greek,Turkish}, Macintosh.
+-- * European: ASCII, ISO-8859-{1,2,3,4,5,7,9,10,13,14,15,16}, KOI8-R,
+-- KOI8-U, KOI8-RU, CP{1250,1251,1252,1253,1254,1257}, CP{850,866,1131},
+-- Mac{Roman,CentralEurope,Iceland,Croatian,Romania}, Mac{Cyrillic,Ukraine,Greek,Turkish},
+-- Macintosh.
-- * Semitic: ISO-8859-{6,8}, CP{1255,1256}, CP862, Mac{Hebrew,Arabic}.
--- * Japanese: EUC-JP, SHIFT_JIS, CP932, ISO-2022-JP, ISO-2022-JP-2,
--- ISO-2022-JP-1.
--- * Chinese: EUC-CN, HZ, GBK, CP936, GB18030, EUC-TW, BIG5, CP950,
--- BIG5-HKSCS, BIG5-HKSCS:2004, BIG5-HKSCS:2001, BIG5-HKSCS:1999,
--- ISO-2022-CN, ISO-2022-CN-EXT.
+-- * Japanese: EUC-JP, SHIFT_JIS, CP932, ISO-2022-JP, ISO-2022-JP-2, ISO-2022-JP-1.
+-- * Chinese: EUC-CN, HZ, GBK, CP936, GB18030, EUC-TW, BIG5, CP950, BIG5-HKSCS, BIG5-HKSCS:2004,
+-- BIG5-HKSCS:2001, BIG5-HKSCS:1999, ISO-2022-CN, ISO-2022-CN-EXT.
-- * Korean: EUC-KR, CP949, ISO-2022-KR, JOHAB.
-- * Armenian: ARMSCII-8.
-- * Georgian: Georgian-Academy, Georgian-PS.
@@ -29,8 +26,8 @@ module('string')
-- * Thai: ISO-8859-11, TIS-620, CP874, MacThai.
-- * Laotian: MuleLao-1, CP1133.
-- * Vietnamese: VISCII, TCVN, CP1258.
--- * Unicode: UTF-8, UCS-2, UCS-2BE, UCS-2LE, UCS-4, UCS-4BE, UCS-4LE, UTF-16,
--- UTF-16BE, UTF-16LE, UTF-32, UTF-32BE, UTF-32LE, UTF-7, C99, JAVA.
+-- * Unicode: UTF-8, UCS-2, UCS-2BE, UCS-2LE, UCS-4, UCS-4BE, UCS-4LE, UTF-16, UTF-16BE,
+-- UTF-16LE, UTF-32, UTF-32BE, UTF-32LE, UTF-7, C99, JAVA.
--
-- [GNU libiconv's encodings]: https://www.gnu.org/software/libiconv/
-- @param text The text to convert.
diff --git a/core/.os.luadoc b/core/.os.luadoc
index 8ce09344..03d76bca 100644
--- a/core/.os.luadoc
+++ b/core/.os.luadoc
@@ -1,34 +1,30 @@
-- Copyright 2007-2020 Mitchell. See LICENSE.
--- This is a DUMMY FILE used for making LuaDoc for built-in functions in the
--- os table.
+-- This is a DUMMY FILE used for making LuaDoc for built-in functions in the os table.
--- Extends Lua's `os` library to provide process spawning capabilities.
module('os')
---
--- Spawns an interactive child process *cmd* in a separate thread, returning
--- a handle to that process.
+-- Spawns an interactive child process *cmd* in a separate thread, returning a handle to that
+-- process.
-- On Windows, *cmd* is passed to `cmd.exe`: `%COMSPEC% /c [cmd]`.
--- At the moment, only the Windows terminal version spawns processes in the same
--- thread.
--- @param cmd A command line string that contains the program's name followed by
--- arguments to pass to it. `PATH` is searched for program names.
--- @param cwd Optional current working directory (cwd) for the child
--- process. When omitted, the parent's cwd is used.
--- @param env Optional map of environment variables for the child process.
--- When omitted, Textadept's environment is used.
--- @param stdout_cb Optional Lua function that accepts a string parameter for a
--- block of standard output read from the child. Stdout is read asynchronously
--- in 1KB or 0.5KB blocks (depending on the platform), or however much data is
--- available at the time.
--- At the moment, only the Win32 terminal version sends all output, whether it
--- be stdout or stderr, to this callback after the process finishes.
--- @param stderr_cb Optional Lua function that accepts a string parameter for a
--- block of standard error read from the child. Stderr is read asynchronously
--- in 1KB or 0.5kB blocks (depending on the platform), or however much data is
--- available at the time.
--- @param exit_cb Optional Lua function that is called when the child process
--- finishes. The child's exit status is passed.
+-- At the moment, only the Windows terminal version spawns processes in the same thread.
+-- @param cmd A command line string that contains the program's name followed by arguments to
+-- pass to it. `PATH` is searched for program names.
+-- @param cwd Optional current working directory (cwd) for the child process. When omitted,
+-- the parent's cwd is used.
+-- @param env Optional map of environment variables for the child process. When omitted,
+-- Textadept's environment is used.
+-- @param stdout_cb Optional Lua function that accepts a string parameter for a block of standard
+-- output read from the child. Stdout is read asynchronously in 1KB or 0.5KB blocks (depending
+-- on the platform), or however much data is available at the time.
+-- At the moment, only the Win32 terminal version sends all output, whether it be stdout or
+-- stderr, to this callback after the process finishes.
+-- @param stderr_cb Optional Lua function that accepts a string parameter for a block of
+-- standard error read from the child. Stderr is read asynchronously in 1KB or 0.5kB blocks
+-- (depending on the platform), or however much data is available at the time.
+-- @param exit_cb Optional Lua function that is called when the child process finishes. The
+-- child's exit status is passed.
-- @return proc or nil plus an error message on failure
-- @usage os.spawn('lua ' .. buffer.filename, print)
-- @usage proc = os.spawn('lua -e "print(io.read())"', print)
@@ -38,48 +34,42 @@ module('os')
local spawn
---
--- Returns the status of process *spawn_proc*, which is either "running" or
--- "terminated".
+-- Returns the status of process *spawn_proc*, which is either "running" or "terminated".
-- @return "running" or "terminated"
function spawn_proc:status() end
---
--- Blocks until process *spawn_proc* finishes (if it has not already done so)
--- and returns its status code.
+-- Blocks until process *spawn_proc* finishes (if it has not already done so) and returns its
+-- status code.
-- @return integer status code
function spawn_proc:wait() end
---
--- Reads and returns stdout from process *spawn_proc*, according to string
--- format or number *arg*.
--- Similar to Lua's `io.read()` and blocks for input. *spawn_proc* must still be
--- running. If an error occurs while reading, returns `nil`, an error code, and
--- an error message.
--- Ensure any read operations read all stdout available, as the stdout callback
--- function passed to `os.spawn()` will not be called until the stdout buffer is
--- clear.
--- @param arg Optional argument similar to those in Lua's `io.read()`, but "n"
--- is not supported. The default value is "l", which reads a line.
+-- Reads and returns stdout from process *spawn_proc*, according to string format or number *arg*.
+-- Similar to Lua's `io.read()` and blocks for input. *spawn_proc* must still be running. If
+-- an error occurs while reading, returns `nil`, an error code, and an error message.
+-- Ensure any read operations read all stdout available, as the stdout callback function passed
+-- to `os.spawn()` will not be called until the stdout buffer is clear.
+-- @param arg Optional argument similar to those in Lua's `io.read()`, but "n" is not
+-- supported. The default value is "l", which reads a line.
-- @return string of bytes read
function spawn_proc:read(arg) end
---
-- Writes string input to the stdin of process *spawn_proc*.
--- Note: On Linux, if more than 65536 bytes (64K) are to be written, it is
--- possible those bytes need to be written in 65536-byte (64K) chunks, or the
--- process may not receive all input. However, it is also possible that there is
--- a limit on how many bytes can be written in a short period of time, perhaps
--- 196608 bytes (192K).
+-- Note: On Linux, if more than 65536 bytes (64K) are to be written, it is possible those
+-- bytes need to be written in 65536-byte (64K) chunks, or the process may not receive all
+-- input. However, it is also possible that there is a limit on how many bytes can be written
+-- in a short period of time, perhaps 196608 bytes (192K).
-- @param ... Standard input for *spawn_proc*.
function spawn_proc:write(...) end
---
--- Closes standard input for process *spawn_proc*, effectively sending an EOF
--- (end of file) to it.
+-- Closes standard input for process *spawn_proc*, effectively sending an EOF (end of file) to it.
function spawn_proc:close() end
---
-- Kills running process *spawn_proc*, or sends it Unix signal *signal*.
--- @param signal Optional Unix signal to send to *spawn_proc*. The default value
--- is 9 (`SIGKILL`), which kills the process.
+-- @param signal Optional Unix signal to send to *spawn_proc*. The default value is 9 (`SIGKILL`),
+-- which kills the process.
function spawn_proc:kill() end
diff --git a/core/.ui.dialogs.luadoc b/core/.ui.dialogs.luadoc
index 3b13b8cb..fd327254 100644
--- a/core/.ui.dialogs.luadoc
+++ b/core/.ui.dialogs.luadoc
@@ -1,40 +1,34 @@
-- Copyright 2007-2020 Mitchell. See LICENSE.
--- This is a DUMMY FILE used for making LuaDoc for built-in functions in the
--- ui.dialogs table.
+-- This is a DUMMY FILE used for making LuaDoc for built-in functions in the ui.dialogs table.
--- Provides a set of interactive dialog prompts for user input.
module('ui.dialogs')
---
--- Prompts the user with a generic message box dialog defined by dialog options
--- table *options*, returning the selected button's index.
--- If *options*.`string_output` is `true`, returns the selected button's label.
--- If the dialog timed out, returns `0` or `"timeout"`. If the user canceled the
--- dialog, returns `-1` or `"delete"`.
+-- Prompts the user with a generic message box dialog defined by dialog options table *options*,
+-- returning the selected button's index.
+-- If *options*.`string_output` is `true`, returns the selected button's label. If the dialog timed
+-- out, returns `0` or `"timeout"`. If the user canceled the dialog, returns `-1` or `"delete"`.
-- @param options Table of key-value option pairs for the message box.
--
-- * `title`: The dialog's title text.
-- * `text`: The dialog's main message text.
-- * `informative_text`: The dialog's extra informative text.
--- * `icon`: The dialog's GTK stock icon name. Examples are
--- "gtk-dialog-error", "gtk-dialog-info", "gtk-dialog-question", and
--- "gtk-dialog-warning". The dialog does not display an icon by default.
--- * `icon_file`: The dialog's icon file path. This option has no effect when
--- `icon` is set.
--- * `button1`: The right-most button's label. The default value is
--- `_L['OK']`.
+-- * `icon`: The dialog's GTK stock icon name. Examples are "gtk-dialog-error",
+-- "gtk-dialog-info", "gtk-dialog-question", and "gtk-dialog-warning". The dialog does not
+-- display an icon by default.
+-- * `icon_file`: The dialog's icon file path. This option has no effect when `icon` is set.
+-- * `button1`: The right-most button's label. The default value is `_L['OK']`.
-- * `button2`: The middle button's label.
--- * `button3`: The left-most button's label. This option requires `button2`
--- to be set.
--- * `string_output`: Return the selected button's label (instead of its
--- index) or the dialog's exit status instead of the button's index (instead
--- of its exit code). The default value is `false`.
+-- * `button3`: The left-most button's label. This option requires `button2` to be set.
+-- * `string_output`: Return the selected button's label (instead of its index) or the dialog's
+-- exit status instead of the button's index (instead of its exit code). The default value is
+-- `false`.
-- * `width`: The dialog's pixel width.
-- * `height`: The dialog's pixel height.
--- * `float`: Show the dialog on top of all desktop windows. The default value
--- is `false`.
--- * `timeout`: The integer number of seconds the dialog waits for the user to
--- select a button before timing out. Dialogs do not time out by default.
+-- * `float`: Show the dialog on top of all desktop windows. The default value is `false`.
+-- * `timeout`: The integer number of seconds the dialog waits for the user to select a button
+-- before timing out. Dialogs do not time out by default.
-- @return selected button or exit code
-- @usage ui.dialogs.msgbox{title = 'EOL Mode', text = 'Which EOL?',
-- icon = 'gtk-dialog-question', button1 = 'CRLF', button2 = 'CR',
@@ -42,396 +36,332 @@ module('ui.dialogs')
function msgbox(options) end
---
--- Prompts the user with a generic message box dialog defined by dialog options
--- table *options* and with localized "Ok" and "Cancel" buttons, returning the
--- selected button's index.
--- If *options*.`string_output` is `true`, returns the selected button's label.
--- If the dialog timed out, returns `0` or `"timeout"`. If the user canceled the
--- dialog, returns `-1` or `"delete"`.
+-- Prompts the user with a generic message box dialog defined by dialog options table *options*
+-- and with localized "Ok" and "Cancel" buttons, returning the selected button's index.
+-- If *options*.`string_output` is `true`, returns the selected button's label. If the dialog timed
+-- out, returns `0` or `"timeout"`. If the user canceled the dialog, returns `-1` or `"delete"`.
-- @param options Table of key-value option pairs for the message box.
--
-- * `title`: The dialog's title text.
-- * `text`: The dialog's main message text.
-- * `informative_text`: The dialog's extra informative text.
--- * `icon`: The dialog's GTK stock icon name. Examples are
--- "gtk-dialog-error", "gtk-dialog-info", "gtk-dialog-question", and
--- "gtk-dialog-warning". The dialog does not display an icon by default.
--- * `icon_file`: The dialog's icon file path. This option has no effect when
--- `icon` is set.
--- * `no_cancel`: Do not display the "Cancel" button. The default value is
+-- * `icon`: The dialog's GTK stock icon name. Examples are "gtk-dialog-error",
+-- "gtk-dialog-info", "gtk-dialog-question", and "gtk-dialog-warning". The dialog does not
+-- display an icon by default.
+-- * `icon_file`: The dialog's icon file path. This option has no effect when `icon` is set.
+-- * `no_cancel`: Do not display the "Cancel" button. The default value is `false`.
+-- * `string_output`: Return the selected button's label (instead of its index) or the dialog's
+-- exit status instead of the button's index (instead of its exit code). The default value is
-- `false`.
--- * `string_output`: Return the selected button's label (instead of its
--- index) or the dialog's exit status instead of the button's index (instead
--- of its exit code). The default value is `false`.
-- * `width`: The dialog's pixel width.
-- * `height`: The dialog's pixel height.
--- * `float`: Show the dialog on top of all desktop windows. The default value
--- is `false`.
--- * `timeout`: The integer number of seconds the dialog waits for the user to
--- select a button before timing out. Dialogs do not time out by default.
+-- * `float`: Show the dialog on top of all desktop windows. The default value is `false`.
+-- * `timeout`: The integer number of seconds the dialog waits for the user to select a button
+-- before timing out. Dialogs do not time out by default.
-- @return selected button or exit code
function ok_msgbox(options) end
---
--- Prompts the user with a generic message box dialog defined by dialog options
--- table *options* and with localized "Yes", "No", and "Cancel" buttons,
--- returning the selected button's index.
--- If *options*.`string_output` is `true`, returns the selected button's label.
--- If the dialog timed out, returns `0` or `"timeout"`. If the user canceled the
--- dialog, returns `-1` or `"delete"`.
+-- Prompts the user with a generic message box dialog defined by dialog options table *options*
+-- and with localized "Yes", "No", and "Cancel" buttons, returning the selected button's index.
+-- If *options*.`string_output` is `true`, returns the selected button's label. If the dialog timed
+-- out, returns `0` or `"timeout"`. If the user canceled the dialog, returns `-1` or `"delete"`.
-- @param options Table of key-value option pairs for the message box.
--
-- * `title`: The dialog's title text.
-- * `text`: The dialog's main message text.
-- * `informative_text`: The dialog's extra informative text.
--- * `icon`: The dialog's GTK stock icon name. Examples are
--- "gtk-dialog-error", "gtk-dialog-info", "gtk-dialog-question", and
--- "gtk-dialog-warning". The dialog does not display an icon by default.
--- * `icon_file`: The dialog's icon file path. This option has no effect when
--- `icon` is set.
--- * `no_cancel`: Do not display the "Cancel" button. The default value is
+-- * `icon`: The dialog's GTK stock icon name. Examples are "gtk-dialog-error",
+-- "gtk-dialog-info", "gtk-dialog-question", and "gtk-dialog-warning". The dialog does not
+-- display an icon by default.
+-- * `icon_file`: The dialog's icon file path. This option has no effect when `icon` is set.
+-- * `no_cancel`: Do not display the "Cancel" button. The default value is `false`.
+-- * `string_output`: Return the selected button's label (instead of its index) or the dialog's
+-- exit status instead of the button's index (instead of its exit code). The default value is
-- `false`.
--- * `string_output`: Return the selected button's label (instead of its
--- index) or the dialog's exit status instead of the button's index (instead
--- of its exit code). The default value is `false`.
-- * `width`: The dialog's pixel width.
-- * `height`: The dialog's pixel height.
--- * `float`: Show the dialog on top of all desktop windows. The default value
--- is `false`.
--- * `timeout`: The integer number of seconds the dialog waits for the user to
--- select a button before timing out. Dialogs do not time out by default.
+-- * `float`: Show the dialog on top of all desktop windows. The default value is `false`.
+-- * `timeout`: The integer number of seconds the dialog waits for the user to select a button
+-- before timing out. Dialogs do not time out by default.
-- @return selected button or exit code
function yesno_msgbox(options) end
---
--- Prompts the user with an inputbox dialog defined by dialog options table
--- *options*, returning the selected button's index along with the user's
--- input text (the latter as a string or table, depending on the type of
--- *options*.`informative_text`).
--- If *options*.`string_output` is `true`, returns the selected button's label
--- along with the user's input text.
--- If the dialog timed out, returns `0` or `"timeout"`. If the user canceled the
--- dialog, returns `-1` or `"delete"`.
+-- Prompts the user with an inputbox dialog defined by dialog options table *options*, returning
+-- the selected button's index along with the user's input text (the latter as a string or table,
+-- depending on the type of *options*.`informative_text`).
+-- If *options*.`string_output` is `true`, returns the selected button's label along with the
+-- user's input text. If the dialog timed out, returns `0` or `"timeout"`. If the user canceled
+-- the dialog, returns `-1` or `"delete"`.
-- @param options Table of key-value option pairs for the inputbox.
--
-- * `title`: The dialog's title text.
--- * `informative_text`: The dialog's main message text. If the value is a
--- table, the first table value is the main message text and any subsequent
--- values are used as the labels for multiple entry boxes. Providing a
--- single label has no effect.
--- * `text`: The dialog's initial input text. If the value is a table, the
--- table values are used to populate the multiple entry boxes defined by
--- `informative_text`.
--- * `button1`: The right-most button's label. The default value is
--- `_L['OK']`.
+-- * `informative_text`: The dialog's main message text. If the value is a table, the first
+-- table value is the main message text and any subsequent values are used as the labels
+-- for multiple entry boxes. Providing a single label has no effect.
+-- * `text`: The dialog's initial input text. If the value is a table, the table values are
+-- used to populate the multiple entry boxes defined by `informative_text`.
+-- * `button1`: The right-most button's label. The default value is `_L['OK']`.
-- * `button2`: The middle button's label.
--- * `button3`: The left-most button's label. This option requires `button2`
--- to be set.
--- * `string_output`: Return the selected button's label (instead of its
--- index) or the dialog's exit status instead of the button's index (instead
--- of its exit code). The default value is `false`.
+-- * `button3`: The left-most button's label. This option requires `button2` to be set.
+-- * `string_output`: Return the selected button's label (instead of its index) or the dialog's
+-- exit status instead of the button's index (instead of its exit code). The default value is
+-- `false`.
-- * `width`: The dialog's pixel width.
-- * `height`: The dialog's pixel height.
--- * `float`: Show the dialog on top of all desktop windows. The default value
--- is `false`.
--- * `timeout`: The integer number of seconds the dialog waits for the user to
--- select a button before timing out. Dialogs do not time out by default.
+-- * `float`: Show the dialog on top of all desktop windows. The default value is `false`.
+-- * `timeout`: The integer number of seconds the dialog waits for the user to select a button
+-- before timing out. Dialogs do not time out by default.
-- @return selected button or exit code, input text
-- @usage ui.dialogs.inputbox{title = 'Goto Line', informative_text = 'Line:',
-- text = '1'}
function inputbox(options) end
---
--- Prompts the user with an inputbox dialog defined by dialog options table
--- *options* and with localized "Ok" and "Cancel" buttons, returning the
--- selected button's index along with the user's input text (the latter as a
--- string or table, depending on the type of *options*.`informative_text`).
--- If *options*.`string_output` is `true`, returns the selected button's label
--- along with the user's input text.
--- If the dialog timed out, returns `0` or `"timeout"`. If the user canceled the
--- dialog, returns `-1` or `"delete"`.
+-- Prompts the user with an inputbox dialog defined by dialog options table *options* and
+-- with localized "Ok" and "Cancel" buttons, returning the selected button's index along
+-- with the user's input text (the latter as a string or table, depending on the type of
+-- *options*.`informative_text`).
+-- If *options*.`string_output` is `true`, returns the selected button's label along with the
+-- user's input text. If the dialog timed out, returns `0` or `"timeout"`. If the user canceled
+-- the dialog, returns `-1` or `"delete"`.
-- @param options Table of key-value option pairs for the inputbox.
--
-- * `title`: The dialog's title text.
--- * `informative_text`: The dialog's main message text. If the value is a
--- table, the first table value is the main message text and any subsequent
--- values are used as the labels for multiple entry boxes. Providing a
--- single label has no effect.
--- * `text`: The dialog's initial input text. If the value is a table, the
--- table values are used to populate the multiple entry boxes defined by
--- `informative_text`.
--- * `no_cancel`: Do not display the "Cancel" button. The default value is
+-- * `informative_text`: The dialog's main message text. If the value is a table, the first
+-- table value is the main message text and any subsequent values are used as the labels
+-- for multiple entry boxes. Providing a single label has no effect.
+-- * `text`: The dialog's initial input text. If the value is a table, the table values are
+-- used to populate the multiple entry boxes defined by `informative_text`.
+-- * `no_cancel`: Do not display the "Cancel" button. The default value is `false`.
+-- * `string_output`: Return the selected button's label (instead of its index) or the dialog's
+-- exit status instead of the button's index (instead of its exit code). The default value is
-- `false`.
--- * `string_output`: Return the selected button's label (instead of its
--- index) or the dialog's exit status instead of the button's index (instead
--- of its exit code). The default value is `false`.
-- * `width`: The dialog's pixel width.
-- * `height`: The dialog's pixel height.
--- * `float`: Show the dialog on top of all desktop windows. The default value
--- is `false`.
--- * `timeout`: The integer number of seconds the dialog waits for the user to
--- select a button before timing out. Dialogs do not time out by default.
+-- * `float`: Show the dialog on top of all desktop windows. The default value is `false`.
+-- * `timeout`: The integer number of seconds the dialog waits for the user to select a button
+-- before timing out. Dialogs do not time out by default.
-- @return selected button or exit code, input text
function standard_inputbox(options) end
---
--- Prompts the user with a masked inputbox dialog defined by dialog options
--- table *options*, returning the selected button's index along with the user's
--- input text (the latter as a string or table, depending on the type of
--- *options*.`informative_text`).
--- If *options*.`string_output` is `true`, returns the selected button's label
--- along with the user's input text.
--- If the dialog timed out, returns `0` or `"timeout"`. If the user canceled the
--- dialog, returns `-1` or `"delete"`.
+-- Prompts the user with a masked inputbox dialog defined by dialog options table *options*,
+-- returning the selected button's index along with the user's input text (the latter as a
+-- string or table, depending on the type of *options*.`informative_text`).
+-- If *options*.`string_output` is `true`, returns the selected button's label along with the
+-- user's input text. If the dialog timed out, returns `0` or `"timeout"`. If the user canceled
+-- the dialog, returns `-1` or `"delete"`.
-- @param options Table of key-value option pairs for the inputbox.
--
-- * `title`: The dialog's title text.
--- * `informative_text`: The dialog's main message text. If the value is a
--- table, the first table value is the main message text and any subsequent
--- values are used as the labels for multiple entry boxes. Providing a
--- single label has no effect.
--- * `text`: The dialog's initial input text. If the value is a table, the
--- table values are used to populate the multiple entry boxes defined by
--- `informative_text`.
--- * `button1`: The right-most button's label. The default value is
--- `_L['OK']`.
+-- * `informative_text`: The dialog's main message text. If the value is a table, the first
+-- table value is the main message text and any subsequent values are used as the labels
+-- for multiple entry boxes. Providing a single label has no effect.
+-- * `text`: The dialog's initial input text. If the value is a table, the table values are
+-- used to populate the multiple entry boxes defined by `informative_text`.
+-- * `button1`: The right-most button's label. The default value is `_L['OK']`.
-- * `button2`: The middle button's label.
--- * `button3`: The left-most button's label. This option requires `button2`
--- to be set.
--- * `string_output`: Return the selected button's label (instead of its
--- index) or the dialog's exit status instead of the button's index (instead
--- of its exit code). The default value is `false`.
+-- * `button3`: The left-most button's label. This option requires `button2` to be set.
+-- * `string_output`: Return the selected button's label (instead of its index) or the dialog's
+-- exit status instead of the button's index (instead of its exit code). The default value is
+-- `false`.
-- * `width`: The dialog's pixel width.
-- * `height`: The dialog's pixel height.
--- * `float`: Show the dialog on top of all desktop windows. The default value
--- is `false`.
--- * `timeout`: The integer number of seconds the dialog waits for the user to
--- select a button before timing out. Dialogs do not time out by default.
+-- * `float`: Show the dialog on top of all desktop windows. The default value is `false`.
+-- * `timeout`: The integer number of seconds the dialog waits for the user to select a button
+-- before timing out. Dialogs do not time out by default.
-- @return selected button or exit code, input text
function secure_inputbox(options) end
---
--- Prompts the user with a masked inputbox dialog defined by dialog options
--- table *options* and with localized "Ok" and "Cancel" buttons, returning the
--- selected button's index along with the user's input text (the latter as a
--- string or table, depending on the type of *options*.`informative_text`).
--- If *options*.`string_output` is `true`, returns the selected button's label
--- along with the user's input text.
--- If the dialog timed out, returns `0` or `"timeout"`. If the user canceled the
--- dialog, returns `-1` or `"delete"`.
+-- Prompts the user with a masked inputbox dialog defined by dialog options table *options*
+-- and with localized "Ok" and "Cancel" buttons, returning the selected button's index along
+-- with the user's input text (the latter as a string or table, depending on the type of
+-- *options*.`informative_text`).
+-- If *options*.`string_output` is `true`, returns the selected button's label along with the
+-- user's input text. If the dialog timed out, returns `0` or `"timeout"`. If the user canceled
+-- the dialog, returns `-1` or `"delete"`.
-- @param options Table of key-value option pairs for the inputbox.
--
-- * `title`: The dialog's title text.
--- * `informative_text`: The dialog's main message text. If the value is a
--- table, the first table value is the main message text and any subsequent
--- values are used as the labels for multiple entry boxes. Providing a
--- single label has no effect.
--- * `text`: The dialog's initial input text. If the value is a table, the
--- table values are used to populate the multiple entry boxes defined by
--- `informative_text`.
--- * `no_cancel`: Do not display the "Cancel" button. The default value is
+-- * `informative_text`: The dialog's main message text. If the value is a table, the first
+-- table value is the main message text and any subsequent values are used as the labels
+-- for multiple entry boxes. Providing a single label has no effect.
+-- * `text`: The dialog's initial input text. If the value is a table, the table values are
+-- used to populate the multiple entry boxes defined by `informative_text`.
+-- * `no_cancel`: Do not display the "Cancel" button. The default value is `false`.
+-- * `string_output`: Return the selected button's label (instead of its index) or the dialog's
+-- exit status instead of the button's index (instead of its exit code). The default value is
-- `false`.
--- * `string_output`: Return the selected button's label (instead of its
--- index) or the dialog's exit status instead of the button's index (instead
--- of its exit code). The default value is `false`.
-- * `width`: The dialog's pixel width.
-- * `height`: The dialog's pixel height.
--- * `float`: Show the dialog on top of all desktop windows. The default value
--- is `false`.
--- * `timeout`: The integer number of seconds the dialog waits for the user to
--- select a button before timing out. Dialogs do not time out by default.
+-- * `float`: Show the dialog on top of all desktop windows. The default value is `false`.
+-- * `timeout`: The integer number of seconds the dialog waits for the user to select a button
+-- before timing out. Dialogs do not time out by default.
-- @return selected button or exit code, input text
function secure_standard_inputbox(options) end
---
--- Prompts the user with a file selection dialog defined by dialog options
--- table *options*, returning the string file selected.
--- If *options*.`select_multiple` is `true`, returns the list of files selected.
--- If the user canceled the dialog, returns `nil`.
+-- Prompts the user with a file selection dialog defined by dialog options table *options*,
+-- returning the string file selected.
+-- If *options*.`select_multiple` is `true`, returns the list of files selected. If the user
+-- canceled the dialog, returns `nil`.
-- @param options Table of key-value option pairs for the dialog.
--
-- * `title`: The dialog's title text.
-- * `with_directory`: The initial filesystem directory to show.
--- * `with_file`: The initially selected filename. This option requires
--- `with_directory` to be set.
+-- * `with_file`: The initially selected filename. This option requires `with_directory`
+-- to be set.
-- * `with_extension`: The list of extensions selectable files must have.
--- * `select_multiple`: Allow the user to select multiple files. The default
--- value is `false`.
--- * `select_only_directories`: Only allow the user to select directories. The
--- default value is `false`.
+-- * `select_multiple`: Allow the user to select multiple files. The default value is `false`.
+-- * `select_only_directories`: Only allow the user to select directories. The default value is
+-- `false`.
-- @return filename, list of filenames, or nil
-- @usage ui.dialogs.fileselect{title = 'Open C File', with_directory = _HOME,
-- with_extension = {'c', 'h'}, select_multiple = true}
function fileselect(options) end
---
--- Prompts the user with a file save dialog defined by dialog options table
--- *options*, returning the string file chosen.
+-- Prompts the user with a file save dialog defined by dialog options table *options*, returning
+-- the string file chosen.
-- If the user canceled the dialog, returns `nil`.
-- @param options Table of key-value option pairs for the dialog.
--
-- * `title`: The dialog's title text.
-- * `with_directory`: The initial filesystem directory to show.
--- * `with_file`: The initially chosen filename. This option requires
--- `with_directory` to be set.
+-- * `with_file`: The initially chosen filename. This option requires `with_directory` to be set.
-- * `with_extension`: The list of extensions selectable files must have.
--- * `no_create_directories`: Prevent the user from creating new directories.
--- The default value is `false`.
+-- * `no_create_directories`: Prevent the user from creating new directories. The default
+-- value is `false`.
-- @return filename or nil
function filesave(options) end
---
--- Prompts the user with a multiple-line textbox dialog defined by dialog
--- options table *options*, returning the selected button's index.
--- If *options*.`string_output` is `true`, returns the selected button's label.
--- If *options*.`editable` is `true`, also returns the textbox's text. If the
--- dialog timed out, returns `0` or `"timeout"`. If the user canceled the
--- dialog, returns `-1` or `"delete"`.
+-- Prompts the user with a multiple-line textbox dialog defined by dialog options table *options*,
+-- returning the selected button's index.
+-- If *options*.`string_output` is `true`, returns the selected button's label. If
+-- *options*.`editable` is `true`, also returns the textbox's text. If the dialog timed out,
+-- returns `0` or `"timeout"`. If the user canceled the dialog, returns `-1` or `"delete"`.
-- @param options Table of key-value option pairs for the dialog.
--
-- * `title`: The dialog's title text.
-- * `informative_text`: The dialog's main message text.
-- * `text`: The dialog's initial textbox text.
--- * `text_from_file`: The filename whose contents are loaded into the
--- textbox. This option has no effect when `text` is given.
--- * `button1`: The right-most button's label. The default value is
--- `_L['OK']`.
+-- * `text_from_file`: The filename whose contents are loaded into the textbox. This option
+-- has no effect when `text` is given.
+-- * `button1`: The right-most button's label. The default value is `_L['OK']`.
-- * `button2`: The middle button's label.
--- * `button3`: The left-most button's label. This option requires `button2`
--- to be set.
--- * `editable`: Allows the user to edit the textbox's text. The default value
--- is `false`.
--- * `focus_textbox`: Focus the textbox instead of the buttons. The default
--- value is `false`.
--- * `scroll_to`: Where to scroll the textbox's text.
--- The available values are `"top"` and `"bottom"`. The default value is
--- `"top"`.
--- * `selected`: Select all of the textbox's text. The default value is
+-- * `button3`: The left-most button's label. This option requires `button2` to be set.
+-- * `editable`: Allows the user to edit the textbox's text. The default value is `false`.
+-- * `focus_textbox`: Focus the textbox instead of the buttons. The default value is `false`.
+-- * `scroll_to`: Where to scroll the textbox's text. The available values are `"top"` and
+-- `"bottom"`. The default value is `"top"`.
+-- * `selected`: Select all of the textbox's text. The default value is `false`.
+-- * `monospaced_font`: Use a monospaced font in the textbox instead of a proportional one. The
+-- default value is `false`.
+-- * `string_output`: Return the selected button's label (instead of its index) or the dialog's
+-- exit status instead of the button's index (instead of its exit code). The default value is
-- `false`.
--- * `monospaced_font`: Use a monospaced font in the textbox instead of a
--- proportional one. The default value is `false`.
--- * `string_output`: Return the selected button's label (instead of its
--- index) or the dialog's exit status instead of the button's index (instead
--- of its exit code). The default value is `false`.
-- * `width`: The dialog's pixel width.
-- * `height`: The dialog's pixel height.
--- * `float`: Show the dialog on top of all desktop windows. The default value
--- is `false`.
--- * `timeout`: The integer number of seconds the dialog waits for the user to
--- select a button before timing out. Dialogs do not time out by default.
+-- * `float`: Show the dialog on top of all desktop windows. The default value is `false`.
+-- * `timeout`: The integer number of seconds the dialog waits for the user to select a button
+-- before timing out. Dialogs do not time out by default.
-- @return selected button or exit code, textbox text
--- @usage ui.dialogs.textbox{title = 'License Agreement',
--- informative_text = 'You agree to:', text_from_file = _HOME..'/LICENSE'}
+-- @usage ui.dialogs.textbox{title = 'License Agreement', informative_text = 'You agree to:',
+-- text_from_file = _HOME..'/LICENSE'}
function textbox(options) end
---
--- Displays a progressbar dialog, defined by dialog options table *options*,
--- that receives updates from function *f*.
--- Returns "stopped" if *options*.`stoppable` is `true` and the user clicked the
--- "Stop" button. Otherwise, returns `nil`.
+-- Displays a progressbar dialog, defined by dialog options table *options*, that receives
+-- updates from function *f*.
+-- Returns "stopped" if *options*.`stoppable` is `true` and the user clicked the "Stop"
+-- button. Otherwise, returns `nil`.
-- @param options Table of key-value option pairs for the progressbar dialog.
--
-- * `title`: The dialog's title text.
-- * `percent`: The initial progressbar percentage between 0 and 100.
-- * `text`: The initial progressbar display text (GTK only).
--- * `indeterminate`: Show the progress bar as "busy", with no percentage
--- updates.
+-- * `indeterminate`: Show the progress bar as "busy", with no percentage updates.
-- * `stoppable`: Show the "Stop" button.
-- * `width`: The dialog's pixel width.
-- * `height`: The dialog's pixel height.
--- @param f Function repeatedly called to do work and provide progress updates.
--- The function is called without arguments and must return either `nil`,
--- which indicates work is complete, or a progress percentage number in the
--- range 0-100 and an optional string to display (GTK only). If the text is
--- either "stop disable" or "stop enable" and *options*.`stoppable` is `true`,
--- the "Stop" button is disabled or enabled, respectively.
+-- @param f Function repeatedly called to do work and provide progress updates. The function is
+-- called without arguments and must return either `nil`, which indicates work is complete,
+-- or a progress percentage number in the range 0-100 and an optional string to display (GTK
+-- only). If the text is either "stop disable" or "stop enable" and *options*.`stoppable` is
+-- `true`, the "Stop" button is disabled or enabled, respectively.
-- @return nil or "stopped"
-- @usage ui.dialogs.progressbar({stoppable = true},
-- function() if work() then return percent, status else return nil end end)
function progressbar(options, f) end
---
--- Prompts the user with a drop-down item selection dialog defined by dialog
--- options table *options*, returning the selected button's index along with the
--- index of the selected item.
--- If *options*.`string_output` is `true`, returns the selected button's label
--- along with the selected item's text.
--- If the dialog closed due to *options*.`exit_onchange`, returns `4` along with
--- either the selected item's index or its text. If the dialog timed out,
--- returns `0` or `"timeout"`. If the user canceled the dialog, returns `-1` or
--- `"delete"`.
+-- Prompts the user with a drop-down item selection dialog defined by dialog options table
+-- *options*, returning the selected button's index along with the index of the selected item.
+-- If *options*.`string_output` is `true`, returns the selected button's label along with the
+-- selected item's text. If the dialog closed due to *options*.`exit_onchange`, returns `4`
+-- along with either the selected item's index or its text. If the dialog timed out, returns
+-- `0` or `"timeout"`. If the user canceled the dialog, returns `-1` or `"delete"`.
-- @param options Table of key-value option pairs for the drop-down dialog.
--
-- * `title`: The dialog's title text.
-- * `text`: The dialog's main message text.
-- * `items`: The list of string items to show in the drop-down.
--- * `button1`: The right-most button's label. The default value is
--- `_L['OK']`.
+-- * `button1`: The right-most button's label. The default value is `_L['OK']`.
-- * `button2`: The middle button's label.
--- * `button3`: The left-most button's label. This option requires `button2`
--- to be set.
--- * `exit_onchange`: Close the dialog after selecting a new item. The default
--- value is `false`.
--- * `select`: The index of the initially selected list item. The default
--- value is `1`.
--- * `string_output`: Return the selected button's label (instead of its
--- index) and the selected item's text (instead of its index). If no item
--- was selected, returns the dialog's exit status (instead of its exit
--- code). The default value is `false`.
+-- * `button3`: The left-most button's label. This option requires `button2` to be set.
+-- * `exit_onchange`: Close the dialog after selecting a new item. The default value is `false`.
+-- * `select`: The index of the initially selected list item. The default value is `1`.
+-- * `string_output`: Return the selected button's label (instead of its index) and the selected
+-- item's text (instead of its index). If no item was selected, returns the dialog's exit
+-- status (instead of its exit code). The default value is `false`.
-- * `width`: The dialog's pixel width.
-- * `height`: The dialog's pixel height.
--- * `float`: Show the dialog on top of all desktop windows. The default value
--- is `false`.
--- * `timeout`: The integer number of seconds the dialog waits for the user to
--- select a button before timing out. Dialogs do not time out by default.
+-- * `float`: Show the dialog on top of all desktop windows. The default value is `false`.
+-- * `timeout`: The integer number of seconds the dialog waits for the user to select a button
+-- before timing out. Dialogs do not time out by default.
-- @return selected button or exit code, selected item
--- @usage ui.dialogs.dropdown{title = 'Select Encoding', width = 200,
--- items = io.encodings, string_output = true}
+-- @usage ui.dialogs.dropdown{title = 'Select Encoding', width = 200, items = io.encodings,
+-- string_output = true}
function dropdown(options) end
---
--- Prompts the user with a drop-down item selection dialog defined by dialog
--- options table *options* and with localized "Ok" and "Cancel" buttons,
--- returning the selected button's index along with the selected item's index.
--- If *options*.`string_output` is `true`, returns the selected button's label
--- along with the selected item's text.
--- If the dialog closed due to *options*.`exit_onchange`, returns `4` along with
--- either the selected item's index or its text. If the dialog timed out,
--- returns `0` or `"timeout"`. If the user canceled the dialog, returns `-1` or
--- `"delete"`.
+-- Prompts the user with a drop-down item selection dialog defined by dialog options table
+-- *options* and with localized "Ok" and "Cancel" buttons, returning the selected button's
+-- index along with the selected item's index.
+-- If *options*.`string_output` is `true`, returns the selected button's label along with the
+-- selected item's text. If the dialog closed due to *options*.`exit_onchange`, returns `4`
+-- along with either the selected item's index or its text. If the dialog timed out, returns
+-- `0` or `"timeout"`. If the user canceled the dialog, returns `-1` or `"delete"`.
-- @param options Table of key-value option pairs for the drop-down dialog.
--
-- * `title`: The dialog's title text.
-- * `text`: The dialog's main message text.
-- * `items`: The list of string items to show in the drop-down.
--- * `no_cancel`: Do not display the "Cancel" button. The default value is
--- `false`.
--- * `exit_onchange`: Close the dialog after selecting a new item. The default
--- value is `false`.
--- * `select`: The index of the initially selected list item. The default
--- value is `1`.
--- * `string_output`: Return the selected button's label (instead of its
--- index) and the selected item's text (instead of its index). If no item
--- was selected, returns the dialog's exit status (instead of its exit
--- code). The default value is `false`.
+-- * `no_cancel`: Do not display the "Cancel" button. The default value is `false`.
+-- * `exit_onchange`: Close the dialog after selecting a new item. The default value is `false`.
+-- * `select`: The index of the initially selected list item. The default value is `1`.
+-- * `string_output`: Return the selected button's label (instead of its index) and the selected
+-- item's text (instead of its index). If no item was selected, returns the dialog's exit
+-- status (instead of its exit code). The default value is `false`.
-- * `width`: The dialog's pixel width.
-- * `height`: The dialog's pixel height.
--- * `float`: Show the dialog on top of all desktop windows. The default value
--- is `false`.
--- * `timeout`: The integer number of seconds the dialog waits for the user to
--- select a button before timing out. Dialogs do not time out by default.
+-- * `float`: Show the dialog on top of all desktop windows. The default value is `false`.
+-- * `timeout`: The integer number of seconds the dialog waits for the user to select a button
+-- before timing out. Dialogs do not time out by default.
-- @return selected button or exit code, selected item
function standard_dropdown(options) end
---
--- Prompts the user with a filtered list item selection dialog defined by dialog
--- options table *options*, returning the selected button's index along with the
--- index or indices of the selected item or items (depending on whether or not
--- *options*.`select_multiple` is `true`).
--- If *options*.`string_output` is `true`, returns the selected button's label
--- along with the text of the selected item or items.
--- If the dialog timed out, returns `0` or `"timeout"`. If the user canceled the
--- dialog, returns `-1` or `"delete"`.
+-- Prompts the user with a filtered list item selection dialog defined by dialog options table
+-- *options*, returning the selected button's index along with the index or indices of the
+-- selected item or items (depending on whether or not *options*.`select_multiple` is `true`).
+-- If *options*.`string_output` is `true`, returns the selected button's label along with the
+-- text of the selected item or items. If the dialog timed out, returns `0` or `"timeout"`. If
+-- the user canceled the dialog, returns `-1` or `"delete"`.
-- Spaces in the filter text are treated as wildcards.
-- @param options Table of key-value option pairs for the filtered list dialog.
--
@@ -440,64 +370,51 @@ function standard_dropdown(options) end
-- * `text`: The dialog's initial input text.
-- * `columns`: The list of string column names for list rows.
-- * `items`: The list of string items to show in the filtered list.
--- * `button1`: The right-most button's label. The default value is
--- `_L['OK']`.
+-- * `button1`: The right-most button's label. The default value is `_L['OK']`.
-- * `button2`: The middle button's label.
--- * `button3`: The left-most button's label. This option requires `button2`
--- to be set.
--- * `select_multiple`: Allow the user to select multiple items. The default
--- value is `false`.
--- * `search_column`: The column number to filter the input text against. The
--- default value is `1`. This option requires `columns` to be set and
--- contain at least *n* column names.
--- * `output_column`: The column number to use for `string_output`. The
--- default value is `1`. This option requires `columns` to be set and
--- contain at least *n* column names.
--- * `string_output`: Return the selected button's label (instead of its
--- index) and the selected item's text (instead of its index). If no item
--- was selected, returns the dialog's exit status (instead of its exit
--- code). The default value is `false`.
--- * `width`: The dialog's pixel width. The default width stretches nearly the
--- width of Textadept's window.
+-- * `button3`: The left-most button's label. This option requires `button2` to be set.
+-- * `select_multiple`: Allow the user to select multiple items. The default value is `false`.
+-- * `search_column`: The column number to filter the input text against. The default value is
+-- `1`. This option requires `columns` to be set and contain at least *n* column names.
+-- * `output_column`: The column number to use for `string_output`. The default value is
+-- `1`. This option requires `columns` to be set and contain at least *n* column names.
+-- * `string_output`: Return the selected button's label (instead of its index) and the selected
+-- item's text (instead of its index). If no item was selected, returns the dialog's exit
+-- status (instead of its exit code). The default value is `false`.
+-- * `width`: The dialog's pixel width. The default width stretches nearly the width of
+-- Textadept's window.
-- * `height`: The dialog's pixel height.
--- * `float`: Show the dialog on top of all desktop windows. The default value
--- is `false`.
--- * `timeout`: The integer number of seconds the dialog waits for the user to
--- select a button before timing out. Dialogs do not time out by default.
+-- * `float`: Show the dialog on top of all desktop windows. The default value is `false`.
+-- * `timeout`: The integer number of seconds the dialog waits for the user to select a button
+-- before timing out. Dialogs do not time out by default.
-- @return selected button or exit code, selected item or list of selected items
-- @usage ui.dialogs.filteredlist{title = 'Title', columns = {'Foo', 'Bar'},
-- items = {'a', 'b', 'c', 'd'}}
function filteredlist(options) end
---
--- Prompts the user with an option selection dialog defined by dialog options
--- table *options*, returning the selected button's index along with the indices
--- of the selected options.
--- If *options*.`string_output` is `true`, returns the selected button's label
--- along with the text of the selected options.
--- If the dialog timed out, returns `0` or `"timeout"`. If the user canceled the
--- dialog, returns `-1` or `"delete"`.
+-- Prompts the user with an option selection dialog defined by dialog options table *options*,
+-- returning the selected button's index along with the indices of the selected options.
+-- If *options*.`string_output` is `true`, returns the selected button's label along with the
+-- text of the selected options. If the dialog timed out, returns `0` or `"timeout"`. If the
+-- user canceled the dialog, returns `-1` or `"delete"`.
-- @param options Table of key-value option pairs for the option select dialog.
--
-- * `title`: The dialog's title text.
-- * `text`: The dialog's main message text.
-- * `items`: The list of string options to show in the option group.
--- * `button1`: The right-most button's label. The default value is
--- `_L['OK']`.
+-- * `button1`: The right-most button's label. The default value is `_L['OK']`.
-- * `button2`: The middle button's label.
--- * `button3`: The left-most button's label. This option requires `button2`
--- to be set.
+-- * `button3`: The left-most button's label. This option requires `button2` to be set.
-- * `select`: The indices of initially selected options.
--- * `string_output`: Return the selected button's label or the dialog's exit
--- status along with the selected options' text instead of the button's
--- index or the dialog's exit code along with the options' indices. The
--- default value is `false`.
+-- * `string_output`: Return the selected button's label or the dialog's exit status along
+-- with the selected options' text instead of the button's index or the dialog's exit code
+-- along with the options' indices. The default value is `false`.
-- * `width`: The dialog's pixel width.
-- * `height`: The dialog's pixel height.
--- * `float`: Show the dialog on top of all desktop windows. The default value
--- is `false`.
--- * `timeout`: The integer number of seconds the dialog waits for the user to
--- select a button before timing out. Dialogs do not time out by default.
+-- * `float`: Show the dialog on top of all desktop windows. The default value is `false`.
+-- * `timeout`: The integer number of seconds the dialog waits for the user to select a button
+-- before timing out. Dialogs do not time out by default.
-- @return selected button or exit code, list of selected options
-- @usage ui.dialogs.optionselect{title = 'Language',
-- informative_text = 'Check the languages you understand',
@@ -505,30 +422,28 @@ function filteredlist(options) end
function optionselect(options) end
---
--- Prompts the user with a color selection dialog defined by dialog options
--- table *options*, returning the color selected.
+-- Prompts the user with a color selection dialog defined by dialog options table *options*,
+-- returning the color selected.
-- If the user canceled the dialog, returns `nil`.
-- @param options Table of key-value option pairs for the option select dialog.
--
-- * `title`: The dialog's title text.
--- * `color`: The initially selected color as either a number in "0xBBGGRR"
--- format, or as a string in "#RRGGBB" format.
--- * `palette`: The list of colors to show in the dialog's color palette.
--- Up to 20 colors can be specified as either numbers in "0xBBGGRR" format
--- or as strings in "#RRGGBB" format. If `true` (no list was given), a
--- default palette is shown.
--- * `string_output`: Return the selected color in string "#RRGGBB" format
--- instead of as a number. The default value is `false`.
--- * `float`: Show the dialog on top of all desktop windows. The default value
--- is `false`.
+-- * `color`: The initially selected color as either a number in "0xBBGGRR" format, or as a
+-- string in "#RRGGBB" format.
+-- * `palette`: The list of colors to show in the dialog's color palette. Up to 20 colors can
+-- be specified as either numbers in "0xBBGGRR" format or as strings in "#RRGGBB" format. If
+-- `true` (no list was given), a default palette is shown.
+-- * `string_output`: Return the selected color in string "#RRGGBB" format instead of as a
+-- number. The default value is `false`.
+-- * `float`: Show the dialog on top of all desktop windows. The default value is `false`.
-- @return selected color
-- @usage ui.dialogs.colorselect{title = 'Foreground color', color = 0x000000,
-- palette = {'#000000', 0x0000FF, '#00FF00', 0xFF0000}}
function colorselect(options) end
---
--- Prompts the user with a font selection dialog defined by dialog options
--- table *options*, returning the font selected (including style and size).
+-- Prompts the user with a font selection dialog defined by dialog options table *options*,
+-- returning the font selected (including style and size).
-- If the user canceled the dialog, returns `nil`.
-- @param options Table of key-value option pairs for the option select dialog.
--
@@ -536,12 +451,9 @@ function colorselect(options) end
-- * `text`: The font preview text.
-- * `font_name`: The initially selected font name.
-- * `font_size`: The initially selected font size. The default value is `12`.
--- * `font_style`: The initially selected font style. The available options
--- are `"regular"`, `"bold"`, `"italic"`, and `"bold italic"`. The default
--- value is `"regular"`.
--- * `float`: Show the dialog on top of all desktop windows. The default value
--- is `false`.
+-- * `font_style`: The initially selected font style. The available options are `"regular"`,
+-- `"bold"`, `"italic"`, and `"bold italic"`. The default value is `"regular"`.
+-- * `float`: Show the dialog on top of all desktop windows. The default value is `false`.
-- @return selected font, including style and size
--- @usage ui.dialogs.fontselect{title = 'Font', font_name = 'Monospace',
--- font_size = 10}
+-- @usage ui.dialogs.fontselect{title = 'Font', font_name = 'Monospace', font_size = 10}
function fontselect(options) end
diff --git a/core/.view.luadoc b/core/.view.luadoc
index 8fb460de..88d9e218 100644
--- a/core/.view.luadoc
+++ b/core/.view.luadoc
@@ -4,17 +4,15 @@
---
-- A Textadept view object.
-- Constants are documented in the fields they apply to.
--- While you can work with individual view instances, it is often useful to work
--- with just the global one.
--- Many of these functions and fields are derived from view-specific
--- functionality of the Scintilla editing component, and additional information
--- can be found on the
--- [Scintilla website](https://scintilla.org/ScintillaDoc.html).
--- Note that with regard to Scintilla-specific functionality, this API is a
--- _suggestion_, not a hard requirement. All of that functionality also exists
--- in [`buffer`](), even if undocumented.
--- Any view fields set on startup (e.g. in *~/.textadept/init.lua*) will be the
--- default, initial values for all views.
+-- While you can work with individual view instances, it is often useful to work with just the
+-- global one.
+-- Many of these functions and fields are derived from view-specific functionality of the
+-- Scintilla editing component, and additional information can be found on the [Scintilla
+-- website](https://scintilla.org/ScintillaDoc.html). Note that with regard to Scintilla-specific
+-- functionality, this API is a _suggestion_, not a hard requirement. All of that functionality
+-- also exists in [`buffer`](), even if undocumented.
+-- Any view fields set on startup (e.g. in *~/.textadept/init.lua*) will be the default,
+-- initial values for all views.
-- @field additional_caret_fore (number)
-- The foreground color, in "0xBBGGRR" format, of additional carets.
-- @field additional_carets_blink (bool)
@@ -24,8 +22,7 @@
-- Display additional carets.
-- The default value is `true`.
-- @field additional_sel_alpha (number)
--- The alpha value, ranging from `0` (transparent) to `255` (opaque), of
--- additional selections.
+-- The alpha value, ranging from `0` (transparent) to `255` (opaque), of additional selections.
-- The default value is `view.ALPHA_NOALPHA`, for no alpha.
-- @field additional_sel_back (number, Write-only)
-- The background color, in "0xBBGGRR" format, of additional selections.
@@ -43,20 +40,17 @@
-- * `view.ANNOTATION_STANDARD`
-- Draw annotations left-justified with no decoration.
-- * `view.ANNOTATION_BOXED`
--- Indent annotations to match the annotated text and outline them with a
--- box.
+-- Indent annotations to match the annotated text and outline them with a box.
-- * `view.ANNOTATION_INDENTED`
-- Indent non-decorated annotations to match the annotated text.
--
-- The default value is `view.ANNOTATION_HIDDEN`.
-- @field auto_c_max_height (number)
--- The maximum number of items per page to show in autocompletion and user
--- lists. The default value is `5`.
+-- The maximum number of items per page to show in autocompletion and user lists.
+-- The default value is `5`.
-- @field auto_c_max_width (number)
--- The maximum number of characters per item to show in autocompletion and
--- user lists.
--- The default value is `0`, which automatically sizes the width to fit the
--- longest item.
+-- The maximum number of characters per item to show in autocompletion and user lists.
+-- The default value is `0`, which automatically sizes the width to fit the longest item.
-- @field call_tip_fore_hlt (number, Write-only)
-- A call tip's highlighted text foreground color, in "0xBBGGRR" format.
-- @field call_tip_pos_start (number, Write-only)
@@ -66,31 +60,27 @@
-- The default value is `false`.
-- @field call_tip_use_style (number)
-- The pixel width of tab characters in call tips.
--- When non-zero, also enables the use of style number `view.STYLE_CALLTIP`
--- instead of `view.STYLE_DEFAULT` for call tip styles.
+-- When non-zero, also enables the use of style number `view.STYLE_CALLTIP` instead of
+-- `view.STYLE_DEFAULT` for call tip styles.
-- The default value is `0`.
-- @field caret_fore (number)
-- The caret's foreground color, in "0xBBGGRR" format.
-- @field caret_line_back (number)
--- The background color, in "0xBBGGRR" format, of the line that contains the
--- caret.
+-- The background color, in "0xBBGGRR" format, of the line that contains the caret.
-- @field caret_line_back_alpha (number)
--- The caret line's background alpha value, ranging from `0` (transparent) to
--- `255` (opaque).
+-- The caret line's background alpha value, ranging from `0` (transparent) to `255` (opaque).
-- The default value is `view.ALPHA_NOALPHA`, for no alpha.
-- @field caret_line_frame (number)
-- The caret line's frame width in pixels.
--- When non-zero, the line that contains the caret is framed instead of
--- colored in. The `view.caret_line_back` and `view.caret_line_back_alpha`
--- properties apply to the frame.
+-- When non-zero, the line that contains the caret is framed instead of colored in. The
+-- `view.caret_line_back` and `view.caret_line_back_alpha` properties apply to the frame.
-- The default value is `0`.
-- @field caret_line_visible (bool)
-- Color the background of the line that contains the caret a different color.
-- The default value is `false`.
-- @field caret_line_visible_always (bool)
-- Always show the caret line, even when the view is not in focus.
--- The default value is `false`, showing the line only when the view is in
--- focus.
+-- The default value is `false`, showing the line only when the view is in focus.
-- @field caret_period (number)
-- The time between caret blinks in milliseconds.
-- A value of `0` stops blinking.
@@ -105,9 +95,8 @@
-- * `view.CARETSTYLE_BLOCK`
-- A block caret.
--
--- Any block setting may be combined with `view.CARETSTYLE_BLOCK_AFTER` via
--- bitwise OR (`|`) in order to draw the caret after the end of a selection,
--- as opposed to just inside it.
+-- Any block setting may be combined with `view.CARETSTYLE_BLOCK_AFTER` via bitwise OR (`|`)
+-- in order to draw the caret after the end of a selection, as opposed to just inside it.
--
-- The default value is `view.CARETSTYLE_LINE`.
-- @field caret_width (number)
@@ -127,8 +116,8 @@
--
-- The default value is `view.CURSORNORMAL`.
-- @field edge_color (number)
--- The color, in "0xBBGGRR" format, of the single edge or background for long
--- lines according to `view.edge_mode`.
+-- The color, in "0xBBGGRR" format, of the single edge or background for long lines according
+-- to `view.edge_mode`.
-- @field edge_column (number)
-- The column number to mark long lines at.
-- @field edge_mode (number)
@@ -137,11 +126,11 @@
-- * `view.EDGE_NONE`
-- Long lines are not marked.
-- * `view.EDGE_LINE`
--- Draw a single vertical line whose color is [`view.edge_color`]() at
--- column [`view.edge_column`]().
+-- Draw a single vertical line whose color is [`view.edge_color`]() at column
+-- [`view.edge_column`]().
-- * `view.EDGE_BACKGROUND`
--- Change the background color of text after column [`view.edge_column`]()
--- to [`view.edge_color`]().
+-- Change the background color of text after column [`view.edge_column`]() to
+-- [`view.edge_color`]().
-- * `view.EDGE_MULTILINE`
-- Draw vertical lines whose colors and columns are defined by calls to
-- [`view:multi_edge_add_line()`]().
@@ -179,10 +168,10 @@
--
-- The default value is `view.FOLDDISPLAYTEXT_HIDDEN`.
-- @field fold_expanded (table)
--- Table of flags per line number that indicate whether or not fold points are
--- expanded for those line numbers.
--- Setting expanded fold states does not toggle folds; it only updates fold
--- margin markers. Use [`view.toggle_fold()`]() instead.
+-- Table of flags per line number that indicate whether or not fold points are expanded for
+-- those line numbers.
+-- Setting expanded fold states does not toggle folds; it only updates fold margin markers. Use
+-- [`view.toggle_fold()`]() instead.
-- @field fold_flags (number, Read-only)
-- Bit-mask of folding lines to draw in the buffer.
--
@@ -206,8 +195,8 @@
-- Display the horizontal scroll bar.
-- The default value is `true`.
-- @field highlight_guide (number)
--- The indentation guide column number to also highlight when highlighting
--- matching braces, or `0` to stop indentation guide highlighting.
+-- The indentation guide column number to also highlight when highlighting matching braces,
+-- or `0` to stop indentation guide highlighting.
-- @field idle_styling (number)
-- The idle styling mode.
-- This mode has no effect when `view.wrap_mode` is on.
@@ -215,8 +204,8 @@
-- * `view.IDLESTYLING_NONE`
-- Style all the currently visible text before displaying it.
-- * `view.IDLESTYLING_TOVISIBLE`
--- Style some text before displaying it and then style the rest
--- incrementally in the background as an idle-time task.
+-- Style some text before displaying it and then style the rest incrementally in the
+-- background as an idle-time task.
-- * `view.IDLESTYLING_AFTERVISIBLE`
-- Style text after the currently visible portion in the background.
-- * `view.IDLESTYLING_ALL`
@@ -225,45 +214,42 @@
-- The default value is `view.IDLESTYLING_NONE`.
-- @field indentation_guides (number)
-- The indentation guide drawing mode.
--- Indentation guides are dotted vertical lines that appear within indentation
--- whitespace at each level of indentation.
+-- Indentation guides are dotted vertical lines that appear within indentation whitespace at
+-- each level of indentation.
--
-- * `view.IV_NONE`
-- Does not draw any guides.
-- * `view.IV_REAL`
-- Draw guides only within indentation whitespace.
-- * `view.IV_LOOKFORWARD`
--- Draw guides beyond the current line up to the next non-empty line's
--- indentation level, but with an additional level if the previous non-empty
--- line is a fold point.
+-- Draw guides beyond the current line up to the next non-empty line's indentation level,
+-- but with an additional level if the previous non-empty line is a fold point.
-- * `view.IV_LOOKBOTH`
--- Draw guides beyond the current line up to either the indentation level of
--- the previous or next non-empty line, whichever is greater.
+-- Draw guides beyond the current line up to either the indentation level of the previous
+-- or next non-empty line, whichever is greater.
--
-- The default value is `view.IV_NONE`.
-- @field indic_alpha (table)
--- Table of fill color alpha values, ranging from `0` (transparent) to `255`
--- (opaque), for indicator numbers from `1` to `32` whose styles are either
--- `INDIC_ROUNDBOX`, `INDIC_STRAIGHTBOX`, or `INDIC_DOTBOX`.
+-- Table of fill color alpha values, ranging from `0` (transparent) to `255` (opaque),
+-- for indicator numbers from `1` to `32` whose styles are either `INDIC_ROUNDBOX`,
+-- `INDIC_STRAIGHTBOX`, or `INDIC_DOTBOX`.
-- The default values are `view.ALPHA_NOALPHA`, for no alpha.
-- @field indic_fore (table)
--- Table of foreground colors, in "0xBBGGRR" format, for indicator numbers
--- from `1` to `32`.
--- Changing an indicator's foreground color resets that indicator's hover
--- foreground color.
+-- Table of foreground colors, in "0xBBGGRR" format, for indicator numbers from `1` to `32`.
+-- Changing an indicator's foreground color resets that indicator's hover foreground color.
-- @field indic_hover_fore (table)
--- Table of hover foreground colors, in "0xBBGGRR" format, for indicator
--- numbers from `1` to `32`.
+-- Table of hover foreground colors, in "0xBBGGRR" format, for indicator numbers from `1` to
+-- `32`.
-- The default values are the respective indicator foreground colors.
-- @field indic_hover_style (table)
--- Table of hover styles for indicators numbers from `1` to `32`. An
--- indicator's hover style drawn when either the cursor hovers over that
--- indicator or the caret is within that indicator.
+-- Table of hover styles for indicators numbers from `1` to `32`.
+-- An indicator's hover style drawn when either the cursor hovers over that indicator or the
+-- caret is within that indicator.
-- The default values are the respective indicator styles.
-- @field indic_outline_alpha (table)
--- Table of outline color alpha values, ranging from `0` (transparent) to
--- `255` (opaque), for indicator numbers from `1` to `32` whose styles are
--- either `INDIC_ROUNDBOX`, `INDIC_STRAIGHTBOX`, or `INDIC_DOTBOX`.
+-- Table of outline color alpha values, ranging from `0` (transparent) to `255` (opaque),
+-- for indicator numbers from `1` to `32` whose styles are either `INDIC_ROUNDBOX`,
+-- `INDIC_STRAIGHTBOX`, or `INDIC_DOTBOX`.
-- The default values are `view.ALPHA_NOALPHA`, for no alpha.
-- @field indic_style (table)
-- Table of styles for indicator numbers from `1` to `32`.
@@ -283,10 +269,9 @@
-- * `view.INDIC_BOX`
-- A bounding box.
-- * `view.INDIC_ROUNDBOX`
--- A translucent box with rounded corners around the text. Use
--- [`view.indic_alpha`]() and [`view.indic_outline_alpha`]() to set the
--- fill and outline transparency, respectively. Their default values are
--- `30` and `50`.
+-- A translucent box with rounded corners around the text. Use [`view.indic_alpha`]() and
+-- [`view.indic_outline_alpha`]() to set the fill and outline transparency, respectively.
+-- Their default values are `30` and `50`.
-- * `view.INDIC_STRAIGHTBOX`
-- Similar to `INDIC_ROUNDBOX` but with sharp corners.
-- * `view.INDIC_DASH`
@@ -297,22 +282,20 @@
-- A squiggly underline 2 pixels in height.
-- * `view.INDIC_DOTBOX`
-- Similar to `INDIC_STRAIGHTBOX` but with a dotted outline.
--- Translucency alternates between [`view.indic_alpha`]() and
--- [`view.indic_outline_alpha`]() starting with the top-left pixel.
+-- Translucency alternates between [`view.indic_alpha`]() and [`view.indic_outline_alpha`]()
+-- starting with the top-left pixel.
-- * `view.INDIC_SQUIGGLEPIXMAP`
--- Identical to `INDIC_SQUIGGLE` but draws faster by using a pixmap instead
--- of multiple line segments.
+-- Identical to `INDIC_SQUIGGLE` but draws faster by using a pixmap instead of multiple
+-- line segments.
-- * `view.INDIC_COMPOSITIONTHICK`
--- A 2-pixel thick underline at the bottom of the line inset by 1 pixel on
--- on either side. Similar in appearance to the target in Asian language
--- input composition.
+-- A 2-pixel thick underline at the bottom of the line inset by 1 pixel on on either
+-- side. Similar in appearance to the target in Asian language input composition.
-- * `view.INDIC_COMPOSITIONTHIN`
--- A 1-pixel thick underline just before the bottom of the line inset by 1
--- pixel on either side. Similar in appearance to the non-target ranges in
--- Asian language input composition.
+-- A 1-pixel thick underline just before the bottom of the line inset by 1 pixel on either
+-- side. Similar in appearance to the non-target ranges in Asian language input composition.
-- * `view.INDIC_FULLBOX`
--- Similar to `INDIC_STRAIGHTBOX` but extends to the top of its line,
--- potentially touching any similar indicators on the line above.
+-- Similar to `INDIC_STRAIGHTBOX` but extends to the top of its line, potentially touching
+-- any similar indicators on the line above.
-- * `view.INDIC_TEXTFORE`
-- Changes the color of text to an indicator's foreground color.
-- * `view.INDIC_POINT`
@@ -321,21 +304,20 @@
-- A triangle below the center of the first character of the indicator
-- range.
-- * `view.INDIC_GRADIENT`
--- A box with a vertical gradient from solid on top to transparent on
--- bottom.
+-- A box with a vertical gradient from solid on top to transparent on bottom.
-- * `view.INDIC_GRADIENTCENTER`
--- A box with a centered gradient from solid in the middle to transparent on
--- the top and bottom.
+-- A box with a centered gradient from solid in the middle to transparent on the top
+-- and bottom.
--
-- Use [`_SCINTILLA.next_indic_number()`]() for custom indicators.
-- Changing an indicator's style resets that indicator's hover style.
-- @field indic_under (table)
--- Table of flags that indicate whether or not to draw indicators behind text
--- instead of over the top of it for indicator numbers from `1` to `32`.
+-- Table of flags that indicate whether or not to draw indicators behind text instead of over
+-- the top of it for indicator numbers from `1` to `32`.
-- The default values are `false`.
-- @field line_visible (table, Read-only)
--- Table of flags per line number that indicate whether or not lines are
--- visible for those line numbers.
+-- Table of flags per line number that indicate whether or not lines are visible for those
+-- line numbers.
-- @field lines_on_screen (number, Read-only)
-- The number of completely visible lines in the view.
-- It is possible to have a partial line visible at the bottom of the view.
@@ -343,12 +325,11 @@
-- The number of margins.
-- The default value is `5`.
-- @field margin_back_n (table)
--- Table of background colors, in "0xBBGGRR" format, of margin numbers from
--- `1` to `view.margins` (`5` by default).
+-- Table of background colors, in "0xBBGGRR" format, of margin numbers from `1` to `view.margins`
+-- (`5` by default).
-- Only affects margins of type `view.MARGIN_COLOR`.
-- @field margin_cursor_n (table)
--- Table of cursor types shown over margin numbers from `1` to
--- `view.margins` (`5` by default).
+-- Table of cursor types shown over margin numbers from `1` to `view.margins` (`5` by default).
--
-- * `view.CURSORARROW`
-- Normal arrow cursor.
@@ -360,44 +341,39 @@
-- The pixel size of the left margin of the buffer text.
-- The default value is `1`.
-- @field margin_mask_n (table)
--- Table of bit-masks of markers whose symbols marker symbol margins can
--- display for margin numbers from `1` to `view.margins` (`5` by default).
--- Bit-masks are 32-bit values whose bits correspond to the 32 available
--- markers.
--- The default values are `0`, `view.MASK_FOLDERS`, `0`, `0`, and `0`, for
--- a line margin and logical marker margin.
+-- Table of bit-masks of markers whose symbols marker symbol margins can display for margin
+-- numbers from `1` to `view.margins` (`5` by default).
+-- Bit-masks are 32-bit values whose bits correspond to the 32 available markers.
+-- The default values are `0`, `view.MASK_FOLDERS`, `0`, `0`, and `0`, for a line margin and
+-- logical marker margin.
-- @field margin_options (number)
-- A bit-mask of margin option settings.
--
-- * `view.MARGINOPTION_NONE`
-- None.
-- * `view.MARGINOPTION_SUBLINESELECT`
--- Select only a wrapped line's sub-line (rather than the entire line) when
--- the line number margin is clicked.
+-- Select only a wrapped line's sub-line (rather than the entire line) when the line number
+-- margin is clicked.
--
-- The default value is `view.MARGINOPTION_NONE`.
-- @field margin_right (number)
-- The pixel size of the right margin of the buffer text.
-- The default value is `1`.
-- @field margin_sensitive_n (table)
--- Table of flags that indicate whether or not mouse clicks in margins emit
--- `MARGIN_CLICK` events for margin numbers from `1` to `view.margins` (`5`
--- by default).
+-- Table of flags that indicate whether or not mouse clicks in margins emit `MARGIN_CLICK`
+-- events for margin numbers from `1` to `view.margins` (`5` by default).
-- The default values are `false`.
-- @field margin_type_n (table)
--- Table of margin types for margin numbers from `1` to `view.margins` (`5`
--- by default).
+-- Table of margin types for margin numbers from `1` to `view.margins` (`5` by default).
--
-- * `view.MARGIN_SYMBOL`
-- A marker symbol margin.
-- * `view.MARGIN_NUMBER`
-- A line number margin.
-- * `view.MARGIN_BACK`
--- A marker symbol margin whose background color matches the default text
--- background color.
+-- A marker symbol margin whose background color matches the default text background color.
-- * `view.MARGIN_FORE`
--- A marker symbol margin whose background color matches the default text
--- foreground color.
+-- A marker symbol margin whose background color matches the default text foreground color.
-- * `view.MARGIN_TEXT`
-- A text margin.
-- * `view.MARGIN_RTEXT`
@@ -405,32 +381,27 @@
-- * `view.MARGIN_COLOR`
-- A marker symbol margin whose background color is configurable.
--
--- The default value for the first margin is `view.MARGIN_NUMBER`, followed
--- by `view.MARGIN_SYMBOL` for the rest.
+-- The default value for the first margin is `view.MARGIN_NUMBER`, followed by
+-- `view.MARGIN_SYMBOL` for the rest.
-- @field margin_width_n (table)
--- Table of pixel margin widths for margin numbers from `1` to
--- `view.margins` (`5` by default).
+-- Table of pixel margin widths for margin numbers from `1` to `view.margins` (`5` by default).
-- @field marker_alpha (table, Write-only)
--- Table of alpha values, ranging from `0` (transparent) to `255` (opaque),
--- of markers drawn in the text area (not the margin) for markers numbers from
--- `1` to `32`.
+-- Table of alpha values, ranging from `0` (transparent) to `255` (opaque), of markers drawn
+-- in the text area (not the margin) for markers numbers from `1` to `32`.
-- The default values are `view.ALPHA_NOALPHA`, for no alpha.
-- @field marker_back (table, Write-only)
--- Table of background colors, in "0xBBGGRR" format, of marker numbers from
--- `1` to `32`.
+-- Table of background colors, in "0xBBGGRR" format, of marker numbers from `1` to `32`.
-- @field marker_back_selected (table, Write-only)
--- Table of background colors, in "0xBBGGRR" format, of markers whose folding
--- blocks are selected for marker numbers from `1` to `32`.
+-- Table of background colors, in "0xBBGGRR" format, of markers whose folding blocks are
+-- selected for marker numbers from `1` to `32`.
-- @field marker_fore (table, Write-only)
--- Table of foreground colors, in "0xBBGGRR" format, of marker numbers from
--- `1` to `32`.
+-- Table of foreground colors, in "0xBBGGRR" format, of marker numbers from `1` to `32`.
-- @field mouse_dwell_time (number)
--- The number of milliseconds the mouse must idle before generating a
--- `DWELL_START` event. A time of `view.TIME_FOREVER` will never generate
--- one.
+-- The number of milliseconds the mouse must idle before generating a `DWELL_START` event. A
+-- time of `view.TIME_FOREVER` will never generate one.
-- @field mouse_selection_rectangular_switch (bool)
--- Whether or not pressing [`view.rectangular_selection_modifier`]() when
--- selecting text normally with the mouse turns on rectangular selection.
+-- Whether or not pressing [`view.rectangular_selection_modifier`]() when selecting text
+-- normally with the mouse turns on rectangular selection.
-- The default value is `false`.
-- @field multi_edge_column (table, Read-only)
-- Table of edge column positions per edge column number.
@@ -438,14 +409,13 @@
-- @field property (table)
-- Map of key-value string pairs used by lexers.
-- @field property_expanded (table, Read-only)
--- Map of key-value string pairs used by lexers with `$()` and `%()` variable
--- replacement performed in values.
+-- Map of key-value string pairs used by lexers with `$()` and `%()` variable replacement
+-- performed in values.
-- @field property_int (table, Read-only)
--- Map of key-value pairs used by lexers with values interpreted as numbers,
--- or `0` if not found.
+-- Map of key-value pairs used by lexers with values interpreted as numbers, or `0` if not found.
-- @field rectangular_selection_modifier (number)
--- The modifier key used in combination with a mouse drag in order to create a
--- rectangular selection.
+-- The modifier key used in combination with a mouse drag in order to create a rectangular
+-- selection.
--
-- * `view.MOD_CTRL`
-- The "Control" modifier key.
@@ -458,39 +428,34 @@
-- The default value is `view.MOD_CTRL`.
-- @field representation (table)
-- The alternative string representations of characters.
--- Representations are displayed in the same way control characters are. Use
--- the empty string for the '\0' character when assigning its representation.
--- Characters are strings, not numeric codes, and can be multi-byte
--- characters.
+-- Representations are displayed in the same way control characters are. Use the empty
+-- string for the '\0' character when assigning its representation. Characters are strings,
+-- not numeric codes, and can be multi-byte characters.
-- Call [`view.clear_representation()`]() to remove a representation.
-- @field rgba_image_height (number)
--- The height of the RGBA image to be defined using
--- [`view.marker_define_rgba_image()`]().
+-- The height of the RGBA image to be defined using [`view.marker_define_rgba_image()`]().
-- @field rgba_image_scale (number)
-- The scale factor in percent of the RGBA image to be defined using
-- [`view.marker_define_rgba_image()`]().
--- This is useful on macOS with a retina display where each display unit is 2
--- pixels: use a factor of `200` so that each image pixel is displayed using a
--- screen pixel. The default scale, `100`, will stretch each image pixel to
--- cover 4 screen pixels on a retina display.
+-- This is useful on macOS with a retina display where each display unit is 2 pixels: use a
+-- factor of `200` so that each image pixel is displayed using a screen pixel.
+-- The default scale, `100`, will stretch each image pixel to cover 4 screen pixels on a
+-- retina display.
-- @field rgba_image_width (number)
--- The width of the RGBA image to be defined using
--- [`view.marker_define_rgba_image()`]() and
+-- The width of the RGBA image to be defined using [`view.marker_define_rgba_image()`]() and
-- [`view.register_rgba_image()`]().
-- @field scroll_width (number)
-- The horizontal scrolling pixel width.
--- For performance, the view does not measure the display width of the buffer
--- to determine the properties of the horizontal scroll bar, but uses an
--- assumed width instead. To ensure the width of the currently visible lines
--- can be scrolled use [`view.scroll_width_tracking`]().
+-- For performance, the view does not measure the display width of the buffer to determine
+-- the properties of the horizontal scroll bar, but uses an assumed width instead. To ensure
+-- the width of the currently visible lines can be scrolled use [`view.scroll_width_tracking`]().
-- The default value is `2000`.
-- @field scroll_width_tracking (bool)
--- Continuously update the horizontal scrolling width to match the maximum
--- width of a displayed line beyond [`view.scroll_width`]().
+-- Continuously update the horizontal scrolling width to match the maximum width of a displayed
+-- line beyond [`view.scroll_width`]().
-- The default value is `false`.
-- @field sel_alpha (number)
--- The selection's alpha value, ranging from `0` (transparent) to `255`
--- (opaque).
+-- The selection's alpha value, ranging from `0` (transparent) to `255` (opaque).
-- The default value is `view.ALPHA_NOALPHA`, for no alpha.
-- @field sel_eol_filled (bool)
-- Extend the selection to the view's right margin.
@@ -498,11 +463,9 @@
-- @field size (number)
-- The split resizer's pixel position if the view is a split one.
-- @field style_back (table)
--- Table of background colors, in "0xBBGGRR" format, of text for style numbers
--- from `1` to `256`.
+-- Table of background colors, in "0xBBGGRR" format, of text for style numbers from `1` to `256`.
-- @field style_bold (table)
--- Table of flags that indicate whether or not text is bold for style numbers
--- from `1` to `256`.
+-- Table of flags that indicate whether or not text is bold for style numbers from `1` to `256`.
-- The default values are `false`.
-- @field style_case (table)
-- Table of letter case modes of text for style numbers from `1` to `256`.
@@ -518,33 +481,32 @@
--
-- The default values are `view.CASE_MIXED`.
-- @field style_changeable (table)
--- Table of flags that indicate whether or not text is changeable for style
--- numbers from `1` to `256`.
+-- Table of flags that indicate whether or not text is changeable for style numbers from `1`
+-- to `256`.
-- The default values are `true`.
-- Read-only styles do not allow the caret into the range of text.
-- @field style_eol_filled (table)
--- Table of flags that indicate whether or not the background colors of styles
--- whose characters occur last on lines extend all the way to the view's right
--- margin for style numbers from `1` to `256`.
+-- Table of flags that indicate whether or not the background colors of styles whose characters
+-- occur last on lines extend all the way to the view's right margin for style numbers from
+-- `1` to `256`.
-- The default values are `false`.
-- @field style_font (table)
-- Table of string font names of text for style numbers from `1` to `256`.
-- @field style_fore (table)
--- Table of foreground colors, in "0xBBGGRR" format, of text for style numbers
--- from `1` to `256`.
+-- Table of foreground colors, in "0xBBGGRR" format, of text for style numbers from `1` to `256`.
-- @field style_italic (table)
--- Table of flags that indicate whether or not text is italic for style
--- numbers from `1` to `256`.
+-- Table of flags that indicate whether or not text is italic for style numbers from `1` to
+-- `256`.
-- The default values are `false`.
-- @field style_size (table)
-- Table of font sizes of text for style numbers from `1` to `256`.
-- @field style_underline (table)
--- Table of flags that indicate whether or not text is underlined for style
--- numbers from `1` to `256`.
+-- Table of flags that indicate whether or not text is underlined for style numbers from `1`
+-- to `256`.
-- The default values are `false`.
-- @field style_visible (table)
--- Table of flags that indicate whether or not text is visible for style
--- numbers from `1` to `256`.
+-- Table of flags that indicate whether or not text is visible for style numbers from `1` to
+-- `256`.
-- The default values are `true`.
-- @field tab_draw_mode (number)
-- The draw mode of visible tabs.
@@ -575,8 +537,7 @@
--
-- The default value is `view.WS_INVISIBLE`.
-- @field whitespace_size (number)
--- The pixel size of the dots that represent space characters when whitespace
--- is visible.
+-- The pixel size of the dots that represent space characters when whitespace is visible.
-- The default value is `1`.
-- @field wrap_indent_mode (number)
-- The wrapped line indent mode.
@@ -634,8 +595,8 @@
-- The default value is `view.WRAPVISUALFLAGLOC_DEFAULT`.
-- @field x_offset (number)
-- The horizontal scroll pixel position.
--- A value of `0` is the normal position with the first text column visible at
--- the left of the view.
+-- A value of `0` is the normal position with the first text column visible at the left of
+-- the view.
-- @field zoom (number)
-- The number of points to add to the size of all fonts.
-- Negative values are allowed, down to `-10`.
@@ -949,37 +910,34 @@ module('view')
local buffer
---
--- Highlights the character at position *pos* as an unmatched brace character
--- using the `'style.bracebad'` style.
+-- Highlights the character at position *pos* as an unmatched brace character using the
+-- `'style.bracebad'` style.
-- Removes highlighting when *pos* is `-1`.
-- @param view A view.
--- @param pos The position in *view*'s buffer to highlight, or `-1` to remove
--- the highlight.
+-- @param pos The position in *view*'s buffer to highlight, or `-1` to remove the highlight.
function brace_bad_light(view, pos) end
---
--- Highlights unmatched brace characters with indicator number *indicator*, in
--- the range of `1` to `32`, instead of the
--- `view.STYLE_BRACEBAD` style if *use_indicator* is `true`.
+-- Highlights unmatched brace characters with indicator number *indicator*, in the range of
+-- `1` to `32`, instead of the `view.STYLE_BRACEBAD` style if *use_indicator* is `true`.
-- @param view A view.
-- @param use_indicator Whether or not to use an indicator.
-- @param indicator The indicator number to use.
function brace_bad_light_indicator(view, use_indicator, indicator) end
---
--- Highlights the characters at positions *pos1* and *pos2* as matching braces
--- using the `'style.bracelight'` style.
--- If indent guides are enabled, locates the column with `buffer.column` and
--- sets `view.highlight_guide` in order to highlight the indent guide.
+-- Highlights the characters at positions *pos1* and *pos2* as matching braces using the
+-- `'style.bracelight'` style.
+-- If indent guides are enabled, locates the column with `buffer.column` and sets
+-- `view.highlight_guide` in order to highlight the indent guide.
-- @param view A view.
-- @param pos1 The first position in *view*'s buffer to highlight.
-- @param pos2 The second position in *view*'s buffer to highlight.
function brace_highlight(view, pos1, pos2) end
---
--- Highlights matching brace characters with indicator number *indicator*, in
--- the range of `1` to `32`, instead of the
--- `view.STYLE_BRACELIGHT` style if *use_indicator* is `true`.
+-- Highlights matching brace characters with indicator number *indicator*, in the range of `1`
+-- to `32`, instead of the `view.STYLE_BRACELIGHT` style if *use_indicator* is `true`.
-- @param view A view.
-- @param use_indicator Whether or not to use an indicator.
-- @param indicator The indicator number to use.
@@ -1003,52 +961,49 @@ function call_tip_cancel(view) end
function call_tip_pos_start(view) end
---
--- Highlights a call tip's text between positions *start_pos* to *end_pos* with
--- the color `view.call_tip_fore_hlt`.
+-- Highlights a call tip's text between positions *start_pos* to *end_pos* with the color
+-- `view.call_tip_fore_hlt`.
-- @param view A view.
-- @param start_pos The start position in a call tip text to highlight.
-- @param end_pos The end position in a call tip text to highlight.
function call_tip_set_hlt(view, start_pos, end_pos) end
---
--- Displays a call tip at position *pos* with string *text* as the call tip's
--- contents.
--- Any "\001" or "\002" bytes in *text* are replaced by clickable up or down
--- arrow visuals, respectively. These may be used to indicate that a symbol has
--- more than one call tip, for example.
+-- Displays a call tip at position *pos* with string *text* as the call tip's contents.
+-- Any "\001" or "\002" bytes in *text* are replaced by clickable up or down arrow visuals,
+-- respectively. These may be used to indicate that a symbol has more than one call tip,
+-- for example.
-- @param view A view.
-- @param pos The position in *view*'s buffer to show a call tip at.
-- @param text The call tip text to show.
function call_tip_show(view, pos, text) end
---
--- Clears all images registered using `view.register_image()` and
--- `view.register_rgba_image()`.
+-- Clears all images registered using `view.register_image()` and `view.register_rgba_image()`.
-- @param view A view.
function clear_registered_images(view) end
---
--- Removes the alternate string representation for character *char* (which may
--- be a multi-byte character).
+-- Removes the alternate string representation for character *char* (which may be a multi-byte
+-- character).
-- @param view A view.
--- @param char The string character in `buffer.representations` to remove the
--- alternate string representation for.
+-- @param char The string character in `buffer.representations` to remove the alternate string
+-- representation for.
function clear_representation(view, char) end
---
--- Returns the line number of the next contracted fold point starting from line
--- number *line*, or `-1` if none exists.
+-- Returns the line number of the next contracted fold point starting from line number *line*,
+-- or `-1` if none exists.
-- @param view A view.
-- @param line The line number in *view* to start at.
-- @return number
function contracted_fold_next(view, line) end
---
--- Returns the actual line number of displayed line number *display_line*,
--- taking wrapped, annotated, and hidden lines into account.
--- If *display_line* is less than or equal to `1`, returns `1`. If
--- *display_line* is greater than the number of displayed lines, returns
--- `buffer.line_count`.
+-- Returns the actual line number of displayed line number *display_line*, taking wrapped,
+-- annotated, and hidden lines into account.
+-- If *display_line* is less than or equal to `1`, returns `1`. If *display_line* is greater
+-- than the number of displayed lines, returns `buffer.line_count`.
-- @param view A view.
-- @param display_line The display line number to use.
-- @return number
@@ -1061,17 +1016,15 @@ function doc_line_from_visible(view, display_line) end
function ensure_visible(view, line) end
---
--- Ensures line number *line* is visible by expanding any fold points hiding it
--- based on the vertical caret policy previously defined in
--- `view.set_visible_policy()`.
+-- Ensures line number *line* is visible by expanding any fold points hiding it based on the
+-- vertical caret policy previously defined in `view.set_visible_policy()`.
-- @param view A view.
-- @param line The line number in *view* to ensure visible.
function ensure_visible_enforce_policy(view, line) end
---
-- Contracts, expands, or toggles all fold points, depending on *action*.
--- When toggling, the state of the first fold point determines whether to
--- expand or contract.
+-- When toggling, the state of the first fold point determines whether to expand or contract.
-- @param view A view.
-- @param action The fold action to perform. Valid values are:
-- * `view.FOLDACTION_CONTRACT`
@@ -1080,8 +1033,8 @@ function ensure_visible_enforce_policy(view, line) end
function fold_all(view, action) end
---
--- Contracts, expands, or toggles the fold point on line number *line*, as well
--- as all of its children, depending on *action*.
+-- Contracts, expands, or toggles the fold point on line number *line*, as well as all of its
+-- children, depending on *action*.
-- @param view A view.
-- @param line The line number in *view* to set the fold states for.
-- @param action The fold action to perform. Valid values are:
@@ -1091,8 +1044,7 @@ function fold_all(view, action) end
function fold_children(view, line, action) end
---
--- Contracts, expands, or toggles the fold point on line number *line*,
--- depending on *action*.
+-- Contracts, expands, or toggles the fold point on line number *line*, depending on *action*.
-- @param view A view.
-- @param line The line number in *view* to set the fold state for.
-- @param action The fold action to perform. Valid values are:
@@ -1108,8 +1060,7 @@ function get_default_fold_display_text(view) end
---
-- Hides the range of lines between line numbers *start_line* to *end_line*.
--- This has no effect on fold levels or fold flags and the first line cannot be
--- hidden.
+-- This has no effect on fold levels or fold flags and the first line cannot be hidden.
-- @param view A view.
-- @param start_line The start line of the range of lines in *view* to hide.
-- @param end_line The end line of the range of lines in *view* to hide.
@@ -1134,70 +1085,57 @@ function line_scroll_down(view) end
function line_scroll_up(view) end
---
--- Assigns marker symbol *symbol* to marker number *marker*, in the range of `1`
--- to `32`.
--- *symbol* is shown in marker symbol margins next to lines marked with
--- *marker*.
+-- Assigns marker symbol *symbol* to marker number *marker*, in the range of `1` to `32`.
+-- *symbol* is shown in marker symbol margins next to lines marked with *marker*.
-- @param view A view.
--- @param marker The marker number in the range of `1` to `32` to set *symbol*
--- for.
+-- @param marker The marker number in the range of `1` to `32` to set *symbol* for.
-- @param symbol The marker symbol: `buffer.MARK_*`.
-- @see _SCINTILLA.next_marker_number
function marker_define(view, marker, symbol) end
---
--- Associates marker number *marker*, in the range of `1` to `32`, with XPM
--- image *pixmap*.
--- The `view.MARK_PIXMAP` marker symbol must be assigned to *marker*.
--- *pixmap* is shown in marker symbol margins next to lines marked with
--- *marker*.
+-- Associates marker number *marker*, in the range of `1` to `32`, with XPM image *pixmap*.
+-- The `view.MARK_PIXMAP` marker symbol must be assigned to *marker*. *pixmap* is shown in
+-- marker symbol margins next to lines marked with *marker*.
-- @param view A view.
--- @param marker The marker number in the range of `1` to `32` to define
--- pixmap *pixmap* for.
+-- @param marker The marker number in the range of `1` to `32` to define pixmap *pixmap* for.
-- @param pixmap The string pixmap data.
function marker_define_pixmap(view, marker, pixmap) end
---
--- Associates marker number *marker*, in the range of `1` to `32`, with RGBA
--- image *pixels*.
--- The dimensions for *pixels* (`view.rgba_image_width` and
--- `view.rgba_image_height`) must have already been defined. *pixels* is a
--- sequence of 4 byte pixel values (red, blue, green, and alpha) defining the
--- image line by line starting at the top-left pixel.
--- The `view.MARK_RGBAIMAGE` marker symbol must be assigned to *marker*.
--- *pixels* is shown in symbol margins next to lines marked with *marker*.
+-- Associates marker number *marker*, in the range of `1` to `32`, with RGBA image *pixels*.
+-- The dimensions for *pixels* (`view.rgba_image_width` and `view.rgba_image_height`) must
+-- have already been defined. *pixels* is a sequence of 4 byte pixel values (red, blue, green,
+-- and alpha) defining the image line by line starting at the top-left pixel.
+-- The `view.MARK_RGBAIMAGE` marker symbol must be assigned to *marker*. *pixels* is shown in
+-- symbol margins next to lines marked with *marker*.
-- @param view A view.
--- @param marker The marker number in the range of `1` to `32` to define RGBA
--- data *pixels* for.
--- @param pixels The string sequence of 4 byte pixel values starting with the
--- pixels for the top line, with the leftmost pixel first, then continuing
--- with the pixels for subsequent lines. There is no gap between lines for
--- alignment reasons. Each pixel consists of, in order, a red byte, a green
--- byte, a blue byte and an alpha byte. The color bytes are not premultiplied
--- by the alpha value. That is, a fully red pixel that is 25% opaque will be
+-- @param marker The marker number in the range of `1` to `32` to define RGBA data *pixels* for.
+-- @param pixels The string sequence of 4 byte pixel values starting with the pixels for the
+-- top line, with the leftmost pixel first, then continuing with the pixels for subsequent
+-- lines. There is no gap between lines for alignment reasons. Each pixel consists of, in
+-- order, a red byte, a green byte, a blue byte and an alpha byte. The color bytes are not
+-- premultiplied by the alpha value. That is, a fully red pixel that is 25% opaque will be
-- `[FF, 00, 00, 3F]`.
function marker_define_rgba_image(view, marker, pixels) end
---
--- Highlights the margin fold markers for the current fold block if *enabled* is
--- `true`.
+-- Highlights the margin fold markers for the current fold block if *enabled* is `true`.
-- @param view A view.
-- @param enabled Whether or not to enable highlight.
function marker_enable_highlight(view, enabled) end
---
--- Returns the symbol assigned to marker number *marker*, in the range of `1` to
--- `32`, used in `view.marker_define()`,
+-- Returns the symbol assigned to marker number *marker*, in the range of `1` to `32`, used in
+-- `view.marker_define()`,
-- `view.marker_define_pixmap()`, or `view.marker_define_rgba_image()`.
-- @param view A view.
--- @param marker The marker number in the range of `1` to `32` to get the symbol
--- of.
+-- @param marker The marker number in the range of `1` to `32` to get the symbol of.
-- @return number
function marker_symbol_defined(view, marker) end
---
--- Adds a new vertical line at column number *column* with color *color*, in
--- "0xBBGGRR" format.
+-- Adds a new vertical line at column number *column* with color *color*, in "0xBBGGRR" format.
-- @param view A view.
-- @param column The column number to add a vertical line at.
-- @param color The color in "0xBBGGRR" format.
@@ -1209,24 +1147,20 @@ function multi_edge_add_line(view, column, color) end
function multi_edge_clear_all(view) end
---
--- Registers XPM image *xpm_data* to type number *type* for use in
--- autocompletion and user lists.
+-- Registers XPM image *xpm_data* to type number *type* for use in autocompletion and user lists.
-- @param view A view.
-- @param type Integer type to register the image with.
-- @param xpm_data The XPM data as described in `view.marker_define_pixmap()`.
function register_image(view, type, xpm_data) end
---
--- Registers RGBA image *pixels* to type number *type* for use in autocompletion
--- and user lists.
--- The dimensions for *pixels* (`view.rgba_image_width` and
--- `view.rgba_image_height`) must have already been defined. *pixels* is a
--- sequence of 4 byte pixel values (red, blue, green, and alpha) defining the
--- image line by line starting at the top-left pixel.
+-- Registers RGBA image *pixels* to type number *type* for use in autocompletion and user lists.
+-- The dimensions for *pixels* (`view.rgba_image_width` and `view.rgba_image_height`) must
+-- have already been defined. *pixels* is a sequence of 4 byte pixel values (red, blue, green,
+-- and alpha) defining the image line by line starting at the top-left pixel.
-- @param view A view.
-- @param type Integer type to register the image with.
--- @param pixels The RGBA data as described in
--- `view.marker_define_rgba_image()`.
+-- @param pixels The RGBA data as described in `view.marker_define_rgba_image()`.
function register_rgba_image(view, type, pixels) end
---
@@ -1248,10 +1182,9 @@ function scroll_to_end(view) end
function scroll_to_start(view) end
---
--- Scrolls into view the range of text between positions *primary_pos* and
--- *secondary_pos*, with priority given to *primary_pos*.
--- Similar to `view.scroll_caret()`, but with *primary_pos* instead of
--- `buffer.current_pos`.
+-- Scrolls into view the range of text between positions *primary_pos* and *secondary_pos*,
+-- with priority given to *primary_pos*.
+-- Similar to `view.scroll_caret()`, but with *primary_pos* instead of `buffer.current_pos`.
-- This is useful for scrolling search results into view.
-- @param view A view.
-- @param secondary_pos The secondary range position to scroll into view.
@@ -1266,25 +1199,24 @@ function scroll_range(view, secondary_pos, primary_pos) end
function set_default_fold_display_text(view, text) end
---
--- Overrides the fold margin's default color with color *color*, in "0xBBGGRR"
--- format,
--- if *use_setting* is `true`.
+-- Overrides the fold margin's default color with color *color*, in "0xBBGGRR" format, if
+-- *use_setting* is `true`.
-- @param view A view.
-- @param use_setting Whether or not to use *color*.
-- @param color The color in "0xBBGGRR" format.
function set_fold_margin_color(view, use_setting, color) end
---
--- Overrides the fold margin's default highlight color with color *color*, in
--- "0xBBGGRR" format, if *use_setting* is `true`.
+-- Overrides the fold margin's default highlight color with color *color*, in "0xBBGGRR" format,
+-- if *use_setting* is `true`.
-- @param view A view.
-- @param use_setting Whether or not to use *color*.
-- @param color The color in "0xBBGGRR" format.
function set_fold_margin_hi_color(view, use_setting, color) end
---
--- Overrides the selection's default background color with color *color*, in
--- "0xBBGGRR" format, if *use_setting* is `true`.
+-- Overrides the selection's default background color with color *color*, in "0xBBGGRR" format,
+-- if *use_setting* is `true`.
-- Overwrites any existing `view.additional_sel_back` color.
-- @param view A view.
-- @param use_setting Whether or not to use *color*.
@@ -1292,8 +1224,8 @@ function set_fold_margin_hi_color(view, use_setting, color) end
function set_sel_back(view, use_setting, color) end
---
--- Overrides the selection's default foreground color with color *color*, in
--- "0xBBGGRR" format, if *use_setting* is `true`.
+-- Overrides the selection's default foreground color with color *color*, in "0xBBGGRR" format,
+-- if *use_setting* is `true`.
-- Overwrites any existing `view.additional_sel_fore` color.
-- @param view A view.
-- @param use_setting Whether or not to use *color*.
@@ -1301,53 +1233,52 @@ function set_sel_back(view, use_setting, color) end
function set_sel_fore(view, use_setting, color) end
---
--- Defines scrolling policy bit-mask *policy* as the policy for keeping the
--- caret *y* number of lines away from the vertical margins as
--- `view.ensure_visible_enforce_policy()` redisplays hidden or folded lines.
+-- Defines scrolling policy bit-mask *policy* as the policy for keeping the caret *y* number
+-- of lines away from the vertical margins as `view.ensure_visible_enforce_policy()` redisplays
+-- hidden or folded lines.
-- It is similar in operation to `view.set_y_caret_policy()`.
-- @param view A view.
--- @param policy The combination of `view.VISIBLE_SLOP` and
--- `view.VISIBLE_STRICT` policy flags to set.
+-- @param policy The combination of `view.VISIBLE_SLOP` and `view.VISIBLE_STRICT` policy flags
+-- to set.
-- @param y The number of lines from the vertical margins to keep the caret.
function set_visible_policy(view, policy, y) end
---
--- Overrides the background color of whitespace with color *color*, in
--- "0xBBGGRR" format, if *use_setting* is `true`.
+-- Overrides the background color of whitespace with color *color*, in "0xBBGGRR" format,
+-- if *use_setting* is `true`.
-- @param view A view.
-- @param use_setting Whether or not to use *color*.
-- @param color The color in "0xBBGGRR" format.
function set_whitespace_back(view, use_setting, color) end
---
--- Overrides the foreground color of whitespace with color *color*, in
--- "0xBBGGRR" format, if *use_setting* is `true`.
+-- Overrides the foreground color of whitespace with color *color*, in "0xBBGGRR" format,
+-- if *use_setting* is `true`.
-- @param use_setting Whether or not to use *color*.
-- @param color The color in "0xBBGGRR" format.
function set_whitespace_fore(view, use_setting, color) end
---
--- Defines scrolling policy bit-mask *policy* as the policy for keeping the
--- caret *x* number of pixels away from the horizontal margins.
+-- Defines scrolling policy bit-mask *policy* as the policy for keeping the caret *x* number
+-- of pixels away from the horizontal margins.
-- @param view A view.
--- @param policy The combination of `view.CARET_SLOP`, `view.CARET_STRICT`,
--- `view.CARET_EVEN`, and `view.CARET_JUMPS` policy flags to set.
+-- @param policy The combination of `view.CARET_SLOP`, `view.CARET_STRICT`, `view.CARET_EVEN`,
+-- and `view.CARET_JUMPS` policy flags to set.
-- @param x The number of pixels from the horizontal margins to keep the caret.
function set_x_caret_policy(view, policy, x) end
---
--- Defines scrolling policy bit-mask *policy* as the policy for keeping the
--- caret *y* number of lines away from the vertical margins.
+-- Defines scrolling policy bit-mask *policy* as the policy for keeping the caret *y* number
+-- of lines away from the vertical margins.
-- @param view A view.
--- @param policy The combination of `view.CARET_SLOP`, `view.CARET_STRICT`,
--- `view.CARET_EVEN`, and `view.CARET_JUMPS` policy flags to set.
+-- @param policy The combination of `view.CARET_SLOP`, `view.CARET_STRICT`, `view.CARET_EVEN`,
+-- and `view.CARET_JUMPS` policy flags to set.
-- @param y The number of lines from the vertical margins to keep the caret.
function set_y_caret_policy(view, policy, y) end
---
-- Shows the range of lines between line numbers *start_line* to *end_line*.
--- This has no effect on fold levels or fold flags and the first line cannot be
--- hidden.
+-- This has no effect on fold levels or fold flags and the first line cannot be hidden.
-- @param view A view.
-- @param start_line The start line of the range of lines in *view* to show.
-- @param end_line The end line of the range of lines in *view* to show.
@@ -1371,8 +1302,8 @@ function style_reset_default(view) end
function text_height(view, line) end
---
--- Returns the pixel width string *text* would have when styled with style
--- number *style_num*, in the range of `1` to `256`.
+-- Returns the pixel width string *text* would have when styled with style number *style_num*,
+-- in the range of `1` to `256`.
-- @param view A view.
-- @param style_num The style number between `1` and `256` to use.
-- @param text The text to measure the width of.
@@ -1380,22 +1311,20 @@ function text_height(view, line) end
function text_width(view, style_num, text) end
---
--- Toggles the fold point on line number *line* between expanded (where all of
--- its child lines are displayed) and contracted (where all of its child lines
--- are hidden).
+-- Toggles the fold point on line number *line* between expanded (where all of its child lines
+-- are displayed) and contracted (where all of its child lines are hidden).
-- @param view A view.
-- @param line The line number in *view* to toggle the fold on.
-- @see set_default_fold_display_text
function toggle_fold(view, line) end
---
--- Toggles a fold point on line number *line* between expanded (where all of
--- its child lines are displayed) and contracted (where all of its child lines
--- are hidden), and shows string *text* next to that line.
+-- Toggles a fold point on line number *line* between expanded (where all of its child lines are
+-- displayed) and contracted (where all of its child lines are hidden), and shows string *text*
+-- next to that line.
-- *text* is drawn with style number `view.STYLE_FOLDDISPLAYTEXT`.
-- @param view A view.
--- @param line The line number in *view* to toggle the fold on and display
--- *text* after.
+-- @param line The line number in *view* to toggle the fold on and display *text* after.
-- @param text The text to display after the line.
function toggle_fold_show_text(view, line, text) end
@@ -1405,9 +1334,8 @@ function toggle_fold_show_text(view, line, text) end
function vertical_center_caret(view) end
---
--- Returns the displayed line number of actual line number *line*, taking
--- wrapped, annotated, and hidden lines into account, or `-1` if *line* is
--- outside the range of lines in the buffer.
+-- Returns the displayed line number of actual line number *line*, taking wrapped, annotated,
+-- and hidden lines into account, or `-1` if *line* is outside the range of lines in the buffer.
-- Lines can occupy more than one display line if they wrap.
-- @param view A view.
-- @param line The line number in *view* to use.
@@ -1415,8 +1343,7 @@ function vertical_center_caret(view) end
function visible_from_doc_line(view, line) end
---
--- Returns the number of wrapped lines needed to fully display line number
--- *line*.
+-- Returns the number of wrapped lines needed to fully display line number *line*.
-- @param view A view.
-- @param line The line number in *view* to use.
-- @return number
@@ -1435,14 +1362,13 @@ function zoom_out(view) end
-- External functions.
---
--- Splits the view into top and bottom views (unless *vertical* is `true`),
--- focuses the new view, and returns both the old and new views.
--- If *vertical* is `false`, splits the view vertically into left and
--- right views.
+-- Splits the view into top and bottom views (unless *vertical* is `true`), focuses the new view,
+-- and returns both the old and new views.
+-- If *vertical* is `false`, splits the view vertically into left and right views.
-- Emits a `VIEW_NEW` event.
-- @param view The view to split.
--- @param vertical Optional flag indicating whether or not to split the view
--- vertically. The default value is `false`, for horizontal.
+-- @param vertical Optional flag indicating whether or not to split the view vertically. The
+-- default value is `false`, for horizontal.
-- @return old view and new view.
-- @see events.VIEW_NEW
function split(view, vertical) end
@@ -1454,8 +1380,8 @@ function split(view, vertical) end
function unsplit(view) end
---
--- Switches to buffer *buffer* or the buffer *buffer* number of buffers relative
--- to the current one.
+-- Switches to buffer *buffer* or the buffer *buffer* number of buffers relative to the
+-- current one.
-- Emits `BUFFER_BEFORE_SWITCH` and `BUFFER_AFTER_SWITCH` events.
-- @param view The view to switch buffers in.
-- @param buffer A buffer or relative buffer number (typically 1 or -1).
@@ -1465,15 +1391,14 @@ function unsplit(view) end
function goto_buffer(view, buffer) end
---
--- Sets the view's color theme to be string *name*, with the contents of table
--- *env* available as global variables.
--- User themes override Textadept's default themes when they have the same name.
--- If *name* contains slashes, it is assumed to be an absolute path to a theme
--- instead of a theme name.
+-- Sets the view's color theme to be string *name*, with the contents of table *env* available
+-- as global variables.
+-- User themes override Textadept's default themes when they have the same name. If *name*
+-- contains slashes, it is assumed to be an absolute path to a theme instead of a theme name.
-- @param view A view.
-- @param name The name or absolute path of a theme to set.
--- @param env Optional table of global variables themes can utilize to override
--- default settings such as font and size.
+-- @param env Optional table of global variables themes can utilize to override default settings
+-- such as font and size.
-- @usage view:set_theme('light', {font = 'Monospace', size = 12})
-- @name set_theme
-- @see _G.lexer.colors
diff --git a/core/args.lua b/core/args.lua
index 0f805168..17c808d6 100644
--- a/core/args.lua
+++ b/core/args.lua
@@ -17,17 +17,14 @@ events.ARG_NONE = 'arg_none'
local options = {}
---
--- Registers a command line option with short and long versions *short* and
--- *long*, respectively. *narg* is the number of arguments the option accepts,
--- *f* is the function called when the option is set, and *description* is
--- the option's description when displaying help.
+-- Registers a command line option with short and long versions *short* and *long*, respectively.
+-- *narg* is the number of arguments the option accepts, *f* is the function called when the
+-- option is set, and *description* is the option's description when displaying help.
-- @param short The string short version of the option.
-- @param long The string long version of the option.
-- @param narg The number of expected parameters for the option.
--- @param f The Lua function to run when the option is set. It is passed *narg*
--- string arguments.
--- @param description The string description of the option for command line
--- help.
+-- @param f The Lua function to run when the option is set. It is passed *narg* string arguments.
+-- @param description The string description of the option for command line help.
-- @name register
function M.register(short, long, narg, f, description)
local option = {
@@ -38,14 +35,12 @@ function M.register(short, long, narg, f, description)
options[assert_type(long, 'string', 2)] = option
end
--- Processes command line argument table *arg*, handling options previously
--- defined using `args.register()` and treating unrecognized arguments as
--- filenames to open.
--- Emits an `ARG_NONE` event when no arguments are present unless
--- *no_emit_arg_none* is `true`.
+-- Processes command line argument table *arg*, handling options previously defined using
+-- `args.register()` and treating unrecognized arguments as filenames to open.
+-- Emits an `ARG_NONE` event when no arguments are present unless *no_emit_arg_none* is `true`.
-- @param arg Argument table.
--- @param no_emit_arg_none When `true`, do not emit `ARG_NONE` when no arguments
--- are present. The default value is `false`.
+-- @param no_emit_arg_none When `true`, do not emit `ARG_NONE` when no arguments are present.
+-- The default value is `false`.
-- @see register
-- @see _G.events
local function process(arg, no_emit_arg_none)
@@ -79,12 +74,10 @@ if not CURSES then
print('Usage: textadept [args] [filenames]')
local list = {}
for name in pairs(options) do list[#list + 1] = name end
- table.sort(
- list, function(a, b) return a:match('[^-]+') < b:match('[^-]+') end)
+ table.sort(list, function(a, b) return a:match('[^-]+') < b:match('[^-]+') end)
for _, name in ipairs(list) do
local option = options[name]
- print(string.format(
- ' %s [%d args]: %s', name, option.narg, option.description))
+ print(string.format(' %s [%d args]: %s', name, option.narg, option.description))
end
os.exit()
end, 'Shows this')
@@ -93,10 +86,9 @@ if not CURSES then
print(_RELEASE .. '\n' .. _COPYRIGHT)
quit()
end, 'Prints Textadept version and copyright')
- -- After Textadept finishes initializing and processes arguments, remove the
- -- help and version options in order to prevent another instance from sending
- -- '-h', '--help', '-v', and '--version' to the first instance, killing the
- -- latter.
+ -- After Textadept finishes initializing and processes arguments, remove the help and
+ -- version options in order to prevent another instance from sending '-h', '--help', '-v',
+ -- and '--version' to the first instance, killing the latter.
events.connect(events.INITIALIZED, function()
options['-h'], options['--help'] = nil, nil
options['-v'], options['--version'] = nil, nil
@@ -104,8 +96,7 @@ if not CURSES then
end
-- Set `_G._USERHOME`.
--- This needs to be set as soon as possible since the processing of arguments is
--- positional.
+-- This needs to be set as soon as possible since the processing of arguments is positional.
_USERHOME = os.getenv(not WIN32 and 'HOME' or 'USERPROFILE') .. '/.textadept'
for i, option in ipairs(arg) do
if (option == '-u' or option == '--userhome') and arg[i + 1] then
@@ -115,23 +106,19 @@ for i, option in ipairs(arg) do
end
local mode = lfs.attributes(_USERHOME, 'mode')
assert(not mode or mode == 'directory', '"%s" is not a directory', _USERHOME)
-if not mode then
- assert(lfs.mkdir(_USERHOME), 'cannot create "%s"', _USERHOME)
-end
+if not mode then assert(lfs.mkdir(_USERHOME), 'cannot create "%s"', _USERHOME) end
local user_init = _USERHOME .. '/init.lua'
mode = lfs.attributes(user_init, 'mode')
assert(not mode or mode == 'file', '"%s" is not a file (%s)', user_init, mode)
-if not mode then
- assert(io.open(user_init, 'w'), 'unable to create "%s"', user_init):close()
-end
+if not mode then assert(io.open(user_init, 'w'), 'unable to create "%s"', user_init):close() end
-- Placeholders.
M.register('-u', '--userhome', 1, function() end, 'Sets alternate _USERHOME')
M.register('-f', '--force', 0, function() end, 'Forces unique instance')
-- Run unit tests.
--- Note: have them run after the last `events.INITIALIZED` handler so everything
--- is completely initialized (e.g. menus, macro module, etc.).
+-- Note: have them run after the last `events.INITIALIZED` handler so everything is completely
+-- initialized (e.g. menus, macro module, etc.).
M.register('-t', '--test', 1, function(patterns)
events.connect(events.INITIALIZED, function()
local arg = {}
diff --git a/core/assert.lua b/core/assert.lua
index c0e7f44c..95b53628 100644
--- a/core/assert.lua
+++ b/core/assert.lua
@@ -6,35 +6,30 @@
module('assert')]]
---
--- Asserts that value *v* is not `false` or `nil` and returns *v*, or calls
--- `error()` with *message* as the error message, defaulting to "assertion
--- failed!". If *message* is a format string, the remaining arguments are passed
--- to `string.format()` and the resulting string becomes the error message.
+-- Asserts that value *v* is not `false` or `nil` and returns *v*, or calls `error()` with
+-- *message* as the error message, defaulting to "assertion failed!".
+-- If *message* is a format string, the remaining arguments are passed to `string.format()`
+-- and the resulting string becomes the error message.
-- @param v Value to assert.
--- @param message Optional error message to show on error. The default value is
--- "assertion failed!".
--- @param ... If *message* is a format string, these arguments are passed to
--- `string.format()`.
+-- @param message Optional error message to show on error. The default value is "assertion failed!".
+-- @param ... If *message* is a format string, these arguments are passed to `string.format()`.
-- @name _G.assert
function assert(v, message, ...)
if v then return v end
- if type(message) == 'string' and message:find('%%') then
- message = string.format(message, ...)
- end
+ if type(message) == 'string' and message:find('%%') then message = string.format(message, ...) end
error(message or 'assertion failed!', 2)
end
---
--- Asserts that value *v* has type string *expected_type* and returns *v*, or
--- calls `error()` with an error message that implicates function argument
--- number *narg*.
--- This is intended to be used with API function arguments so users receive more
--- helpful error messages.
+-- Asserts that value *v* has type string *expected_type* and returns *v*, or calls `error()`
+-- with an error message that implicates function argument number *narg*.
+-- This is intended to be used with API function arguments so users receive more helpful error
+-- messages.
-- @param v Value to assert the type of.
--- @param expected_type String type to assert. It may be a non-letter-delimited
--- list of type options.
--- @param narg The positional argument number *v* is associated with. This is
--- not required to be a number.
+-- @param expected_type String type to assert. It may be a non-letter-delimited list of type
+-- options.
+-- @param narg The positional argument number *v* is associated with. This is not required to
+-- be a number.
-- @usage assert_type(filename, 'string/nil', 1)
-- @usage assert_type(option.setting, 'number', 'setting') -- implicates key
-- @name _G.assert_type
@@ -42,18 +37,13 @@ function assert_type(v, expected_type, narg)
if type(v) == expected_type then return v end
-- Note: do not use assert for performance reasons.
if type(expected_type) ~= 'string' then
- error(string.format(
- "bad argument #2 to '%s' (string expected, got %s)",
+ error(string.format("bad argument #2 to '%s' (string expected, got %s)",
debug.getinfo(1, 'n').name, type(expected_type)), 2)
elseif narg == nil then
- error(string.format(
- "bad argument #3 to '%s' (value expected, got %s)",
+ error(string.format("bad argument #3 to '%s' (value expected, got %s)",
debug.getinfo(1, 'n').name, type(narg)), 2)
end
- for type_option in expected_type:gmatch('%a+') do
- if type(v) == type_option then return v end
- end
- error(string.format(
- "bad argument #%s to '%s' (%s expected, got %s)", narg,
+ for type_option in expected_type:gmatch('%a+') do if type(v) == type_option then return v end end
+ error(string.format("bad argument #%s to '%s' (%s expected, got %s)", narg,
debug.getinfo(2, 'n').name or '?', expected_type, type(v)), 3)
end
diff --git a/core/events.lua b/core/events.lua
index c1a3aca0..07829919 100644
--- a/core/events.lua
+++ b/core/events.lua
@@ -6,25 +6,23 @@ local M = {}
---
-- Textadept's core event structure and handlers.
--
--- Textadept emits events when you do things like create a new buffer, press a
--- key, click on a menu, etc. You can even emit events yourself using Lua. Each
--- event has a set of event handlers, which are simply Lua functions called in
--- the order they were connected to an event. For example, if you created a
--- module that needs to do something each time Textadept creates a new buffer,
--- connect a Lua function to the [`events.BUFFER_NEW`]() event:
+-- Textadept emits events when you do things like create a new buffer, press a key, click on
+-- a menu, etc. You can even emit events yourself using Lua. Each event has a set of event
+-- handlers, which are simply Lua functions called in the order they were connected to an
+-- event. For example, if you created a module that needs to do something each time Textadept
+-- creates a new buffer, connect a Lua function to the [`events.BUFFER_NEW`]() event:
--
-- events.connect(events.BUFFER_NEW, function()
-- -- Do something here.
-- end)
--
--- Events themselves are nothing special. You do not have to declare one before
--- using it. Events are simply strings containing arbitrary event names. When
--- either you or Textadept emits an event, Textadept runs all event handlers
--- connected to the event, passing any given arguments to the event's handler
--- functions. If an event handler explicitly returns a value that is not `nil`,
--- Textadept will not call subsequent handlers. This is useful if you want to
--- stop the propagation of an event like a keypress if your event handler
--- handled it, or if you want to use the event framework to pass values.
+-- Events themselves are nothing special. You do not have to declare one before using it. Events
+-- are simply strings containing arbitrary event names. When either you or Textadept emits an
+-- event, Textadept runs all event handlers connected to the event, passing any given arguments
+-- to the event's handler functions. If an event handler explicitly returns a value that is not
+-- `nil`, Textadept will not call subsequent handlers. This is useful if you want to stop the
+-- propagation of an event like a keypress if your event handler handled it, or if you want to
+-- use the event framework to pass values.
--
-- @field APPLEEVENT_ODOC (string)
-- Emitted when macOS tells Textadept to open a file.
@@ -32,22 +30,20 @@ local M = {}
--
-- * _`uri`_: The UTF-8-encoded URI to open.
-- @field AUTO_C_CHAR_DELETED (string)
--- Emitted after deleting a character while an autocompletion or user list is
--- active.
+-- Emitted after deleting a character while an autocompletion or user list is active.
-- @field AUTO_C_CANCELED (string)
-- Emitted when canceling an autocompletion or user list.
-- @field AUTO_C_COMPLETED (string)
--- Emitted after inserting an item from an autocompletion list into the
--- buffer.
+-- Emitted after inserting an item from an autocompletion list into the buffer.
-- Arguments:
--
-- * _`text`_: The selection's text.
-- * _`position`_: The autocompleted word's beginning position.
-- @field AUTO_C_SELECTION (string)
--- Emitted after selecting an item from an autocompletion list, but before
--- inserting that item into the buffer.
--- Automatic insertion can be canceled by calling
--- [`buffer:auto_c_cancel()`]() before returning from the event handler.
+-- Emitted after selecting an item from an autocompletion list, but before inserting that
+-- item into the buffer.
+-- Automatic insertion can be canceled by calling [`buffer:auto_c_cancel()`]() before returning
+-- from the event handler.
-- Arguments:
--
-- * _`text`_: The selection's text.
@@ -56,8 +52,7 @@ local M = {}
-- Emitted as items are highlighted in an autocompletion or user list.
-- Arguments:
--
--- * _`id`_: Either the *id* from [`buffer.user_list_show()`]() or `0` for an
--- autocompletion list.
+-- * _`id`_: Either the *id* from [`buffer.user_list_show()`]() or `0` for an autocompletion list.
-- * _`text`_: The current selection's text.
-- * _`position`_: The position the list was displayed at.
-- @field BUFFER_AFTER_SWITCH (string)
@@ -79,8 +74,8 @@ local M = {}
-- Emitted when clicking on a calltip.
-- Arguments:
--
--- * _`position`_: `1` if the up arrow was clicked, 2 if the down arrow was
--- clicked, and 0 otherwise.
+-- * _`position`_: `1` if the up arrow was clicked, 2 if the down arrow was clicked, and
+-- 0 otherwise.
-- @field CHAR_ADDED (string)
-- Emitted after the user types a text character into the buffer.
-- Arguments:
@@ -95,33 +90,28 @@ local M = {}
--
-- * _`position`_: The position double-clicked.
-- * _`line`_: The line number of the position double-clicked.
--- * _`modifiers`_: A bit-mask of any modifier keys held down:
--- `view.MOD_CTRL`, `view.MOD_SHIFT`, `view.MOD_ALT`, and `view.MOD_META`.
--- On macOS, the Command modifier key is reported as `view.MOD_CTRL` and
--- Ctrl is `view.MOD_META`.
--- Note: If you set `view.rectangular_selection_modifier` to
--- `view.MOD_CTRL`, the "Control" modifier is reported as *both* "Control"
--- and "Alt" due to a Scintilla limitation with GTK.
+-- * _`modifiers`_: A bit-mask of any modifier keys held down: `view.MOD_CTRL`,
+-- `view.MOD_SHIFT`, `view.MOD_ALT`, and `view.MOD_META`. On macOS, the Command modifier
+-- key is reported as `view.MOD_CTRL` and Ctrl is `view.MOD_META`. Note: If you set
+-- `view.rectangular_selection_modifier` to `view.MOD_CTRL`, the "Control" modifier is
+-- reported as *both* "Control" and "Alt" due to a Scintilla limitation with GTK.
-- @field CSI (string)
-- Emitted when the terminal version receives an unrecognized CSI sequence.
-- Arguments:
--
--- * _`cmd`_: The 24-bit CSI command value. The lowest byte contains the
--- command byte. The second lowest byte contains the leading byte, if any
--- (e.g. '?'). The third lowest byte contains the intermediate byte, if any
--- (e.g. '$').
+-- * _`cmd`_: The 24-bit CSI command value. The lowest byte contains the command byte. The
+-- second lowest byte contains the leading byte, if any (e.g. '?'). The third lowest byte
+-- contains the intermediate byte, if any (e.g. '$').
-- * _`args`_: Table of numeric arguments of the CSI sequence.
-- @field DWELL_END (string)
--- Emitted after `DWELL_START` when the user moves the mouse, presses a key,
--- or scrolls the view.
+-- Emitted after `DWELL_START` when the user moves the mouse, presses a key, or scrolls the view.
-- Arguments:
--
-- * _`position`_: The position closest to *x* and *y*.
-- * _`x`_: The x-coordinate of the mouse in the view.
-- * _`y`_: The y-coordinate of the mouse in the view.
-- @field DWELL_START (string)
--- Emitted when the mouse is stationary for [`view.mouse_dwell_time`]()
--- milliseconds.
+-- Emitted when the mouse is stationary for [`view.mouse_dwell_time`]() milliseconds.
-- Arguments:
--
-- * _`position`_: The position closest to *x* and *y*.
@@ -139,8 +129,7 @@ local M = {}
-- * _`text`_: The text to search for.
-- * _`next`_: Whether or not to search forward.
-- @field FIND_TEXT_CHANGED (string)
--- Emitted when the text in the "Find" field of the Find & Replace Pane
--- changes.
+-- Emitted when the text in the "Find" field of the Find & Replace Pane changes.
-- `ui.find.find_entry_text` contains the current text.
-- @field FOCUS (string)
-- Emitted when Textadept receives focus.
@@ -150,16 +139,13 @@ local M = {}
-- Arguments:
--
-- * _`position`_: The clicked text's position.
--- * _`modifiers`_: A bit-mask of any modifier keys held down:
--- `view.MOD_CTRL`, `view.MOD_SHIFT`, `view.MOD_ALT`, and `view.MOD_META`.
--- On macOS, the Command modifier key is reported as `view.MOD_CTRL` and
--- Ctrl is `view.MOD_META`.
--- Note: If you set `view.rectangular_selection_modifier` to
--- `view.MOD_CTRL`, the "Control" modifier is reported as *both* "Control"
--- and "Alt" due to a Scintilla limitation with GTK.
+-- * _`modifiers`_: A bit-mask of any modifier keys held down: `view.MOD_CTRL`,
+-- `view.MOD_SHIFT`, `view.MOD_ALT`, and `view.MOD_META`. On macOS, the Command modifier
+-- key is reported as `view.MOD_CTRL` and Ctrl is `view.MOD_META`. Note: If you set
+-- `view.rectangular_selection_modifier` to `view.MOD_CTRL`, the "Control" modifier is
+-- reported as *both* "Control" and "Alt" due to a Scintilla limitation with GTK.
-- @field INDICATOR_RELEASE (string)
--- Emitted when releasing the mouse after clicking on text that has an
--- indicator present.
+-- Emitted when releasing the mouse after clicking on text that has an indicator present.
-- Arguments:
--
-- * _`position`_: The clicked text's position.
@@ -182,29 +168,24 @@ local M = {}
--
-- * _`margin`_: The margin number clicked.
-- * _`position`_: The beginning position of the clicked margin's line.
--- * _`modifiers`_: A bit-mask of any modifier keys held down:
--- `view.MOD_CTRL`, `view.MOD_SHIFT`, `view.MOD_ALT`, and `view.MOD_META`.
--- On macOS, the Command modifier key is reported as `view.MOD_CTRL` and
--- Ctrl is `view.MOD_META`.
--- Note: If you set `view.rectangular_selection_modifier` to
--- `view.MOD_CTRL`, the "Control" modifier is reported as *both* "Control"
--- and "Alt" due to a Scintilla limitation with GTK.
+-- * _`modifiers`_: A bit-mask of any modifier keys held down: `view.MOD_CTRL`,
+-- `view.MOD_SHIFT`, `view.MOD_ALT`, and `view.MOD_META`. On macOS, the Command modifier
+-- key is reported as `view.MOD_CTRL` and Ctrl is `view.MOD_META`. Note: If you set
+-- `view.rectangular_selection_modifier` to `view.MOD_CTRL`, the "Control" modifier is
+-- reported as *both* "Control" and "Alt" due to a Scintilla limitation with GTK.
-- @field MENU_CLICKED (string)
-- Emitted after selecting a menu item.
-- Arguments:
--
--- * _`menu_id`_: The numeric ID of the menu item, which was defined in
--- [`ui.menu()`]().
+-- * _`menu_id`_: The numeric ID of the menu item, which was defined in [`ui.menu()`]().
-- @field MOUSE (string)
-- Emitted by the terminal version for an unhandled mouse event.
--- A handler should return `true` if it handled the event. Otherwise Textadept
--- will try again. (This side effect for a `false` or `nil` return is useful
--- for sending the original mouse event to a different view that a handler
--- has switched to.)
+-- A handler should return `true` if it handled the event. Otherwise Textadept will try again.
+-- (This side effect for a `false` or `nil` return is useful for sending the original mouse
+-- event to a different view that a handler has switched to.)
-- Arguments:
--
--- * _`event`_: The mouse event: `view.MOUSE_PRESS`, `view.MOUSE_DRAG`, or
--- `view.MOUSE_RELEASE`.
+-- * _`event`_: The mouse event: `view.MOUSE_PRESS`, `view.MOUSE_DRAG`, or `view.MOUSE_RELEASE`.
-- * _`button`_: The mouse button number.
-- * _`y`_: The y-coordinate of the mouse event, starting from 1.
-- * _`x`_: The x-coordinate of the mouse event, starting from 1.
@@ -213,11 +194,10 @@ local M = {}
-- * _`alt`_: The "Alt"/"Option" modifier key is held down.
-- @field QUIT (string)
-- Emitted when quitting Textadept.
--- When connecting to this event, connect with an index of 1 if the handler
--- needs to run before Textadept closes all open buffers. If a handler returns
--- `true`, Textadept does not quit. It is not recommended to return `false`
--- from a quit handler, as that may interfere with Textadept's normal shutdown
--- procedure.
+-- When connecting to this event, connect with an index of 1 if the handler needs to run
+-- before Textadept closes all open buffers. If a handler returns `true`, Textadept does not
+-- quit. It is not recommended to return `false` from a quit handler, as that may interfere
+-- with Textadept's normal shutdown procedure.
-- Emitted by [`quit()`]().
-- @field REPLACE (string)
-- Emitted to replace selected (found) text.
@@ -235,15 +215,15 @@ local M = {}
-- Emitted by [`reset()`]().
-- Arguments:
--
--- * _`persist`_: Table of data persisted by `events.RESET_BEFORE`. All
--- handlers will have access to this same table.
+-- * _`persist`_: Table of data persisted by `events.RESET_BEFORE`. All handlers will have
+-- access to this same table.
-- @field RESET_BEFORE (string)
-- Emitted before resetting Textadept's Lua state.
-- Emitted by [`reset()`]().
-- Arguments:
--
--- * _`persist`_: Table to store persistent data in for use by
--- `events.RESET_AFTER`. All handlers will have access to this same table.
+-- * _`persist`_: Table to store persistent data in for use by `events.RESET_AFTER`. All
+-- handlers will have access to this same table.
-- @field RESUME (string)
-- Emitted when resuming Textadept from a suspended state.
-- This event is only emitted by the terminal version.
@@ -252,20 +232,18 @@ local M = {}
-- @field SAVE_POINT_REACHED (string)
-- Emitted after reaching a save point.
-- @field SUSPEND (string)
--- Emitted when suspending Textadept. If any handler returns `true`, Textadept
--- does not suspend.
+-- Emitted when suspending Textadept. If any handler returns `true`, Textadept does not suspend.
-- This event is only emitted by the terminal version.
-- @field TAB_CLICKED (string)
-- Emitted when the user clicks on a buffer tab.
--- When connecting to this event, connect with an index of 1 if the handler
--- needs to run before Textadept switches between buffers.
+-- When connecting to this event, connect with an index of 1 if the handler needs to run
+-- before Textadept switches between buffers.
-- Note that Textadept always displays a context menu on right-click.
-- Arguments:
--
-- * _`index`_: The numeric index of the clicked tab.
--- * _`button`_: The mouse button number that was clicked, either `1` (left
--- button), `2` (middle button), `3` (right button), `4` (wheel up), or `5`
--- (wheel down).
+-- * _`button`_: The mouse button number that was clicked, either `1` (left button), `2`
+-- (middle button), `3` (right button), `4` (wheel up), or `5` (wheel down).
-- * _`shift`_: The "Shift" modifier key is held down.
-- * _`ctrl`_: The "Control" modifier key is held down.
-- * _`alt`_: The "Alt"/"Option" modifier key is held down.
@@ -320,16 +298,17 @@ module('events')]]
-- Handler tables are auto-created as needed.
-- @class table
-- @name handlers
-local handlers = setmetatable({}, {__index = function(t, k)
- t[k] = {}
- return t[k]
-end})
+local handlers = setmetatable({}, {
+ __index = function(t, k)
+ t[k] = {}
+ return t[k]
+ end
+})
---
--- Adds function *f* to the set of event handlers for event *event* at position
--- *index*.
--- If *index* not given, appends *f* to the set of handlers. *event* may be any
--- arbitrary string and does not need to have been previously defined.
+-- Adds function *f* to the set of event handlers for event *event* at position *index*.
+-- If *index* not given, appends *f* to the set of handlers. *event* may be any arbitrary string
+-- and does not need to have been previously defined.
-- @param event The string event name.
-- @param f The Lua function to connect to *event*.
-- @param index Optional index to insert the handler into.
@@ -353,23 +332,24 @@ end
function M.disconnect(event, f)
assert_type(f, 'function', 2)
for i = 1, #handlers[assert_type(event, 'string', 1)] do
- if handlers[event][i] == f then table.remove(handlers[event], i) break end
+ if handlers[event][i] == f then
+ table.remove(handlers[event], i)
+ break
+ end
end
end
local error_emitted = false
---
--- Sequentially calls all handler functions for event *event* with the given
--- arguments.
--- *event* may be any arbitrary string and does not need to have been previously
--- defined. If any handler explicitly returns a value that is not `nil`,
--- `emit()` returns that value and ceases to call subsequent handlers. This is
--- useful for stopping the propagation of an event like a keypress after it has
--- been handled, or for passing back values from handlers.
+-- Sequentially calls all handler functions for event *event* with the given arguments.
+-- *event* may be any arbitrary string and does not need to have been previously defined. If
+-- any handler explicitly returns a value that is not `nil`, `emit()` returns that value and
+-- ceases to call subsequent handlers. This is useful for stopping the propagation of an event
+-- like a keypress after it has been handled, or for passing back values from handlers.
-- @param event The string event name.
-- @param ... Arguments passed to the handler.
--- @return `nil` unless any any handler explicitly returned a non-`nil` value;
--- otherwise returns that value
+-- @return `nil` unless any any handler explicitly returned a non-`nil` value; otherwise returns
+-- that value
-- @usage events.emit('my_event', 'my message')
-- @name emit
function M.emit(event, ...)
@@ -402,7 +382,9 @@ end)
-- Set event constants.
for _, v in pairs(_SCINTILLA.events) do M[v[1]:upper()] = v[1] end
+-- LuaFormatter off
local textadept_events = {'appleevent_odoc','buffer_after_switch','buffer_before_switch','buffer_deleted','buffer_new','csi','command_text_changed','error','find','find_text_changed','focus','initialized','keypress','menu_clicked','mouse','quit','replace','replace_all','reset_after','reset_before','resume','suspend', 'tab_clicked','unfocus','view_after_switch','view_before_switch','view_new'}
+-- LuaFormatter on
for _, v in pairs(textadept_events) do M[v:upper()] = v end
return M
diff --git a/core/file_io.lua b/core/file_io.lua
index 6bd3692d..6760c4cd 100644
--- a/core/file_io.lua
+++ b/core/file_io.lua
@@ -27,12 +27,11 @@
-- Arguments:
--
-- * _`filename`_: The filename of the file being saved.
--- * _`saved_as`_: Whether or not the file was saved under a different
--- filename.
+-- * _`saved_as`_: Whether or not the file was saved under a different filename.
-- @field _G.events.FILE_CHANGED (string)
-- Emitted when Textadept detects that an open file was modified externally.
--- When connecting to this event, connect with an index of 1 in order to
--- override the default prompt to reload the file.
+-- When connecting to this event, connect with an index of 1 in order to override the default
+-- prompt to reload the file.
-- Arguments:
--
-- * _`filename`_: The filename externally modified.
@@ -42,7 +41,9 @@
module('io')]]
-- Events.
+-- LuaFormatter off
local file_io_events = {'file_opened','file_before_reload','file_after_reload','file_before_save','file_after_save','file_changed'}
+-- LuaFormatter on
for _, v in ipairs(file_io_events) do events[v:upper()] = v end
io.quick_open_max = 1000
@@ -55,16 +56,15 @@ io.recent_files = {}
---
-- List of encodings to attempt to decode files as.
--- You should add to this list if you get a "Conversion failed" error when
--- trying to open a file whose encoding is not recognized. Valid encodings are
--- [GNU iconv's encodings][] and include:
+-- You should add to this list if you get a "Conversion failed" error when trying to open a file
+-- whose encoding is not recognized. Valid encodings are [GNU iconv's encodings][] and include:
--
--- * European: ASCII, ISO-8859-{1,2,3,4,5,7,9,10,13,14,15,16}, KOI8-R, KOI8-U,
--- KOI8-RU, CP{1250,1251,1252,1253,1254,1257}, CP{850,866,1131},
--- Mac{Roman,CentralEurope,Iceland,Croatian,Romania},
--- Mac{Cyrillic,Ukraine,Greek,Turkish}, Macintosh.
--- * Unicode: UTF-8, UCS-2, UCS-2BE, UCS-2LE, UCS-4, UCS-4BE, UCS-4LE, UTF-16,
--- UTF-16BE, UTF-16LE, UTF-32, UTF-32BE, UTF-32LE, UTF-7, C99, JAVA.
+-- * European: ASCII, ISO-8859-{1,2,3,4,5,7,9,10,13,14,15,16}, KOI8-R,
+-- KOI8-U, KOI8-RU, CP{1250,1251,1252,1253,1254,1257}, CP{850,866,1131},
+-- Mac{Roman,CentralEurope,Iceland,Croatian,Romania}, Mac{Cyrillic,Ukraine,Greek,Turkish},
+-- Macintosh.
+-- * Unicode: UTF-8, UCS-2, UCS-2BE, UCS-2LE, UCS-4, UCS-4BE, UCS-4LE, UTF-16, UTF-16BE,
+-- UTF-16LE, UTF-32, UTF-32BE, UTF-32LE, UTF-7, C99, JAVA.
--
-- [GNU iconv's encodings]: https://www.gnu.org/software/libiconv/
-- @usage io.encodings[#io.encodings + 1] = 'UTF-32'
@@ -73,14 +73,12 @@ io.recent_files = {}
io.encodings = {'UTF-8', 'ASCII', 'CP1252', 'UTF-16'}
---
--- Opens *filenames*, a string filename or list of filenames, or the
--- user-selected filename(s).
+-- Opens *filenames*, a string filename or list of filenames, or the user-selected filename(s).
-- Emits a `FILE_OPENED` event.
--- @param filenames Optional string filename or table of filenames to open. If
--- `nil`, the user is prompted with a fileselect dialog.
--- @param encodings Optional string encoding or table of encodings file contents
--- are in (one encoding per file). If `nil`, encoding auto-detection is
--- attempted via `io.encodings`.
+-- @param filenames Optional string filename or table of filenames to open. If `nil`, the user
+-- is prompted with a fileselect dialog.
+-- @param encodings Optional string encoding or table of encodings file contents are in (one
+-- encoding per file). If `nil`, encoding auto-detection is attempted via `io.encodings`.
-- @see _G.events
-- @name open_file
function io.open_file(filenames, encodings)
@@ -88,8 +86,7 @@ function io.open_file(filenames, encodings)
if not assert_type(filenames, 'string/table/nil', 1) then
filenames = ui.dialogs.fileselect{
title = _L['Open File'], select_multiple = true,
- with_directory = (buffer.filename or ''):match('^.+[/\\]') or
- lfs.currentdir(),
+ with_directory = (buffer.filename or ''):match('^.+[/\\]') or lfs.currentdir(),
width = CURSES and ui.size[1] - 2 or nil
}
if not filenames then return end
@@ -99,7 +96,10 @@ function io.open_file(filenames, encodings)
for i = 1, #filenames do
local filename = lfs.abspath((filenames[i]:gsub('^file://', '')))
for _, buf in ipairs(_BUFFERS) do
- if filename == buf.filename then view:goto_buffer(buf) goto continue end
+ if filename == buf.filename then
+ view:goto_buffer(buf)
+ goto continue
+ end
end
local text = ''
@@ -189,7 +189,10 @@ end
-- LuaDoc is in core/.buffer.luadoc.
local function save(buffer)
if not buffer then buffer = _G.buffer end
- if not buffer.filename then buffer:save_as() return end
+ if not buffer.filename then
+ buffer:save_as()
+ return
+ end
events.emit(events.FILE_BEFORE_SAVE, buffer.filename)
local text = buffer:get_text()
if buffer.encoding then text = text:iconv(buffer.encoding, 'UTF-8') end
@@ -221,9 +224,7 @@ end
-- @see buffer.save
-- @name save_all_files
function io.save_all_files()
- for _, buffer in ipairs(_BUFFERS) do
- if buffer.filename and buffer.modify then buffer:save() end
- end
+ for _, buffer in ipairs(_BUFFERS) do if buffer.filename and buffer.modify then buffer:save() end end
end
-- LuaDoc is in core/.buffer.luadoc.
@@ -233,9 +234,8 @@ local function close(buffer, force)
local filename = buffer.filename or buffer._type or _L['Untitled']
if buffer.filename then filename = filename:iconv('UTF-8', _CHARSET) end
local button = ui.dialogs.msgbox{
- title = _L['Close without saving?'],
- text = _L['There are unsaved changes in'], informative_text = filename,
- icon = 'gtk-dialog-question', button1 = _L['Cancel'],
+ title = _L['Close without saving?'], text = _L['There are unsaved changes in'],
+ informative_text = filename, icon = 'gtk-dialog-question', button1 = _L['Cancel'],
button2 = _L['Close without saving'],
width = CURSES and #filename > 40 and ui.size[1] - 2 or nil
}
@@ -245,8 +245,8 @@ local function close(buffer, force)
return true
end
--- Detects if the current file has been externally modified and, if so, emits a
--- `FILE_CHANGED` event.
+-- Detects if the current file has been externally modified and, if so, emits a `FILE_CHANGED`
+-- event.
local function update_modified_file()
if not buffer.filename then return end
local mod_time = lfs.attributes(buffer.filename, 'modification')
@@ -261,8 +261,8 @@ events.connect(events.FOCUS, update_modified_file)
events.connect(events.RESUME, update_modified_file)
---
--- Closes all open buffers, prompting the user to continue if there are unsaved
--- buffers, and returns `true` if the user did not cancel.
+-- Closes all open buffers, prompting the user to continue if there are unsaved buffers, and
+-- returns `true` if the user did not cancel.
-- No buffers are saved automatically. They must be saved manually.
-- @return `true` if user did not cancel; `nil` otherwise.
-- @see buffer.close
@@ -281,19 +281,16 @@ events.connect(events.BUFFER_NEW, function()
buffer.save, buffer.save_as, buffer.close = save, save_as, close
end)
-- Export for later storage into the first buffer, which does not exist yet.
--- Cannot rely on `events.BUFFER_NEW` because init scripts (e.g. menus and key
--- bindings) can access buffer functions before the first `events.BUFFER_NEW` is
--- emitted.
+-- Cannot rely on `events.BUFFER_NEW` because init scripts (e.g. menus and key bindings) can
+-- access buffer functions before the first `events.BUFFER_NEW` is emitted.
io._reload, io._save, io._save_as, io._close = reload, save, save_as, close
--- Prompts the user to reload the current file if it has been externally
--- modified.
+-- Prompts the user to reload the current file if it has been externally modified.
events.connect(events.FILE_CHANGED, function(filename)
local button = ui.dialogs.msgbox{
title = _L['Reload?'], text = _L['Reload modified file?'],
- informative_text = string.format(
- '"%s"\n%s', filename:iconv('UTF-8', _CHARSET),
- _L['has been modified. Reload it?']),
+ informative_text = string.format('"%s"\n%s', filename:iconv('UTF-8', _CHARSET),
+ _L['has been modified. Reload it?']), -- LuaFormatter
icon = 'gtk-dialog-question', button1 = _L['Yes'], button2 = _L['No'],
width = CURSES and #filename > 40 and ui.size[1] - 2 or nil
}
@@ -332,23 +329,19 @@ end
local vcs = {'.bzr', '.git', '.hg', '.svn', '_FOSSIL_'}
---
--- Returns the root directory of the project that contains filesystem path
--- *path*.
--- In order to be recognized, projects must be under version control. Recognized
--- VCSes are Bazaar, Fossil, Git, Mercurial, and SVN.
--- @param path Optional filesystem path to a project or a file contained within
--- a project. The default value is the buffer's filename or the current
--- working directory. This parameter may be omitted.
--- @param submodule Optional flag that indicates whether or not to return the
--- root of the current submodule (if applicable). The default value is
--- `false`.
+-- Returns the root directory of the project that contains filesystem path *path*.
+-- In order to be recognized, projects must be under version control. Recognized VCSes are
+-- Bazaar, Fossil, Git, Mercurial, and SVN.
+-- @param path Optional filesystem path to a project or a file contained within a project. The
+-- default value is the buffer's filename or the current working directory. This parameter
+-- may be omitted.
+-- @param submodule Optional flag that indicates whether or not to return the root of the
+-- current submodule (if applicable). The default value is `false`.
-- @return string root or nil
-- @name get_project_root
function io.get_project_root(path, submodule)
if type(path) == 'boolean' then path, submodule = nil, path end
- if not assert_type(path, 'string/nil', 1) then
- path = buffer.filename or lfs.currentdir()
- end
+ if not assert_type(path, 'string/nil', 1) then path = buffer.filename or lfs.currentdir() end
local dir = path:match('^(.+)[/\\]?')
while dir do
for i = 1, #vcs do
@@ -368,38 +361,34 @@ end
io.quick_open_filters = {}
---
--- Prompts the user to select files to be opened from *paths*, a string
--- directory path or list of directory paths, using a filtered list dialog.
--- If *paths* is `nil`, uses the current project's root directory, which is
--- obtained from `io.get_project_root()`.
--- String or list *filter* determines which files to show in the dialog, with
--- the default filter being `io.quick_open_filters[path]` (if it exists) or
--- `lfs.default_filter`. A filter consists of Lua patterns that match file and
--- directory paths to include or exclude. Patterns are inclusive by default.
--- Exclusive patterns begin with a '!'. If no inclusive patterns are given, any
--- path is initially considered. As a convenience, file extensions can be
--- specified literally instead of as a Lua pattern (e.g. '.lua' vs. '%.lua$'),
--- and '/' also matches the Windows directory separator ('[/\\]' is not needed).
+-- Prompts the user to select files to be opened from *paths*, a string directory path or list
+-- of directory paths, using a filtered list dialog.
+-- If *paths* is `nil`, uses the current project's root directory, which is obtained from
+-- `io.get_project_root()`.
+-- String or list *filter* determines which files to show in the dialog, with the default
+-- filter being `io.quick_open_filters[path]` (if it exists) or `lfs.default_filter`. A filter
+-- consists of Lua patterns that match file and directory paths to include or exclude. Patterns
+-- are inclusive by default. Exclusive patterns begin with a '!'. If no inclusive patterns are
+-- given, any path is initially considered. As a convenience, file extensions can be specified
+-- literally instead of as a Lua pattern (e.g. '.lua' vs. '%.lua$'), and '/' also matches the
+-- Windows directory separator ('[/\\]' is not needed).
-- The number of files in the list is capped at `quick_open_max`.
-- If *filter* is `nil` and *paths* is ultimately a string, the filter from the
--- `io.quick_open_filters` table is used. If that filter does not exist,
--- `lfs.default_filter` is used.
--- *opts* is an optional table of additional options for
--- `ui.dialogs.filteredlist()`.
--- @param paths Optional string directory path or table of directory paths to
--- search. The default value is the current project's root directory, if
--- available.
--- @param filter Optional filter for files and directories to include and/or
--- exclude. The default value is `lfs.default_filter` unless a filter for
--- *paths* is defined in `io.quick_open_filters`.
--- @param opts Optional table of additional options for
--- `ui.dialogs.filteredlist()`.
--- @usage io.quick_open(buffer.filename:match('^(.+)[/\\]')) -- list all files
--- in the current file's directory, subject to the default filter
--- @usage io.quick_open(io.get_current_project(), '.lua') -- list all Lua files
--- in the current project
--- @usage io.quick_open(io.get_current_project(), '!/build') -- list all files
--- in the current project except those in the build directory
+-- `io.quick_open_filters` table is used. If that filter does not exist, `lfs.default_filter`
+-- is used.
+-- *opts* is an optional table of additional options for `ui.dialogs.filteredlist()`.
+-- @param paths Optional string directory path or table of directory paths to search. The
+-- default value is the current project's root directory, if available.
+-- @param filter Optional filter for files and directories to include and/or exclude. The
+-- default value is `lfs.default_filter` unless a filter for *paths* is defined in
+-- `io.quick_open_filters`.
+-- @param opts Optional table of additional options for `ui.dialogs.filteredlist()`.
+-- @usage io.quick_open(buffer.filename:match('^(.+)[/\\]')) -- list all files in the current
+-- file's directory, subject to the default filter
+-- @usage io.quick_open(io.get_current_project(), '.lua') -- list all Lua files in the current
+-- project
+-- @usage io.quick_open(io.get_current_project(), '!/build') -- list all files in the current
+-- project except those in the build directory
-- @see io.quick_open_filters
-- @see lfs.default_filter
-- @see quick_open_max
@@ -423,24 +412,20 @@ function io.quick_open(paths, filter, opts)
end
if #utf8_list >= io.quick_open_max then
ui.dialogs.msgbox{
- title = _L['File Limit Exceeded'],
- text = string.format(
- '%d %s %d', io.quick_open_max,
+ title = _L['File Limit Exceeded'], text = string.format('%d %s %d', io.quick_open_max,
_L['files or more were found. Showing the first'], io.quick_open_max),
icon = 'gtk-dialog-info'
}
end
local options = {
- title = _L['Open File'], columns = _L['Filename'], items = utf8_list,
- button1 = _L['OK'], button2 = _L['Cancel'], select_multiple = true,
- string_output = true, width = CURSES and ui.size[1] - 2 or nil
+ title = _L['Open File'], columns = _L['Filename'], items = utf8_list, button1 = _L['OK'],
+ button2 = _L['Cancel'], select_multiple = true, string_output = true,
+ width = CURSES and ui.size[1] - 2 or nil
}
if opts then for k, v in pairs(opts) do options[k] = v end end
local button, utf8_filenames = ui.dialogs.filteredlist(options)
if button ~= _L['OK'] or not utf8_filenames then return end
local filenames = {}
- for i = 1, #utf8_filenames do
- filenames[i] = utf8_filenames[i]:iconv(_CHARSET, 'UTF-8')
- end
+ for i = 1, #utf8_filenames do filenames[i] = utf8_filenames[i]:iconv(_CHARSET, 'UTF-8') end
io.open_file(filenames)
end
diff --git a/core/iface.lua b/core/iface.lua
index 67f60b63..ad779241 100644
--- a/core/iface.lua
+++ b/core/iface.lua
@@ -5,8 +5,7 @@ local M = {}
--[[ This comment is for LuaDoc.
---
-- Scintilla constants, functions, and properties.
--- Do not modify anything in this module. Doing so will have unpredictable
--- consequences.
+-- Do not modify anything in this module. Doing so will have unpredictable consequences.
module('_SCINTILLA')]]
---
@@ -17,8 +16,8 @@ module('_SCINTILLA')]]
M.constants = {ACCESSIBILITY_DISABLED=0,ACCESSIBILITY_ENABLED=1,ALPHA_NOALPHA=256,ALPHA_OPAQUE=255,ALPHA_TRANSPARENT=0,ANNOTATION_BOXED=2,ANNOTATION_HIDDEN=0,ANNOTATION_INDENTED=3,ANNOTATION_STANDARD=1,AUTOMATICFOLD_CHANGE=0x0004,AUTOMATICFOLD_CLICK=0x0002,AUTOMATICFOLD_SHOW=0x0001,CARETSTICKY_OFF=0,CARETSTICKY_ON=1,CARETSTICKY_WHITESPACE=2,CARETSTYLE_BLOCK=2,CARETSTYLE_BLOCK_AFTER=0x100,CARETSTYLE_INS_MASK=0xF,CARETSTYLE_INVISIBLE=0,CARETSTYLE_LINE=1,CARETSTYLE_OVERSTRIKE_BAR=0,CARETSTYLE_OVERSTRIKE_BLOCK=0x10,CARET_EVEN=0x08,CARET_JUMPS=0x10,CARET_SLOP=0x01,CARET_STRICT=0x04,CASEINSENSITIVEBEHAVIOR_IGNORECASE=1,CASEINSENSITIVEBEHAVIOR_RESPECTCASE=0,CASE_CAMEL=3,CASE_LOWER=2,CASE_MIXED=0,CASE_UPPER=1,CHARACTERSOURCE_DIRECT_INPUT=0,CHARACTERSOURCE_IME_RESULT=2,CHARACTERSOURCE_TENTATIVE_INPUT=1,CP_UTF8=65001,CURSORARROW=2,CURSORNORMAL=-1,CURSORREVERSEARROW=7,CURSORWAIT=4,EDGE_BACKGROUND=2,EDGE_LINE=1,EDGE_MULTILINE=3,EDGE_NONE=0,EOLANNOTATION_BOXED=2,EOLANNOTATION_HIDDEN=0,EOLANNOTATION_STANDARD=1,EOL_CR=1,EOL_CRLF=0,EOL_LF=2,FIND_CXX11REGEX=0x00800000,FIND_MATCHCASE=0x4,FIND_NONE=0x0,FIND_REGEXP=10485760,FIND_WHOLEWORD=0x2,FIND_WORDSTART=0x00100000,FOLDACTION_CONTRACT=0,FOLDACTION_EXPAND=1,FOLDACTION_TOGGLE=2,FOLDDISPLAYTEXT_BOXED=2,FOLDDISPLAYTEXT_HIDDEN=0,FOLDDISPLAYTEXT_STANDARD=1,FOLDFLAG_LEVELNUMBERS=0x0040,FOLDFLAG_LINEAFTER_CONTRACTED=0x0010,FOLDFLAG_LINEAFTER_EXPANDED=0x0008,FOLDFLAG_LINEBEFORE_CONTRACTED=0x0004,FOLDFLAG_LINEBEFORE_EXPANDED=0x0002,FOLDFLAG_LINESTATE=0x0080,FOLDLEVELBASE=0x400,FOLDLEVELHEADERFLAG=0x2000,FOLDLEVELNUMBERMASK=0x0FFF,FOLDLEVELWHITEFLAG=0x1000,IDLESTYLING_AFTERVISIBLE=2,IDLESTYLING_ALL=3,IDLESTYLING_NONE=0,IDLESTYLING_TOVISIBLE=1,IME_INLINE=1,IME_WINDOWED=0,INDICATOR_CONTAINER=9,INDICATOR_IME=33,INDICATOR_IME_MAX=36,INDICATOR_MAX=36,INDIC_BOX=6,INDIC_COMPOSITIONTHICK=14,INDIC_COMPOSITIONTHIN=15,INDIC_CONTAINER=8,INDIC_DASH=9,INDIC_DIAGONAL=3,INDIC_DOTBOX=12,INDIC_DOTS=10,INDIC_FULLBOX=16,INDIC_GRADIENT=20,INDIC_GRADIENTCENTER=21,INDIC_HIDDEN=5,INDIC_IME=32,INDIC_IME_MAX=35,INDIC_MAX=35,INDIC_PLAIN=0,INDIC_POINT=18,INDIC_POINTCHARACTER=19,INDIC_ROUNDBOX=7,INDIC_SQUIGGLE=1,INDIC_SQUIGGLELOW=11,INDIC_SQUIGGLEPIXMAP=13,INDIC_STRAIGHTBOX=8,INDIC_STRIKE=4,INDIC_TEXTFORE=17,INDIC_TT=2,IV_LOOKBOTH=3,IV_LOOKFORWARD=2,IV_NONE=0,IV_REAL=1,LASTSTEPINUNDOREDO=0x100,MARGINOPTION_NONE=0,MARGINOPTION_SUBLINESELECT=1,MARGIN_BACK=2,MARGIN_COLOR=6,MARGIN_FORE=3,MARGIN_NUMBER=1,MARGIN_RTEXT=5,MARGIN_SYMBOL=0,MARGIN_TEXT=4,MARKER_MAX=32,MARKNUM_FOLDER=31,MARKNUM_FOLDEREND=26,MARKNUM_FOLDERMIDTAIL=28,MARKNUM_FOLDEROPEN=32,MARKNUM_FOLDEROPENMID=27,MARKNUM_FOLDERSUB=30,MARKNUM_FOLDERTAIL=29,MARK_ARROW=2,MARK_ARROWDOWN=6,MARK_ARROWS=24,MARK_AVAILABLE=28,MARK_BACKGROUND=22,MARK_BOOKMARK=31,MARK_BOXMINUS=14,MARK_BOXMINUSCONNECTED=15,MARK_BOXPLUS=12,MARK_BOXPLUSCONNECTED=13,MARK_CHARACTER=10000,MARK_CIRCLE=0,MARK_CIRCLEMINUS=20,MARK_CIRCLEMINUSCONNECTED=21,MARK_CIRCLEPLUS=18,MARK_CIRCLEPLUSCONNECTED=19,MARK_DOTDOTDOT=23,MARK_EMPTY=5,MARK_FULLRECT=26,MARK_LCORNER=10,MARK_LCORNERCURVE=16,MARK_LEFTRECT=27,MARK_MINUS=7,MARK_PIXMAP=25,MARK_PLUS=8,MARK_RGBAIMAGE=30,MARK_ROUNDRECT=1,MARK_SHORTARROW=4,MARK_SMALLRECT=3,MARK_TCORNER=11,MARK_TCORNERCURVE=17,MARK_UNDERLINE=29,MARK_VERTICALBOOKMARK=32,MARK_VLINE=9,MASK_FOLDERS=0xFE000000,MAX_MARGIN=5,MODEVENTMASKALL=0x7FFFFF,MOD_ALT=4,MOD_BEFOREDELETE=0x800,MOD_BEFOREINSERT=0x400,MOD_CHANGEANNOTATION=0x20000,MOD_CHANGEEOLANNOTATION=0x400000,MOD_CHANGEFOLD=0x8,MOD_CHANGEINDICATOR=0x4000,MOD_CHANGELINESTATE=0x8000,MOD_CHANGEMARGIN=0x10000,MOD_CHANGEMARKER=0x200,MOD_CHANGESTYLE=0x4,MOD_CHANGETABSTOPS=0x200000,MOD_CONTAINER=0x40000,MOD_CTRL=2,MOD_DELETETEXT=0x2,MOD_INSERTCHECK=0x100000,MOD_INSERTTEXT=0x1,MOD_LEXERSTATE=0x80000,MOD_META=16,MOD_NONE=0x0,MOD_NORM=0,MOD_SHIFT=1,MOD_SUPER=8,MOUSE_DRAG=2,MOUSE_PRESS=1,MOUSE_RELEASE=3,MULTIAUTOC_EACH=1,MULTIAUTOC_ONCE=0,MULTILINEUNDOREDO=0x1000,MULTIPASTE_EACH=1,MULTIPASTE_ONCE=0,MULTISTEPUNDOREDO=0x80,ORDER_CUSTOM=2,ORDER_PERFORMSORT=1,ORDER_PRESORTED=0,PERFORMED_REDO=0x40,PERFORMED_UNDO=0x20,PERFORMED_USER=0x10,SEL_LINES=2,SEL_RECTANGLE=1,SEL_STREAM=0,SEL_THIN=3,STARTACTION=0x2000,STYLE_BRACEBAD=36,STYLE_BRACELIGHT=35,STYLE_CALLTIP=39,STYLE_CONTROLCHAR=37,STYLE_DEFAULT=33,STYLE_FOLDDISPLAYTEXT=40,STYLE_INDENTGUIDE=38,STYLE_LASTPREDEFINED=40,STYLE_LINENUMBER=34,STYLE_MAX=256,TD_LONGARROW=0,TD_STRIKEOUT=1,TIME_FOREVER=10000000,UNDO_NONE=0,UPDATE_CONTENT=0x1,UPDATE_H_SCROLL=0x8,UPDATE_SELECTION=0x2,UPDATE_V_SCROLL=0x4,VISIBLE_SLOP=0x01,VISIBLE_STRICT=0x04,VS_NONE=0,VS_NOWRAPLINESTART=4,VS_RECTANGULARSELECTION=1,VS_USERACCESSIBLE=2,WRAPINDENT_DEEPINDENT=3,WRAPINDENT_FIXED=0,WRAPINDENT_INDENT=2,WRAPINDENT_SAME=1,WRAPVISUALFLAGLOC_DEFAULT=0x0000,WRAPVISUALFLAGLOC_END_BY_TEXT=0x0001,WRAPVISUALFLAGLOC_START_BY_TEXT=0x0002,WRAPVISUALFLAG_END=0x0001,WRAPVISUALFLAG_MARGIN=0x0004,WRAPVISUALFLAG_NONE=0x0000,WRAPVISUALFLAG_START=0x0002,WRAP_CHAR=2,WRAP_NONE=0,WRAP_WHITESPACE=3,WRAP_WORD=1,WS_INVISIBLE=0,WS_VISIBLEAFTERINDENT=2,WS_VISIBLEALWAYS=1,WS_VISIBLEONLYININDENT=3}
---
--- Map of Scintilla function names to tables containing their IDs, return types,
--- wParam types, and lParam types. Types are as follows:
+-- Map of Scintilla function names to tables containing their IDs, return types, wParam types,
+-- and lParam types. Types are as follows:
--
-- + `0`: Void.
-- + `1`: Integer.
@@ -34,8 +33,8 @@ M.constants = {ACCESSIBILITY_DISABLED=0,ACCESSIBILITY_ENABLED=1,ALPHA_NOALPHA=25
M.functions = {add_ref_document={2376,0,0,1},add_selection={2573,0,3,3},add_styled_text={2002,0,2,9},add_tab_stop={2676,0,3,1},add_text={2001,0,2,7},add_undo_action={2560,0,1,1},allocate={2446,0,3,0},allocate_extended_styles={2553,1,1,0},allocate_sub_styles={4020,1,1,1},annotation_clear_all={2547,0,0,0},append_text={2282,0,2,7},assign_cmd_key={2070,0,6,1},auto_c_active={2102,5,0,0},auto_c_cancel={2101,0,0,0},auto_c_complete={2104,0,0,0},auto_c_pos_start={2103,3,0,0},auto_c_select={2108,0,0,7},auto_c_show={2100,0,1,7},auto_c_stops={2105,0,0,7},back_tab={2328,0,0,0},begin_undo_action={2078,0,0,0},brace_bad_light={2352,0,3,0},brace_bad_light_indicator={2499,0,5,3},brace_highlight={2351,0,3,3},brace_highlight_indicator={2498,0,5,3},brace_match={2353,3,3,1},brace_match_next={2369,3,3,3},call_tip_active={2202,5,0,0},call_tip_cancel={2201,0,0,0},call_tip_pos_start={2203,3,0,0},call_tip_set_hlt={2204,0,3,3},call_tip_show={2200,0,3,7},can_paste={2173,5,0,0},can_redo={2016,5,0,0},can_undo={2174,5,0,0},cancel={2325,0,0,0},change_insertion={2672,0,2,7},change_lexer_state={2617,1,3,3},char_left={2304,0,0,0},char_left_extend={2305,0,0,0},char_left_rect_extend={2428,0,0,0},char_position_from_point={2561,3,1,1},char_position_from_point_close={2562,3,1,1},char_right={2306,0,0,0},char_right_extend={2307,0,0,0},char_right_rect_extend={2429,0,0,0},choose_caret_x={2399,0,0,0},clear={2180,0,0,0},clear_all={2004,0,0,0},clear_all_cmd_keys={2072,0,0,0},clear_cmd_key={2071,0,6,0},clear_document_style={2005,0,0,0},clear_registered_images={2408,0,0,0},clear_representation={2667,0,7,0},clear_selections={2571,0,0,0},clear_tab_stops={2675,0,3,0},colorize={4003,0,3,3},contracted_fold_next={2618,3,3,0},convert_eols={2029,0,1,0},copy={2178,0,0,0},copy_allow_line={2519,0,0,0},copy_range={2419,0,3,3},copy_text={2420,0,2,7},count_characters={2633,1,3,3},count_code_units={2715,1,3,3},create_document={2375,1,3,1},create_loader={2632,1,3,1},cut={2177,0,0,0},del_line_left={2395,0,0,0},del_line_right={2396,0,0,0},del_word_left={2335,0,0,0},del_word_right={2336,0,0,0},del_word_right_end={2518,0,0,0},delete_back={2326,0,0,0},delete_back_not_line={2344,0,0,0},delete_range={2645,0,3,2},describe_key_word_sets={4017,0,0,8},describe_property={4016,0,7,8},description_of_style={4032,0,3,8},doc_line_from_visible={2221,3,3,0},document_end={2318,0,0,0},document_end_extend={2319,0,0,0},document_start={2316,0,0,0},document_start_extend={2317,0,0,0},drop_selection_n={2671,0,3,0},edit_toggle_overtype={2324,0,0,0},empty_undo_buffer={2175,0,0,0},encoded_from_utf8={2449,0,7,8},end_undo_action={2079,0,0,0},ensure_visible={2232,0,3,0},ensure_visible_enforce_policy={2234,0,3,0},eol_annotation_clear_all={2744,0,0,0},expand_children={2239,0,3,1},find_column={2456,3,3,3},find_indicator_flash={2641,0,3,3},find_indicator_hide={2642,0,0,0},find_indicator_show={2640,0,3,3},find_text={2150,3,1,11},fold_all={2662,0,1,0},fold_children={2238,0,3,1},fold_line={2237,0,3,1},form_feed={2330,0,0,0},format_range={2151,3,5,12},free_sub_styles={4023,0,0,0},get_cur_line={2027,3,2,8},get_default_fold_display_text={2723,0,0,8},get_hotspot_active_back={2495,4,0,0},get_hotspot_active_fore={2494,4,0,0},get_line={2153,0,3,8},get_line_sel_end_position={2425,3,3,0},get_line_sel_start_position={2424,3,3,0},get_next_tab_stop={2677,1,3,1},get_sel_text={2161,0,0,8},get_styled_text={2015,3,0,10},get_text={2182,0,2,8},get_text_range={2162,3,0,10},goto_line={2024,0,3,0},goto_pos={2025,0,3,0},grab_focus={2400,0,0,0},hide_lines={2227,0,3,3},hide_selection={2163,0,5,0},home={2312,0,0,0},home_display={2345,0,0,0},home_display_extend={2346,0,0,0},home_extend={2313,0,0,0},home_rect_extend={2430,0,0,0},home_wrap={2349,0,0,0},home_wrap_extend={2450,0,0,0},indicator_all_on_for={2506,1,3,0},indicator_clear_range={2505,0,3,2},indicator_end={2509,3,3,3},indicator_fill_range={2504,0,3,2},indicator_start={2508,3,3,3},indicator_value_at={2507,1,3,3},insert_text={2003,0,3,7},is_range_word={2691,5,3,3},line_copy={2455,0,0,0},line_cut={2337,0,0,0},line_delete={2338,0,0,0},line_down={2300,0,0,0},line_down_extend={2301,0,0,0},line_down_rect_extend={2426,0,0,0},line_duplicate={2404,0,0,0},line_end={2314,0,0,0},line_end_display={2347,0,0,0},line_end_display_extend={2348,0,0,0},line_end_extend={2315,0,0,0},line_end_rect_extend={2432,0,0,0},line_end_wrap={2451,0,0,0},line_end_wrap_extend={2452,0,0,0},line_from_position={2166,3,3,0},line_length={2350,1,3,0},line_reverse={2354,0,0,0},line_scroll={2168,0,1,1},line_scroll_down={2342,0,0,0},line_scroll_up={2343,0,0,0},line_transpose={2339,0,0,0},line_up={2302,0,0,0},line_up_extend={2303,0,0,0},line_up_rect_extend={2427,0,0,0},lines_join={2288,0,0,0},lines_split={2289,0,1,0},load_lexer_library={4007,0,0,7},lower_case={2340,0,0,0},margin_text_clear_all={2536,0,0,0},marker_add={2043,1,3,3},marker_add_set={2466,0,3,1},marker_define={2040,0,3,1},marker_define_pixmap={2049,0,3,7},marker_define_rgba_image={2626,0,3,7},marker_delete={2044,0,3,3},marker_delete_all={2045,0,3,0},marker_delete_handle={2018,0,1,0},marker_enable_highlight={2293,0,5,0},marker_get={2046,1,3,0},marker_handle_from_line={2732,1,3,3},marker_line_from_handle={2017,3,1,0},marker_next={2047,3,3,1},marker_number_from_line={2733,3,3,3},marker_previous={2048,3,3,1},marker_symbol_defined={2529,1,3,0},move_caret_inside_view={2401,0,0,0},move_selected_lines_down={2621,0,0,0},move_selected_lines_up={2620,0,0,0},multi_edge_add_line={2694,0,1,4},multi_edge_clear_all={2695,0,0,0},multiple_select_add_each={2689,0,0,0},multiple_select_add_next={2688,0,0,0},name_of_style={4030,0,3,8},new_line={2329,0,0,0},null={2172,0,0,0},page_down={2322,0,0,0},page_down_extend={2323,0,0,0},page_down_rect_extend={2434,0,0,0},page_up={2320,0,0,0},page_up_extend={2321,0,0,0},page_up_rect_extend={2433,0,0,0},para_down={2413,0,0,0},para_down_extend={2414,0,0,0},para_up={2415,0,0,0},para_up_extend={2416,0,0,0},paste={2179,0,0,0},point_x_from_position={2164,1,0,3},point_y_from_position={2165,1,0,3},position_after={2418,3,3,0},position_before={2417,3,3,0},position_from_line={2167,3,3,0},position_from_point={2022,3,1,1},position_from_point_close={2023,3,1,1},position_relative={2670,3,3,1},position_relative_code_units={2716,3,3,3},private_lexer_call={4013,1,1,1},property_names={4014,0,0,8},property_type={4015,1,7,0},redo={2011,0,0,0},register_image={2405,0,1,7},register_rgba_image={2627,0,1,7},release_all_extended_styles={2552,0,0,0},release_document={2377,0,0,1},replace_sel={2170,0,0,7},replace_target={2194,1,2,7},replace_target_re={2195,1,2,7},rotate_selection={2606,0,0,0},scroll_caret={2169,0,0,0},scroll_range={2569,0,3,3},scroll_to_end={2629,0,0,0},scroll_to_start={2628,0,0,0},search_anchor={2366,0,0,0},search_in_target={2197,3,2,7},search_next={2367,3,1,7},search_prev={2368,3,1,7},select_all={2013,0,0,0},selection_duplicate={2469,0,0,0},set_chars_default={2444,0,0,0},set_default_fold_display_text={2722,0,0,7},set_empty_selection={2556,0,3,0},set_fold_margin_color={2290,0,5,4},set_fold_margin_hi_color={2291,0,5,4},set_hotspot_active_back={2411,0,5,4},set_hotspot_active_fore={2410,0,5,4},set_length_for_encode={2448,0,3,0},set_save_point={2014,0,0,0},set_sel={2160,0,3,3},set_sel_back={2068,0,5,4},set_sel_fore={2067,0,5,4},set_selection={2572,0,3,3},set_styling={2033,0,2,3},set_styling_ex={2073,0,2,7},set_target_range={2686,0,3,3},set_text={2181,0,0,7},set_visible_policy={2394,0,1,1},set_whitespace_back={2085,0,5,4},set_whitespace_fore={2084,0,5,4},set_x_caret_policy={2402,0,1,1},set_y_caret_policy={2403,0,1,1},show_lines={2226,0,3,3},start_record={3001,0,0,0},start_styling={2032,0,3,1},stop_record={3002,0,0,0},stuttered_page_down={2437,0,0,0},stuttered_page_down_extend={2438,0,0,0},stuttered_page_up={2435,0,0,0},stuttered_page_up_extend={2436,0,0,0},style_clear_all={2050,0,0,0},style_reset_default={2058,0,0,0},swap_main_anchor_caret={2607,0,0,0},tab={2327,0,0,0},tags_of_style={4031,0,3,8},target_as_utf8={2447,0,0,8},target_from_selection={2287,0,0,0},target_whole_document={2690,0,0,0},text_height={2279,1,3,0},text_width={2276,1,3,7},toggle_caret_sticky={2459,0,0,0},toggle_fold={2231,0,3,0},toggle_fold_show_text={2700,0,3,7},undo={2176,0,0,0},upper_case={2341,0,0,0},use_pop_up={2371,0,1,0},user_list_show={2117,0,1,7},vc_home={2331,0,0,0},vc_home_display={2652,0,0,0},vc_home_display_extend={2653,0,0,0},vc_home_extend={2332,0,0,0},vc_home_rect_extend={2431,0,0,0},vc_home_wrap={2453,0,0,0},vc_home_wrap_extend={2454,0,0,0},vertical_center_caret={2619,0,0,0},visible_from_doc_line={2220,3,3,0},word_end_position={2267,3,3,5},word_left={2308,0,0,0},word_left_end={2439,0,0,0},word_left_end_extend={2440,0,0,0},word_left_extend={2309,0,0,0},word_part_left={2390,0,0,0},word_part_left_extend={2391,0,0,0},word_part_right={2392,0,0,0},word_part_right_extend={2393,0,0,0},word_right={2310,0,0,0},word_right_end={2441,0,0,0},word_right_end_extend={2442,0,0,0},word_right_extend={2311,0,0,0},word_start_position={2266,3,3,5},wrap_count={2235,1,3,0},zoom_in={2333,0,0,0},zoom_out={2334,0,0,0},}
---
--- Map of Scintilla property names to table values containing their "get"
--- function IDs, "set" function IDs, return types, and wParam types.
+-- Map of Scintilla property names to table values containing their "get" function IDs, "set"
+-- function IDs, return types, and wParam types.
-- The wParam type will be non-zero if the property is indexable.
-- Types are the same as in the `functions` table.
-- @see functions
@@ -53,8 +52,8 @@ local marker_number, indic_number, list_type, image_type = 0, 0, 0, 0
---
-- Returns a unique marker number for use with `view.marker_define()`.
--- Use this function for custom markers in order to prevent clashes with
--- identifiers of other custom markers.
+-- Use this function for custom markers in order to prevent clashes with identifiers of other
+-- custom markers.
-- @usage local marknum = _SCINTILLA.next_marker_number()
-- @see view.marker_define
-- @name next_marker_number
@@ -66,8 +65,8 @@ end
---
-- Returns a unique indicator number for use with custom indicators.
--- Use this function for custom indicators in order to prevent clashes with
--- identifiers of other custom indicators.
+-- Use this function for custom indicators in order to prevent clashes with identifiers of
+-- other custom indicators.
-- @usage local indic_num = _SCINTILLA.next_indic_number()
-- @see view.indic_style
-- @name next_indic_number
@@ -78,10 +77,9 @@ function M.next_indic_number()
end
---
--- Returns a unique user list identier number for use with
--- `buffer.user_list_show()`.
--- Use this function for custom user lists in order to prevent clashes with
--- list identifiers of other custom user lists.
+-- Returns a unique user list identier number for use with `buffer.user_list_show()`.
+-- Use this function for custom user lists in order to prevent clashes with list identifiers
+-- of other custom user lists.
-- @usage local list_type = _SCINTILLA.next_user_list_type()
-- @see buffer.user_list_show
-- @name next_user_list_type
@@ -91,10 +89,10 @@ function M.next_user_list_type()
end
---
--- Returns a unique image type identier number for use with
--- `view.register_image()` and `view.register_rgba_image()`.
--- Use this function for custom image types in order to prevent clashes with
--- identifiers of other custom image types.
+-- Returns a unique image type identier number for use with `view.register_image()` and
+-- `view.register_rgba_image()`.
+-- Use this function for custom image types in order to prevent clashes with identifiers of
+-- other custom image types.
-- @usage local image_type = _SCINTILLA.next_image_type()
-- @see view.register_image
-- @see view.register_rgba_image
diff --git a/core/init.lua b/core/init.lua
index 712d07a7..361edf3e 100644
--- a/core/init.lua
+++ b/core/init.lua
@@ -6,9 +6,7 @@ _COPYRIGHT = 'Copyright © 2007-2021 Mitchell. See LICENSE.\n' ..
package.path = string.format('%s/core/?.lua;%s', _HOME, package.path)
---for _, arg in ipairs(arg) do
--- if arg == '-t' or arg == '--test' then pcall(require, 'luacov') end
---end
+-- for _, arg in ipairs(arg) do if arg == '-t' or arg == '--test' then pcall(require, 'luacov') end end
require('assert')
_SCINTILLA = require('iface')
@@ -40,13 +38,11 @@ if CURSES and WIN32 then
end
end
--- Replacement for original `buffer:text_range()`, which has a C struct for an
--- argument.
+-- Replacement for original `buffer:text_range()`, which has a C struct for an argument.
-- Documentation is in core/.buffer.luadoc.
local function text_range(buffer, start_pos, end_pos)
local target_start, target_end = buffer.target_start, buffer.target_end
- buffer:set_target_range(
- math.max(1, assert_type(start_pos, 'number', 2)),
+ buffer:set_target_range(math.max(1, assert_type(start_pos, 'number', 2)),
math.min(assert_type(end_pos, 'number', 3), buffer.length + 1))
local text = buffer.target_text
buffer:set_target_range(target_start, target_end) -- restore
@@ -56,13 +52,11 @@ end
local GETNAMEDSTYLE = _SCINTILLA.properties.named_styles[1]
-- Documentation is in core/.buffer.luadoc.
local function style_of_name(buffer, style_name)
- return buffer:private_lexer_call(
- GETNAMEDSTYLE, assert_type(style_name, 'string', 2))
+ return buffer:private_lexer_call(GETNAMEDSTYLE, assert_type(style_name, 'string', 2))
end
-events.connect(events.BUFFER_NEW, function()
- buffer.text_range, buffer.style_of_name = text_range, style_of_name
-end)
+events.connect(events.BUFFER_NEW,
+ function() buffer.text_range, buffer.style_of_name = text_range, style_of_name end)
--[[ This comment is for LuaDoc.
---
@@ -72,13 +66,12 @@ end)
-- @field _RELEASE (string)
-- The Textadept release version string.
-- @field _USERHOME (string)
--- The path to the user's *~/.textadept/* directory, where all preferences and
--- user-data is stored.
--- On Windows machines *~/* is the value of the "USERHOME" environment
--- variable (typically *C:\Users\username\\* or
--- *C:\Documents and Settings\username\\*). On Linux, BSD, and macOS
--- machines *~/* is the value of "$HOME" (typically */home/username/* and
--- */Users/username/* respectively).
+-- The path to the user's *~/.textadept/* directory, where all preferences and user-data
+-- is stored.
+-- On Windows machines *~/* is the value of the "USERHOME" environment variable (typically
+-- *C:\Users\username\\* or *C:\Documents and Settings\username\\*). On Linux, BSD, and macOS
+-- machines *~/* is the value of "$HOME" (typically */home/username/* and */Users/username/*
+-- respectively).
-- @field _CHARSET (string)
-- The filesystem's character encoding.
-- This is used when [working with files](#io).
@@ -108,8 +101,7 @@ local arg
---
-- Table of all open buffers in Textadept.
--- Numeric keys have buffer values and buffer keys have their associated numeric
--- keys.
+-- Numeric keys have buffer values and buffer keys have their associated numeric keys.
-- @class table
-- @usage _BUFFERS[n] --> buffer at index n
-- @usage _BUFFERS[buffer] --> index of buffer in _BUFFERS
@@ -119,8 +111,7 @@ local _BUFFERS
---
-- Table of all views in Textadept.
--- Numeric keys have view values and view keys have their associated numeric
--- keys.
+-- Numeric keys have view values and view keys have their associated numeric keys.
-- @class table
-- @usage _VIEWS[n] --> view at index n
-- @usage _VIEWS[view] --> index of view in _VIEWS
@@ -143,8 +134,7 @@ local view
-- The functions below are Lua C functions.
---
--- Emits a `QUIT` event, and unless any handler returns `false`, quits
--- Textadept.
+-- Emits a `QUIT` event, and unless any handler returns `false`, quits Textadept.
-- @see events.QUIT
-- @class function
-- @name quit
@@ -152,21 +142,20 @@ local quit
---
-- Resets the Lua State by reloading all initialization scripts.
--- Language modules for opened files are NOT reloaded. Re-opening the files that
--- use them will reload those modules instead.
--- This function is useful for modifying user scripts (such as
--- *~/.textadept/init.lua* and *~/.textadept/modules/textadept/keys.lua*) on
--- the fly without having to restart Textadept. `arg` is set to `nil` when
--- reinitializing the Lua State. Any scripts that need to differentiate between
--- startup and reset can test `arg`.
+-- Language modules for opened files are NOT reloaded. Re-opening the files that use them will
+-- reload those modules instead.
+-- This function is useful for modifying user scripts (such as *~/.textadept/init.lua* and
+-- *~/.textadept/modules/textadept/keys.lua*) on the fly without having to restart Textadept. `arg`
+-- is set to `nil` when reinitializing the Lua State. Any scripts that need to differentiate
+-- between startup and reset can test `arg`.
-- @class function
-- @name reset
local reset
---
-- Calls function *f* with the given arguments after *interval* seconds.
--- If *f* returns `true`, calls *f* repeatedly every *interval* seconds as long
--- as *f* returns `true`. A `nil` or `false` return value stops repetition.
+-- If *f* returns `true`, calls *f* repeatedly every *interval* seconds as long as *f* returns
+-- `true`. A `nil` or `false` return value stops repetition.
-- @param interval The interval in seconds to call *f* after.
-- @param f The function to call.
-- @param ... Additional arguments to pass to *f*.
diff --git a/core/keys.lua b/core/keys.lua
index 72cb1161..f952f106 100644
--- a/core/keys.lua
+++ b/core/keys.lua
@@ -8,50 +8,43 @@ local M = {}
--
-- ### Overview
--
--- Define key bindings in the global `keys` table in key-value pairs. Each pair
--- consists of either a string key sequence and its associated command, a string
--- lexer name (from the *lexers/* directory) with a table of key sequences and
--- commands, a string key mode with a table of key sequences and commands, or a
--- key sequence with a table of more sequences and commands. The latter is part
--- of what is called a "key chain", to be discussed below. When searching for a
--- command to run based on a key sequence, Textadept considers key bindings in
--- the current key mode to have priority. If no key mode is active,
--- language-specific key bindings have priority, followed by the ones in the
--- global table. This means if there are two commands with the same key
--- sequence, Textadept runs the language-specific one. However, if the command
--- returns the boolean value `false`, Textadept also runs the lower-priority
--- command. (This is useful for language modules to override commands like
--- autocompletion, but fall back to word autocompletion if the first command
--- fails.)
+-- Define key bindings in the global `keys` table in key-value pairs. Each pair consists of
+-- either a string key sequence and its associated command, a string lexer name (from the
+-- *lexers/* directory) with a table of key sequences and commands, a string key mode with a
+-- table of key sequences and commands, or a key sequence with a table of more sequences and
+-- commands. The latter is part of what is called a "key chain", to be discussed below. When
+-- searching for a command to run based on a key sequence, Textadept considers key bindings
+-- in the current key mode to have priority. If no key mode is active, language-specific key
+-- bindings have priority, followed by the ones in the global table. This means if there are
+-- two commands with the same key sequence, Textadept runs the language-specific one. However,
+-- if the command returns the boolean value `false`, Textadept also runs the lower-priority
+-- command. (This is useful for language modules to override commands like autocompletion,
+-- but fall back to word autocompletion if the first command fails.)
--
-- ### Key Sequences
--
--- Key sequences are strings built from an ordered combination of modifier keys
--- and the key's inserted character. Modifier keys are "Control", "Shift", and
--- "Alt" on Windows, Linux, BSD, and in the terminal version. On macOS they are
--- "Control" (`^`), "Alt/Option" (`⌥`), "Command" (`⌘`), and "Shift" (`⇧`).
--- These modifiers have the following string representations:
---
--- Modifier | Linux / Win32 | macOS | Terminal |
--- ---------|---------------|-----------|-----------|
--- Control | `'ctrl'` | `'ctrl'` | `'ctrl'` |
--- Alt | `'alt'` | `'alt'` | `'meta'` |
--- Command | N/A | `'cmd'` | N/A |
--- Shift | `'shift'` | `'shift'` | `'shift'` |
---
--- The string representation of key values less than 255 is the character that
--- Textadept would normally insert if the "Control", "Alt", and "Command"
--- modifiers were not held down. Therefore, a combination of `Ctrl+Alt+Shift+A`
--- has the key sequence `ctrl+alt+A` on Windows and Linux, but a combination of
--- `Ctrl+Shift+Tab` has the key sequence `ctrl+shift+\t`. On a United States
--- English keyboard, since the combination of `Ctrl+Shift+,` has the key
--- sequence `ctrl+<` (`Shift+,` inserts a `<`), Textadept recognizes the key
--- binding as `Ctrl+<`. This allows key bindings to be language and layout
--- agnostic. For key values greater than 255, Textadept uses the
--- [`keys.KEYSYMS`]() lookup table. Therefore, `Ctrl+Right Arrow` has the key
--- sequence `ctrl+right`. Uncommenting the `print()` statements in
--- *core/keys.lua* causes Textadept to print key sequences to standard out
--- (stdout) for inspection.
+-- Key sequences are strings built from an ordered combination of modifier keys and the key's
+-- inserted character. Modifier keys are "Control", "Shift", and "Alt" on Windows, Linux, BSD,
+-- and in the terminal version. On macOS they are "Control" (`^`), "Alt/Option" (`⌥`), "Command"
+-- (`⌘`), and "Shift" (`⇧`). These modifiers have the following string representations:
+--
+-- Modifier | Linux / Win32 | macOS | Terminal
+-- -|-|-|-
+-- Control | `'ctrl'` | `'ctrl'` | `'ctrl'`
+-- Alt | `'alt'` | `'alt'` | `'meta'`
+-- Command | N/A | `'cmd'` | N/A
+-- Shift | `'shift'` | `'shift'` | `'shift'`
+--
+-- The string representation of key values less than 255 is the character that Textadept would
+-- normally insert if the "Control", "Alt", and "Command" modifiers were not held down. Therefore,
+-- a combination of `Ctrl+Alt+Shift+A` has the key sequence `ctrl+alt+A` on Windows and Linux,
+-- but a combination of `Ctrl+Shift+Tab` has the key sequence `ctrl+shift+\t`. On a United States
+-- English keyboard, since the combination of `Ctrl+Shift+,` has the key sequence `ctrl+<`
+-- (`Shift+,` inserts a `<`), Textadept recognizes the key binding as `Ctrl+<`. This allows
+-- key bindings to be language and layout agnostic. For key values greater than 255, Textadept
+-- uses the [`keys.KEYSYMS`]() lookup table. Therefore, `Ctrl+Right Arrow` has the key sequence
+-- `ctrl+right`. Uncommenting the `print()` statements in *core/keys.lua* causes Textadept to
+-- print key sequences to standard out (stdout) for inspection.
--
-- ### Commands
--
@@ -65,9 +58,9 @@ local M = {}
--
-- ### Modes
--
--- Modes are groups of key bindings such that when a key [mode](#keys.mode) is
--- active, Textadept ignores all key bindings defined outside the mode until the
--- mode is unset. Here is a simple vi mode example:
+-- Modes are groups of key bindings such that when a key [mode](#keys.mode) is active, Textadept
+-- ignores all key bindings defined outside the mode until the mode is unset. Here is a simple
+-- vi mode example:
--
-- keys.command_mode = {
-- ['h'] = buffer.char_left,
@@ -86,15 +79,14 @@ local M = {}
-- end)
-- keys.mode = 'command_mode' -- default mode
--
--- **Warning**: When creating a mode, be sure to define a way to exit the mode,
--- otherwise you will probably have to restart Textadept.
+-- **Warning**: When creating a mode, be sure to define a way to exit the mode, otherwise you
+-- will probably have to restart Textadept.
--
-- ### Key Chains
--
--- Key chains are a powerful concept. They allow you to assign multiple key
--- bindings to one key sequence. By default, the `Esc` key cancels a key chain,
--- but you can redefine it via [`keys.CLEAR`](). An example key chain looks
--- like:
+-- Key chains are a powerful concept. They allow you to assign multiple key bindings to one
+-- key sequence. By default, the `Esc` key cancels a key chain, but you can redefine it via
+-- [`keys.CLEAR`](). An example key chain looks like:
--
-- keys['alt+a'] = {
-- a = function1,
@@ -107,8 +99,7 @@ local M = {}
-- The default value is `'esc'` for the `Esc` key.
-- @field mode (string)
-- The current key mode.
--- When non-`nil`, all key bindings defined outside of `keys[mode]` are
--- ignored.
+-- When non-`nil`, all key bindings defined outside of `keys[mode]` are ignored.
-- The default value is `nil`.
module('keys')]]
@@ -116,18 +107,19 @@ local CTRL, ALT, CMD, SHIFT = 'ctrl+', 'alt+', 'cmd+', 'shift+'
if CURSES then ALT = 'meta+' end
M.CLEAR = 'esc'
+-- LuaFormatter off
---
-- Lookup table for string representations of key codes higher than 255.
--- Key codes can be identified by temporarily uncommenting the `print()`
--- statements in *core/keys.lua*.
--- Recognized codes are: esc, \b, \t, \n, down, up, left, right, home, end,
--- pgup, pgdn, del, ins, and f1-f12.
--- The GUI version also recognizes: kpenter, kphome, kpend, kpleft, kpup,
--- kpright, kpdown, kppgup, kppgdn, kpmul, kpadd, kpsub, kpdiv, kpdec, and
--- kp0-kp9.
+-- Key codes can be identified by temporarily uncommenting the `print()` statements in
+-- *core/keys.lua*.
+-- Recognized codes are: esc, \b, \t, \n, down, up, left, right, home, end, pgup, pgdn, del,
+-- ins, and f1-f12.
+-- The GUI version also recognizes: kpenter, kphome, kpend, kpleft, kpup, kpright, kpdown,
+-- kppgup, kppgdn, kpmul, kpadd, kpsub, kpdiv, kpdec, and kp0-kp9.
-- @class table
-- @name KEYSYMS
M.KEYSYMS = {--[[From Scintilla.h for CURSES]][7]='esc',[8]='\b',[9]='\t',[13]='\n',--[[From curses.h]][263]='\b',[343]='\n',--[[From Scintilla.h for CURSES]][300]='down',[301]='up',[302]='left',[303]='right',[304]='home',[305]='end',[306]='pgup',[307]='pgdn',[308]='del',[309]='ins',--[[From <gdk/gdkkeysyms.h>]][0xFE20]='\t'--[[backtab; will be 'shift'ed]],[0xFF08]='\b',[0xFF09]='\t',[0xFF0D]='\n',[0xFF1B]='esc',[0xFFFF]='del',[0xFF50]='home',[0xFF51]='left',[0xFF52]='up',[0xFF53]='right',[0xFF54]='down',[0xFF55]='pgup',[0xFF56]='pgdn',[0xFF57]='end',[0xFF63]='ins',[0xFF8D]='kpenter',[0xFF95]='kphome',[0xFF9C]='kpend',[0xFF96]='kpleft',[0xFF97]='kpup',[0xFF98]='kpright',[0xFF99]='kpdown',[0xFF9A]='kppgup',[0xFF9B]='kppgdn',[0xFFAA]='kpmul',[0xFFAB]='kpadd',[0xFFAD]='kpsub',[0xFFAF]='kpdiv',[0xFFAE]='kpdec',[0xFFB0]='kp0',[0xFFB1]='kp1',[0xFFB2]='kp2',[0xFFB3]='kp3',[0xFFB4]='kp4',[0xFFB5]='kp5',[0xFFB6]='kp6',[0xFFB7]='kp7',[0xFFB8]='kp8',[0xFFB9]='kp9',[0xFFBE]='f1',[0xFFBF]='f2',[0xFFC0]='f3',[0xFFC1]='f4',[0xFFC2]='f5',[0xFFC3]='f6',[0xFFC4]='f7',[0xFFC5]='f8',[0xFFC6]='f9',[0xFFC7]='f10',[0xFFC8]='f11',[0xFFC9]='f12'}
+-- LuaFormatter on
-- The current key sequence.
local keychain = {}
@@ -137,8 +129,7 @@ local keychain = {}
-- @class table
-- @name keychain
M.keychain = setmetatable({}, {
- __index = keychain,
- __newindex = function() error('read-only table') end,
+ __index = keychain, __newindex = function() error('read-only table') end,
__len = function() return #keychain end
})
@@ -148,9 +139,8 @@ local function clear_key_seq() for i = 1, #keychain do keychain[i] = nil end end
-- Return codes for `key_command()`.
local INVALID, PROPAGATE, CHAIN, HALT = -1, 0, 1, 2
--- Error handler for key commands that simply emits the error. This is needed
--- so `key_command()` can return `HALT` instead of never returning due to the
--- error.
+-- Error handler for key commands that simply emits the error.
+-- This is needed so `key_command()` can return `HALT` instead of never returning due to the error.
local function key_error(errmsg) events.emit(events.ERROR, errmsg) end
-- Runs a key command associated with the current keychain.
@@ -164,17 +154,15 @@ local function key_command(prefix)
end
if type(key) ~= 'function' and type(key) ~= 'table' then return INVALID end
if type(key) == 'table' then
- ui.statusbar_text = string.format(
- '%s %s', _L['Keychain:'], table.concat(keychain, ' '))
+ ui.statusbar_text = string.format('%s %s', _L['Keychain:'], table.concat(keychain, ' '))
return CHAIN
end
return select(2, xpcall(key, key_error)) == false and PROPAGATE or HALT
end
--- Handles Textadept keypresses, executing commands based on a mode or lexer as
--- necessary.
+-- Handles Textadept keypresses, executing commands based on a mode or lexer as necessary.
events.connect(events.KEYPRESS, function(code, shift, control, alt, cmd, caps)
- --print(code, M.KEYSYMS[code], shift, control, alt, cmd, caps)
+ -- print(code, M.KEYSYMS[code], shift, control, alt, cmd, caps)
if caps and (shift or control or alt or cmd) and code < 256 then
code = string[shift and 'upper' or 'lower'](string.char(code)):byte()
end
@@ -184,14 +172,17 @@ events.connect(events.KEYPRESS, function(code, shift, control, alt, cmd, caps)
if shift and code >= 32 and code < 256 then shift = false end
-- For composed keys on macOS, ignore alt.
if OSX and alt and code < 256 then alt = false end
- local key_seq = (control and CTRL or '') .. (alt and ALT or '') ..
- (cmd and OSX and CMD or '') .. (shift and SHIFT or '') .. key
- --print(key_seq)
+ local key_seq = (control and CTRL or '') .. (alt and ALT or '') .. (cmd and OSX and CMD or '') ..
+ (shift and SHIFT or '') .. key
+ -- print(key_seq)
ui.statusbar_text = ''
- --if CURSES then ui.statusbar_text = string.format('"%s"', key_seq) end
+ -- if CURSES then ui.statusbar_text = string.format('"%s"', key_seq) end
local in_chain = #keychain > 0
- if in_chain and key_seq == M.CLEAR then clear_key_seq() return true end
+ if in_chain and key_seq == M.CLEAR then
+ clear_key_seq()
+ return true
+ end
keychain[#keychain + 1] = key_seq
local status = PROPAGATE
@@ -212,12 +203,13 @@ end)
--[[ This comment is for LuaDoc.
---
--- Map of key bindings to commands, with language-specific key tables assigned
--- to a lexer name key.
+-- Map of key bindings to commands, with language-specific key tables assigned to a lexer name key.
-- @class table
-- @name _G.keys
local keys]]
+-- LuaFormatter off
for lexer in string.gmatch('actionscript ada apdl ansi_c antlr apl applescript asp autoit awk b_lang bash batch bibtex boo chuck clojure cmake coffeescript context cpp crystal csharp css cuda desktop django dmd dockerfile dot eiffel elixir elm erlang fantom faust fennel fish forth fortran fsharp fstab gap gettext gherkin glsl gnuplot go groovy gtkrc haskell html icon idl inform ini Io java javascript jq json jsp julia latex ledger less lilypond lisp logtalk lua makefile matlab meson moonscript myrddin nemerle networkd nim nsis objective_c pascal perl php pico8 pike pkgbuild pony prolog props protobuf ps pure python rails rc reason rebol rest rexx rhtml routeros rstats ruby rust sass scala scheme smalltalk sml snobol4 spin sql systemd tcl tex text toml typescript vala vb vbscript verilog vhdl wsf xml xs xtend yaml zig', '%S+') do M[lexer] = {} end
+-- LuaFormatter on
return M
diff --git a/core/lfs_ext.lua b/core/lfs_ext.lua
index 090de173..3f34803f 100644
--- a/core/lfs_ext.lua
+++ b/core/lfs_ext.lua
@@ -2,27 +2,26 @@
--[[ This comment is for LuaDoc.
---
--- Extends the `lfs` library to find files in directories and determine absolute
--- file paths.
+-- Extends the `lfs` library to find files in directories and determine absolute file paths.
module('lfs')]]
+-- LuaFormatter off
---
--- The filter table containing common binary file extensions and version control
--- directories to exclude when iterating over files and directories using
--- `walk`.
--- Extensions excluded: a, bmp, bz2, class, dll, exe, gif, gz, jar, jpeg, jpg,
--- o, pdf, png, so, tar, tgz, tif, tiff, xz, and zip.
+-- The filter table containing common binary file extensions and version control directories
+-- to exclude when iterating over files and directories using `walk`.
+-- Extensions excluded: a, bmp, bz2, class, dll, exe, gif, gz, jar, jpeg, jpg, o, pdf, png,
+-- so, tar, tgz, tif, tiff, xz, and zip.
-- Directories excluded: .bzr, .git, .hg, .svn, _FOSSIL_, and node_modules.
-- @see walk
-- @class table
-- @name default_filter
lfs.default_filter = {--[[Extensions]]'!.a','!.bmp','!.bz2','!.class','!.dll','!.exe','!.gif','!.gz','!.jar','!.jpeg','!.jpg','!.o','!.pdf','!.png','!.so','!.tar','!.tgz','!.tif','!.tiff','!.xz','!.zip',--[[Directories]]'!/%.bzr$','!/%.git$','!/%.hg$','!/%.svn$','!/_FOSSIL_$','!/node_modules$'}
+-- LuaFormatter on
-- Documentation is in `lfs.walk()`.
--- @param seen Utility table that holds directories seen. If there is a
--- duplicate, stop walking down that path (it's probably a recursive symlink).
--- @param level Utility value indicating the directory level this function is
--- at.
+-- @param seen Utility table that holds directories seen. If there is a duplicate, stop walking
+-- down that path (it's probably a recursive symlink).
+-- @param level Utility value indicating the directory level this function is at.
local function walk(dir, filter, n, include_dirs, seen, level)
if not seen then seen = {} end
local sep = not WIN32 and '/' or '\\'
@@ -52,9 +51,7 @@ local function walk(dir, filter, n, include_dirs, seen, level)
coroutine.yield(os_filename)
elseif mode == 'directory' then
local link = lfs.symlinkattributes(filename, 'target')
- if link and seen[lfs.abspath(link .. sep, dir):gsub('[/\\]+$', '')] then
- goto continue
- end
+ if link and seen[lfs.abspath(link .. sep, dir):gsub('[/\\]+$', '')] then goto continue end
if include_dirs then coroutine.yield(os_filename .. sep) end
if n and (level or 0) >= n then goto continue end
walk(filename, filter, n, include_dirs, seen, (level or 0) + 1)
@@ -64,39 +61,33 @@ local function walk(dir, filter, n, include_dirs, seen, level)
end
---
--- Returns an iterator that iterates over all files and sub-directories (up to
--- *n* levels deep) in directory *dir* and yields each file found.
--- String or list *filter* determines which files to yield, with the default
--- filter being `lfs.default_filter`. A filter consists of Lua patterns that
--- match file and directory paths to include or exclude. Exclusive patterns
--- begin with a '!'. If no inclusive patterns are given, any path is initially
--- considered. As a convenience, file extensions can be specified literally
--- instead of as a Lua pattern (e.g. '.lua' vs. '%.lua$'), and '/' also matches
--- the Windows directory separator ('[/\\]' is not needed).
+-- Returns an iterator that iterates over all files and sub-directories (up to *n* levels deep)
+-- in directory *dir* and yields each file found.
+-- String or list *filter* determines which files to yield, with the default filter being
+-- `lfs.default_filter`. A filter consists of Lua patterns that match file and directory paths
+-- to include or exclude. Exclusive patterns begin with a '!'. If no inclusive patterns are
+-- given, any path is initially considered. As a convenience, file extensions can be specified
+-- literally instead of as a Lua pattern (e.g. '.lua' vs. '%.lua$'), and '/' also matches the
+-- Windows directory separator ('[/\\]' is not needed).
-- @param dir The directory path to iterate over.
--- @param filter Optional filter for files and directories to include and
--- exclude. The default value is `lfs.default_filter`.
--- @param n Optional maximum number of directory levels to descend into.
--- The default value is `nil`, which indicates no limit.
--- @param include_dirs Optional flag indicating whether or not to yield
--- directory names too. Directory names are passed with a trailing '/' or '\',
--- depending on the current platform.
+-- @param filter Optional filter for files and directories to include and exclude. The default
+-- value is `lfs.default_filter`.
+-- @param n Optional maximum number of directory levels to descend into. The default value is
+-- `nil`, which indicates no limit.
+-- @param include_dirs Optional flag indicating whether or not to yield directory names too.
+-- Directory names are passed with a trailing '/' or '\', depending on the current platform.
-- The default value is `false`.
-- @see filter
-- @name walk
function lfs.walk(dir, filter, n, include_dirs)
dir = assert_type(dir, 'string', 1):match('^(..-)[/\\]?$')
- if not assert_type(filter, 'string/table/nil', 2) then
- filter = lfs.default_filter
- end
+ if not assert_type(filter, 'string/table/nil', 2) then filter = lfs.default_filter end
assert_type(n, 'number/nil', 3)
- -- Process the given filter into something that can match files more easily
- -- and/or quickly. For example, convert '.ext' shorthand to '%.ext$',
- -- substitute '/' with '[/\\]', and enable hash lookup for file extensions
- -- to include or exclude.
+ -- Process the given filter into something that can match files more easily and/or quickly. For
+ -- example, convert '.ext' shorthand to '%.ext$', substitute '/' with '[/\\]', and enable
+ -- hash lookup for file extensions to include or exclude.
local processed_filter = {
- consider_any = true,
- exts = setmetatable({}, {__index = function() return true end})
+ consider_any = true, exts = setmetatable({}, {__index = function() return true end})
}
for _, patt in ipairs(type(filter) == 'table' and filter or {filter}) do
patt = patt:gsub('^(!?)%%?%.([^.]+)$', '%1%%.%2$') -- '.lua' to '%.lua$'
@@ -111,15 +102,14 @@ function lfs.walk(dir, filter, n, include_dirs)
processed_filter[#processed_filter + 1] = patt
end
end
- local co = coroutine.create(
- function() walk(dir, processed_filter, n, include_dirs) end)
+ local co = coroutine.create(function() walk(dir, processed_filter, n, include_dirs) end)
return function() return select(2, coroutine.resume(co)) end
end
---
-- Returns the absolute path to string *filename*.
--- *prefix* or `lfs.currentdir()` is prepended to a relative filename. The
--- returned path is not guaranteed to exist.
+-- *prefix* or `lfs.currentdir()` is prepended to a relative filename. The returned path is
+-- not guaranteed to exist.
-- @param filename The relative or absolute path to a file.
-- @param prefix Optional prefix path prepended to a relative filename.
-- @return string absolute path
@@ -127,11 +117,8 @@ end
function lfs.abspath(filename, prefix)
assert_type(filename, 'string', 1)
assert_type(prefix, 'string/nil', 2)
- if WIN32 then
- filename = filename:gsub('/', '\\'):gsub('^%l:[/\\]', string.upper)
- end
- if not filename:find(not WIN32 and '^/' or '^%a:[/\\]') and
- not (WIN32 and filename:find('^\\\\')) then
+ if WIN32 then filename = filename:gsub('/', '\\'):gsub('^%l:[/\\]', string.upper) end
+ if not filename:find(not WIN32 and '^/' or '^%a:[/\\]') and not (WIN32 and filename:find('^\\\\')) then
if not prefix then prefix = lfs.currentdir() end
filename = prefix .. (not WIN32 and '/' or '\\') .. filename
end
diff --git a/core/locale.conf b/core/locale.conf
index 5deeac29..ea283aec 100644
--- a/core/locale.conf
+++ b/core/locale.conf
@@ -1,27 +1,26 @@
# Copyright 2007-2020 Mitchell. See LICENSE.
# American English localization file for Textadept.
#
-# When translating this file into your native language, all translated text must
-# be encoded in UTF-8. For each "key = value" line, please replace the "value"
-# part with the translation of "key". Any whitespace around '=' is ignored.
+# When translating this file into your native language, all translated text must be encoded in
+# UTF-8. For each "key = value" line, please replace the "value" part with the translation of
+# "key". Any whitespace around '=' is ignored.
#
-# Note: for languages that support it, buttons and menu items may have a "_"
-# before any single letter, which means that pressing the "Alt" modifier key
-# along with that letter will activate (click) the button or menu item. You are
-# free to use or omit these "_" mnemonics from your translations as you see fit.
+# Note: for languages that support it, buttons and menu items may have a "_" before any single
+# letter, which means that pressing the "Alt" modifier key along with that letter will activate
+# (click) the button or menu item. You are free to use or omit these "_" mnemonics from your
+# translations as you see fit.
# [core/file_io.lua]
# The title of dialogs prompting the user to open a file.
Open File = Open File
-# The error message displayed when a file's text encoding could not be detected
-# and when that text cannot be converted into UTF-8 for display.
+# The error message displayed when a file's text encoding could not be detected and when that
+# text cannot be converted into UTF-8 for display.
Encoding conversion failed. = Encoding conversion failed.
# The title of dialogs prompting the user to save a file.
Save File = Save File
# The text displayed for untitled and unsaved buffers.
Untitled = Untitled
-# The text displayed in a dialog when the user attempts to close a file with
-# unsaved changes.
+# The text displayed in a dialog when the user attempts to close a file with unsaved changes.
Close without saving? = Close without saving?
There are unsaved changes in = There are unsaved changes in
Cancel = _Cancel
@@ -34,19 +33,17 @@ Yes = _Yes
No = _No
# The column label for lists of filenames in dialogs.
Filename = File
-# The text displayed in a dialog when more than X files were found in the quick
-# open dialog.
+# The text displayed in a dialog when more than X files were found in the quick open dialog.
files or more were found. Showing the first = files or more were found. Showing the first
File Limit Exceeded = File Limit Exceeded
OK = _OK
# [core/keys.lua]
-# The statusbar text shown when the user has pressed a key that is part of a key
-# chain (e.g. "Ctrl+Alt+V" followed by "S"). Textadept is waiting for another
-# keypress.
+# The statusbar text shown when the user has pressed a key that is part of a key chain
+# (e.g. "Ctrl+Alt+V" followed by "S"). Textadept is waiting for another keypress.
Keychain: = Keychain:
-# The statusbar text shown when the user started a key chain, but the next
-# keypress was unrecognized. Thus the key sequence is invalid.
+# The statusbar text shown when the user started a key chain, but the next keypress was
+# unrecognized. Thus the key sequence is invalid.
Invalid sequence = Invalid sequence
# [core/ui.lua]
@@ -56,8 +53,7 @@ Invalid sequence = Invalid sequence
Name = Name
# The title of the dialog for switching between open buffers.
Switch Buffers = Switch Buffers
-# The line-ending, indentation, and positional buffer information shown in the
-# statusbar.
+# The line-ending, indentation, and positional buffer information shown in the statusbar.
CRLF = CRLF
LF = LF
Tabs: = Tabs:
@@ -66,8 +62,8 @@ Line: = Line:
Col: = Col:
# The statusbar text shown when the user resets Textadept's internal Lua state.
Lua reset = Lua reset
-# The text displayed in a dialog when the user attempts to quit Textadept with
-# unsaved changes in open buffers.
+# The text displayed in a dialog when the user attempts to quit Textadept with unsaved changes
+# in open buffers.
Quit without saving? = Quit without saving?
The following buffers are unsaved: = The following buffers are unsaved:
Quit without saving = Quit _without saving
@@ -81,8 +77,8 @@ Bookmark = Bookmark
# The text displayed in the dialog for jumping to a particular line.
Go To = Go To
Line Number: = Line Number:
-# The statusbar message displayed when a shell command used to filter text
-# through returns a non-zero status (indicating failure).
+# The statusbar message displayed when a shell command used to filter text through returns a
+# non-zero status (indicating failure).
returned non-zero status = returned non-zero status
# [modules/textadept/find.lua]
@@ -100,8 +96,7 @@ Whole word = _Whole word
Regex = Rege_x
In files = _In files
# The button text displayed in the terminal version's find & replace pane.
-# These should be as short as possible, as most terminals are 80 characters in
-# width.
+# These should be as short as possible, as most terminals are 80 characters in width.
[Next] = [Next]
[Prev] = [Prev]
[Replace] = [Replace]
@@ -110,8 +105,7 @@ Case(F1) = Case(F1)
Word(F2) = Word(F2)
Regex(F3) = Regex(F3)
Files(F4) = Files(F4)
-# The statusbar text shown when a search has wrapped back to the beginning of
-# the buffer.
+# The statusbar text shown when a search has wrapped back to the beginning of the buffer.
Search wrapped = Search wrapped
# Part of the statusbar text "Match X/Y" shown during searches.
Match = Match
@@ -142,8 +136,8 @@ Save Macro = Save Macro
Load Macro = Load Macro
# [modules/textadept/menu.lua]
-# Typical "File" menu items for creating new files, opening, saving, and closing
-# existing files, opening and saving sessions, and quitting Textadept.
+# Typical "File" menu items for creating new files, opening, saving, and closing existing files,
+# opening and saving sessions, and quitting Textadept.
File = _File
New = _New
Open = _Open
@@ -174,8 +168,8 @@ Complete Word = Complete _Word
Toggle Block Comment = Toggle _Block Comment
Transpose Characters = T_ranspose Characters
Join Lines = _Join Lines
-# The menu item for filtering text through a shell command and replacing input
-# text with that command's output text.
+# The menu item for filtering text through a shell command and replacing input text with that
+# command's output text.
Filter Through = Filter Thr_ough
# Menu items for selecting text and entities.
Select = _Select
@@ -216,8 +210,7 @@ Goto Next File Found = Goto Nex_t File Found
Goto Previous File Found = Goto Previou_s File Found
# Menu item for jumping to a specific line in a buffer.
Jump to = _Jump to
-# Menu items for various tools and utilities for editing and working with source
-# code.
+# Menu items for various tools and utilities for editing and working with source code.
Tools = _Tools
# Menu item for opening Textadept's Lua command entry.
Command Entry = Command _Entry
@@ -228,8 +221,8 @@ Run = _Run
Compile = _Compile
# Menu item for setting command line arguments for run and compile commands.
Set Arguments... = Set _Arguments...
-# The text displayed in the dialog for specifying command line arguments for run
-# and compile commands.
+# The text displayed in the dialog for specifying command line arguments for run and compile
+# commands.
Command line arguments = Command line arguments
For Run: = For Run:
For Compile: = For Compile:
@@ -255,30 +248,30 @@ Start/Stop Recording = Start/Stop _Recording
Play = _Play
Save... = Sa_ve...
Load... = _Load...
-# Menu items for launching a quick open dialog in order to open files in certain
-# directories. A quick open dialog lists all files in a directory and its
-# subdirectories and filters the list down as the user types.
+# Menu items for launching a quick open dialog in order to open files in certain directories. A
+# quick open dialog lists all files in a directory and its subdirectories and filters the list
+# down as the user types.
Quick Open = Quick _Open
Quickly Open User Home = Quickly Open _User Home
Quickly Open Textadept Home = Quickly Open _Textadept Home
Quickly Open Current Directory = Quickly Open _Current Directory
Quickly Open Current Project = Quickly Open Current _Project
-# Menu items for working with snippets, insert-able pieces of code that act like
-# templates with placeholders for user input.
+# Menu items for working with snippets, insert-able pieces of code that act like templates with
+# placeholders for user input.
Snippets = _Snippets
Insert Snippet... = _Insert Snippet...
Expand Snippet/Next Placeholder = _Expand Snippet/Next Placeholder
Previous Snippet Placeholder = _Previous Snippet Placeholder
Cancel Snippet = _Cancel Snippet
Complete Trigger Word = Complete Trigger _Word
-# Menu items for auto-completing programming language symbols and showing
-# documentation for them (e.g. typing `textadept.editing.` followed by a
-# "Complete Symbol" would show all possible completions for that symbol).
+# Menu items for auto-completing programming language symbols and showing documentation for them
+# (e.g. typing `textadept.editing.` followed by a "Complete Symbol" would show all possible
+# completions for that symbol).
Complete Symbol = Complete S_ymbol
Show Documentation = S_how Documentation
-# Menu item for inspecting the character under the caret. The character's byte
-# information, the lexer used to syntax-highlight that character, and the
-# character's lexical style (e.g. string, comment, number, etc.) are shown.
+# Menu item for inspecting the character under the caret. The character's byte information, the
+# lexer used to syntax-highlight that character, and the character's lexical style (e.g. string,
+# comment, number, etc.) are shown.
Show Style = Sho_w Style
Lexer = Lexer
Style = Style
@@ -306,11 +299,9 @@ UTF-16 Encoding = UTF-1_6 Encoding
# Menu items for changing the way the current buffer is displayed.
Toggle Wrap Mode = Toggle _Wrap Mode
Toggle View Whitespace = Toggle View White_space
-# Menu items for changing the syntax-highlighting language for the current
-# buffer.
+# Menu items for changing the syntax-highlighting language for the current buffer.
Select Lexer... = Select _Lexer...
-# Menu items for navigating between views, splitting them, closing them, and
-# resizing them.
+# Menu items for navigating between views, splitting them, closing them, and resizing them.
View = _View
Next View = _Next View
Previous View = _Previous View
@@ -320,14 +311,12 @@ Unsplit View = _Unsplit View
Unsplit All Views = Unsplit _All Views
Grow View = _Grow View
Shrink View = Shrin_k View
-# Menu item for folding (showing/hiding) the block of code the starts on the
-# current line. Fold-able blocks of code are typically classes, functions, and
-# control structures.
+# Menu item for folding (showing/hiding) the block of code the starts on the current
+# line. Fold-able blocks of code are typically classes, functions, and control structures.
Toggle Current Fold = Toggle Current _Fold
# Menu item for showing line indentation markers.
Toggle Show Indent Guides = Toggle Show In_dent Guides
-# Menu item for allowing the caret to move beyond line ends and into "virtual
-# space".
+# Menu item for allowing the caret to move beyond line ends and into "virtual space".
Toggle Virtual Space = Toggle _Virtual Space
# Menu items for changing the zoom factor of displayed buffer text.
Zoom In = Zoom _In
@@ -338,15 +327,15 @@ Help = _Help
Show Manual = Show _Manual
Show LuaDoc = Show _LuaDoc
About = _About
-# The text displayed in the dialog for running an arbitrary menu command. Any
-# key binding associated with commands are also shown.
+# The text displayed in the dialog for running an arbitrary menu command. Any key binding
+# associated with commands are also shown.
Run Command = Run Command
Command = Command
Key Binding = Key Binding
# [modules/textadept/file_types.lua]
-# The title of the dialog for selecting a lexer for the current buffer. Lexers
-# perform syntax highlighting of source code.
+# The title of the dialog for selecting a lexer for the current buffer. Lexers perform syntax
+# highlighting of source code.
Select Lexer = Select Lexer
# [modules/textadept/session.lua]
@@ -359,9 +348,8 @@ The following session files were not found = The following session files were no
Save Session = Save Session
# [modules/textadept/snippets.lua]
-# The text displayed in the dialog for selecting a snippet to insert. Snippets
-# have a trigger word (pressing the "Tab" key after that word inserts the
-# snippet) and snippet text.
+# The text displayed in the dialog for selecting a snippet to insert. Snippets have a trigger
+# word (pressing the "Tab" key after that word inserts the snippet) and snippet text.
Select Snippet = Select Snippet
Trigger = Trigger
Snippet Text = Snippet Text
diff --git a/core/locale.lua b/core/locale.lua
index 7e115854..57fbff27 100644
--- a/core/locale.lua
+++ b/core/locale.lua
@@ -5,24 +5,20 @@ local M = {}
--[[ This comment is for LuaDoc.
---
-- Map of all messages used by Textadept to their localized form.
--- If the table does not contain the localized version of a given message, it
--- returns a string that starts with "No Localization:" via a metamethod.
--- Note: the terminal version ignores any "_" mnemonics the GUI version would
--- use.
+-- If the table does not contain the localized version of a given message, it returns a string
+-- that starts with "No Localization:" via a metamethod.
+-- Note: the terminal version ignores any "_" mnemonics the GUI version would use.
module('_L')]]
local f = io.open(_USERHOME .. '/locale.conf', 'rb')
if not f then
local lang = (os.getenv('LANG') or ''):match('^[^_.@]+') -- TODO: LC_MESSAGES?
- if lang then
- f = io.open(string.format('%s/core/locales/locale.%s.conf', _HOME, lang))
- end
+ if lang then f = io.open(string.format('%s/core/locales/locale.%s.conf', _HOME, lang)) end
end
if not f then f = io.open(_HOME .. '/core/locale.conf', 'rb') end
assert(f, '"core/locale.conf" not found')
for line in f:lines() do
- -- Any line that starts with a non-word character except '[' is considered a
- -- comment.
+ -- Any line that starts with a non-word character except '[' is considered a comment.
if not line:find('^%s*[%w_%[]') then goto continue end
local id, str = line:match('^(.-)%s*=%s*(.-)\r?$')
if id and str and assert(not M[id], 'duplicate locale key "%s"', id) then
@@ -32,5 +28,4 @@ for line in f:lines() do
end
f:close()
-return setmetatable(
- M, {__index = function(_, k) return 'No Localization:' .. k end})
+return setmetatable(M, {__index = function(_, k) return 'No Localization:' .. k end})
diff --git a/core/ui.lua b/core/ui.lua
index 19bf5881..eb366c93 100644
--- a/core/ui.lua
+++ b/core/ui.lua
@@ -26,15 +26,14 @@ local ui = ui
-- @field tabs (bool)
-- Whether or not to display the tab bar when multiple buffers are open.
-- The default value is `true`.
--- A third option, `ui.SHOW_ALL_TABS` may be used to always show the tab bar,
--- even if only one buffer is open.
+-- A third option, `ui.SHOW_ALL_TABS` may be used to always show the tab bar, even if only
+-- one buffer is open.
-- @field silent_print (bool)
-- Whether or not to print messages to buffers silently.
--- This is not guaranteed to be a constant value, as Textadept may change it
--- for the editor's own purposes. This flag should be used only in conjunction
--- with a group of [`ui.print()`]() and [`ui._print()`]() function calls.
--- The default value is `false`, and focuses buffers when messages are printed
--- to them.
+-- This is not guaranteed to be a constant value, as Textadept may change it for the editor's
+-- own purposes. This flag should be used only in conjunction with a group of [`ui.print()`]()
+-- and [`ui._print()`]() function calls.
+-- The default value is `false`, and focuses buffers when messages are printed to them.
-- @field SHOW_ALL_TABS (number)
--
module('ui')]]
@@ -43,10 +42,14 @@ ui.SHOW_ALL_TABS = 2 -- ui.tabs options must be greater than 1
ui.silent_print = false
--- Helper function for jumping to another view to print to, or creating a new
--- view to print to (the latter depending on settings).
+-- Helper function for jumping to another view to print to, or creating a new view to print to
+-- (the latter depending on settings).
local function prepare_view()
- if #_VIEWS > 1 then ui.goto_view(1) elseif not ui.tabs then view:split() end
+ if #_VIEWS > 1 then
+ ui.goto_view(1)
+ elseif not ui.tabs then
+ view:split()
+ end
end
-- Helper function for printing messages to buffers.
@@ -54,7 +57,10 @@ end
local function _print(buffer_type, ...)
local buffer
for _, buf in ipairs(_BUFFERS) do
- if buf._type == buffer_type then buffer = buf break end
+ if buf._type == buffer_type then
+ buffer = buf
+ break
+ end
end
if not buffer then
prepare_view()
@@ -80,17 +86,14 @@ local function _print(buffer_type, ...)
end
---
-- Prints the given string messages to the buffer of string type *buffer_type*.
--- Opens a new buffer for printing messages to if necessary. If the message
--- buffer is already open in a view, the message is printed to that view.
--- Otherwise the view is split (unless `ui.tabs` is `true`) and the message
--- buffer is displayed before being printed to.
+-- Opens a new buffer for printing messages to if necessary. If the message buffer is already
+-- open in a view, the message is printed to that view. Otherwise the view is split (unless
+-- `ui.tabs` is `true`) and the message buffer is displayed before being printed to.
-- @param buffer_type String type of message buffer.
-- @param ... Message strings.
-- @usage ui._print(_L['[Message Buffer]'], message)
-- @name _print
-function ui._print(buffer_type, ...)
- _print(assert_type(buffer_type, 'string', 1), ...)
-end
+function ui._print(buffer_type, ...) _print(assert_type(buffer_type, 'string', 1), ...) end
---
-- Prints the given string messages to the message buffer.
@@ -99,8 +102,7 @@ end
-- @name print
function ui.print(...) ui._print(_L['[Message Buffer]'], ...) end
--- Returns 0xBBGGRR colors transformed into "#RRGGBB" for the colorselect
--- dialog.
+-- Returns 0xBBGGRR colors transformed into "#RRGGBB" for the colorselect dialog.
-- @param value Number color to transform.
-- @return string or nil if the transform failed
local function torgb(value)
@@ -110,89 +112,83 @@ local function torgb(value)
end
-- Documentation is in core/.ui.dialogs.luadoc.
-ui.dialogs = setmetatable({}, {__index = function(_, k)
- -- Wrapper for `ui.dialog(k)`, transforming the given table of arguments into
- -- a set of command line arguments and transforming the resulting standard
- -- output into Lua objects.
- -- @param options Table of key-value command line options for gtdialog.
- -- @param f Work function for progressbar dialogs.
- -- @return Lua objects depending on the dialog kind
- return function(options, f)
- if not options.button1 then options.button1 = _L['OK'] end
- if k == 'filteredlist' and not options.width then
- options.width = ui.size[1] - 2 * (CURSES and 1 or 100)
- end
- -- Transform key-value pairs into command line arguments.
- local args = {}
- for option, value in pairs(options) do
- if assert_type(value, 'string/number/table/boolean', option) then
- args[#args + 1] = '--' .. option:gsub('_', '-')
- if type(value) == 'table' then
- for i, val in ipairs(value) do
- local narg = string.format('%s[%d]', option, i)
- assert_type(val, 'string/number', narg)
- if option == 'palette' and type(val) == 'number' then
- value[i] = torgb(val) -- nil return is okay
- elseif option == 'select' and assert_type(val, 'number', narg) then
- value[i] = val - 1 -- convert from 1-based index to 0-based index
+ui.dialogs = setmetatable({}, {
+ __index = function(_, k)
+ -- Wrapper for `ui.dialog(k)`, transforming the given table of arguments into a set of
+ -- command line arguments and transforming the resulting standard output into Lua objects.
+ -- @param options Table of key-value command line options for gtdialog.
+ -- @param f Work function for progressbar dialogs.
+ -- @return Lua objects depending on the dialog kind
+ return function(options, f)
+ if not options.button1 then options.button1 = _L['OK'] end
+ if k == 'filteredlist' and not options.width then
+ options.width = ui.size[1] - 2 * (CURSES and 1 or 100)
+ end
+ -- Transform key-value pairs into command line arguments.
+ local args = {}
+ for option, value in pairs(options) do
+ if assert_type(value, 'string/number/table/boolean', option) then
+ args[#args + 1] = '--' .. option:gsub('_', '-')
+ if type(value) == 'table' then
+ for i, val in ipairs(value) do
+ local narg = string.format('%s[%d]', option, i)
+ assert_type(val, 'string/number', narg)
+ if option == 'palette' and type(val) == 'number' then
+ value[i] = torgb(val) -- nil return is okay
+ elseif option == 'select' and assert_type(val, 'number', narg) then
+ value[i] = val - 1 -- convert from 1-based index to 0-based index
+ end
end
+ elseif option == 'color' and type(value) == 'number' then
+ value = torgb(value)
+ elseif option == 'select' and assert_type(value, 'number', option) then
+ value = value - 1 -- convert from 1-based index to 0-based index
end
- elseif option == 'color' and type(value) == 'number' then
- value = torgb(value)
- elseif option == 'select' and assert_type(value, 'number', option) then
- value = value - 1 -- convert from 1-based index to 0-based index
+ if type(value) ~= 'boolean' then args[#args + 1] = value end
end
- if type(value) ~= 'boolean' then args[#args + 1] = value end
- end
- end
- if k == 'progressbar' then
- args[#args + 1] = assert_type(f, 'function', 2)
- end
- -- Call gtdialog, stripping any trailing newline in the output.
- local result = ui.dialog(
- k:gsub('_', '-'), table.unpack(args)):match('^(.-)\n?$')
- -- Depending on the dialog type, transform the result into Lua objects.
- if k == 'fileselect' or k == 'filesave' then
- if result == '' then return nil end
- if WIN32 and not CURSES then result = result:iconv(_CHARSET, 'UTF-8') end
- if k == 'filesave' or not options.select_multiple then return result end
- local filenames = {}
- for filename in result:gmatch('[^\n]+') do
- filenames[#filenames + 1] = filename
- end
- return filenames
- elseif k == 'filteredlist' or k == 'optionselect' or
- k:find('input') and result:match('^[^\n]+\n?(.*)$'):find('\n') then
- local button, value = result:match('^([^\n]+)\n?(.*)$')
- if not options.string_output then button = tonumber(button) end
- if k == 'optionselect' then
- options.select_multiple = true
- elseif k:find('input') then
- options.string_output, options.select_multiple = true, true
end
- local items, patt = {}, not k:find('input') and '[^\n]+' or '([^\n]*)\n'
- for item in (value .. '\n'):gmatch(patt) do
- items[#items + 1] = options.string_output and item or tonumber(item) + 1
- end
- return button, options.select_multiple and items or items[1]
- elseif k == 'colorselect' then
- if options.string_output then return result ~= '' and result or nil end
- local r, g, b = result:match('^#(%x%x)(%x%x)(%x%x)$')
- local bgr = r and g and b and string.format('0x%s%s%s', b, g, r) or nil
- return tonumber(bgr)
- elseif k == 'fontselect' or k == 'progressbar' then
- return result ~= '' and result or nil
- elseif not options.string_output then
- local i, value = result:match('^(%-?%d+)\n?(.*)$')
- i = tonumber(i)
- if k:find('dropdown') then
- value = i > 0 and tonumber(value) + 1 or nil
+ if k == 'progressbar' then args[#args + 1] = assert_type(f, 'function', 2) end
+ -- Call gtdialog, stripping any trailing newline in the output.
+ local result = ui.dialog(k:gsub('_', '-'), table.unpack(args)):match('^(.-)\n?$')
+ -- Depending on the dialog type, transform the result into Lua objects.
+ if k == 'fileselect' or k == 'filesave' then
+ if result == '' then return nil end
+ if WIN32 and not CURSES then result = result:iconv(_CHARSET, 'UTF-8') end
+ if k == 'filesave' or not options.select_multiple then return result end
+ local filenames = {}
+ for filename in result:gmatch('[^\n]+') do filenames[#filenames + 1] = filename end
+ return filenames
+ elseif k == 'filteredlist' or k == 'optionselect' or
+ (k:find('input') and result:match('^[^\n]+\n?(.*)$'):find('\n')) then
+ local button, value = result:match('^([^\n]+)\n?(.*)$')
+ if not options.string_output then button = tonumber(button) end
+ if k == 'optionselect' then
+ options.select_multiple = true
+ elseif k:find('input') then
+ options.string_output, options.select_multiple = true, true
+ end
+ local items, patt = {}, not k:find('input') and '[^\n]+' or '([^\n]*)\n'
+ for item in (value .. '\n'):gmatch(patt) do
+ items[#items + 1] = options.string_output and item or tonumber(item) + 1
+ end
+ return button, options.select_multiple and items or items[1]
+ elseif k == 'colorselect' then
+ if options.string_output then return result ~= '' and result or nil end
+ local r, g, b = result:match('^#(%x%x)(%x%x)(%x%x)$')
+ local bgr = r and g and b and string.format('0x%s%s%s', b, g, r) or nil
+ return tonumber(bgr)
+ elseif k == 'fontselect' or k == 'progressbar' then
+ return result ~= '' and result or nil
+ elseif not options.string_output then
+ local i, value = result:match('^(%-?%d+)\n?(.*)$')
+ i = tonumber(i)
+ if k:find('dropdown') then value = i > 0 and tonumber(value) + 1 or nil end
+ return i, value
end
- return i, value
+ return result:match('([^\n]+)\n?(.*)$')
end
- return result:match('([^\n]+)\n?(.*)$')
end
-end})
+})
local buffers_zorder = {}
@@ -218,18 +214,15 @@ events.connect(events.VIEW_AFTER_SWITCH, update_zorder)
events.connect(events.BUFFER_DELETED, update_zorder)
-- Saves and restores buffer zorder data during a reset.
-events.connect(
- events.RESET_BEFORE, function(persist) persist.ui_zorder = buffers_zorder end)
-events.connect(
- events.RESET_AFTER, function(persist) buffers_zorder = persist.ui_zorder end)
+events.connect(events.RESET_BEFORE, function(persist) persist.ui_zorder = buffers_zorder end)
+events.connect(events.RESET_AFTER, function(persist) buffers_zorder = persist.ui_zorder end)
---
-- Prompts the user to select a buffer to switch to.
--- Buffers are listed in the order they were opened unless `zorder` is `true`,
--- in which case buffers are listed by their z-order (most recently viewed to
--- least recently viewed).
--- @param zorder Flag that indicates whether or not to list buffers by their
--- z-order. The default value is `false`.
+-- Buffers are listed in the order they were opened unless `zorder` is `true`, in which case
+-- buffers are listed by their z-order (most recently viewed to least recently viewed).
+-- @param zorder Flag that indicates whether or not to list buffers by their z-order. The
+-- default value is `false`.
-- @name switch_buffer
function ui.switch_buffer(zorder)
local buffers = not zorder and _BUFFERS or buffers_zorder
@@ -251,29 +244,26 @@ end
---
-- Switches to the existing view whose buffer's filename is *filename*.
--- If no view was found and *split* is `true`, splits the current view in order
--- to show the requested file. If *split* is `false`, shifts to the next or
--- *preferred_view* view in order to show the requested file. If *sloppy* is
--- `true`, requires only the basename of *filename* to match a buffer's
--- `filename`. If the requested file was not found, it is opened in the desired
--- view.
+-- If no view was found and *split* is `true`, splits the current view in order to show the
+-- requested file. If *split* is `false`, shifts to the next or *preferred_view* view in order
+-- to show the requested file. If *sloppy* is `true`, requires only the basename of *filename*
+-- to match a buffer's `filename`. If the requested file was not found, it is opened in the
+-- desired view.
-- @param filename The filename of the buffer to go to.
--- @param split Optional flag that indicates whether or not to open the buffer
--- in a split view if there is only one view. The default value is `false`.
--- @param preferred_view Optional view to open the desired buffer in if the
--- buffer is not visible in any other view.
--- @param sloppy Optional flag that indicates whether or not to not match
--- *filename* to `buffer.filename` exactly. When `true`, matches *filename* to
--- only the last part of `buffer.filename` This is useful for run and compile
--- commands which output relative filenames and paths instead of full ones and
--- it is likely that the file in question is already open. The default value
--- is `false`.
+-- @param split Optional flag that indicates whether or not to open the buffer in a split view
+-- if there is only one view. The default value is `false`.
+-- @param preferred_view Optional view to open the desired buffer in if the buffer is not
+-- visible in any other view.
+-- @param sloppy Optional flag that indicates whether or not to not match *filename* to
+-- `buffer.filename` exactly. When `true`, matches *filename* to only the last part of
+-- `buffer.filename` This is useful for run and compile commands which output relative filenames
+-- and paths instead of full ones and it is likely that the file in question is already open.
+-- The default value is `false`.
-- @name goto_file
function ui.goto_file(filename, split, preferred_view, sloppy)
assert_type(filename, 'string', 1)
- local patt = string.format( -- TODO: escape filename properly
- '%s%s$', not sloppy and '^' or '',
- not sloppy and filename or filename:match('[^/\\]+$'))
+ local patt = string.format('%s%s$', not sloppy and '^' or '',
+ not sloppy and filename or filename:match('[^/\\]+$')) -- TODO: escape filename properly
if WIN32 then
patt = patt:gsub('%a', function(letter)
return string.format('[%s%s]', letter:upper(), letter:lower())
@@ -285,13 +275,19 @@ function ui.goto_file(filename, split, preferred_view, sloppy)
local other_view = _VIEWS[preferred_view]
for _, view in ipairs(_VIEWS) do
local filename = view.buffer.filename or ''
- if filename:find(patt) then ui.goto_view(view) return end
+ if filename:find(patt) then
+ ui.goto_view(view)
+ return
+ end
if not other_view and view ~= _G.view then other_view = view end
end
if other_view then ui.goto_view(other_view) end
end
for _, buf in ipairs(_BUFFERS) do
- if (buf.filename or ''):find(patt) then view:goto_buffer(buf) return end
+ if (buf.filename or ''):find(patt) then
+ view:goto_buffer(buf)
+ return
+ end
end
io.open_file(filename)
end
@@ -300,18 +296,14 @@ end
events.connect(events.VIEW_NEW, function() events.emit(events.UPDATE_UI, 3) end)
-- Switches between buffers when a tab is clicked.
-events.connect(
- events.TAB_CLICKED, function(index) view:goto_buffer(_BUFFERS[index]) end)
+events.connect(events.TAB_CLICKED, function(index) view:goto_buffer(_BUFFERS[index]) end)
-- Sets the title of the Textadept window to the buffer's filename.
local function set_title()
local filename = buffer.filename or buffer._type or _L['Untitled']
- if buffer.filename then
- filename = select(2, pcall(string.iconv, filename, 'UTF-8', _CHARSET))
- end
+ if buffer.filename then filename = select(2, pcall(string.iconv, filename, 'UTF-8', _CHARSET)) end
local basename = buffer.filename and filename:match('[^/\\]+$') or filename
- ui.title = string.format(
- '%s %s Textadept (%s)', basename, buffer.modify and '*' or '-', filename)
+ ui.title = string.format('%s %s Textadept (%s)', basename, buffer.modify and '*' or '-', filename)
buffer.tab_label = basename .. (buffer.modify and '*' or '')
end
@@ -322,9 +314,8 @@ events.connect(events.SAVE_POINT_LEFT, set_title)
-- Open uri(s).
events.connect(events.URI_DROPPED, function(utf8_uris)
for utf8_path in utf8_uris:gmatch('file://([^\r\n]+)') do
- local path = utf8_path:gsub('%%(%x%x)', function(hex)
- return string.char(tonumber(hex, 16))
- end):iconv(_CHARSET, 'UTF-8')
+ local path = utf8_path:gsub('%%(%x%x)', function(hex) return string.char(tonumber(hex, 16)) end)
+ :iconv(_CHARSET, 'UTF-8')
-- In WIN32, ignore a leading '/', but not '//' (network path).
if WIN32 and not path:match('^//') then path = path:sub(2, -1) end
local mode = lfs.attributes(path, 'mode')
@@ -332,9 +323,8 @@ events.connect(events.URI_DROPPED, function(utf8_uris)
end
ui.goto_view(view) -- work around any view focus synchronization issues
end)
-events.connect(events.APPLEEVENT_ODOC, function(uri)
- return events.emit(events.URI_DROPPED, 'file://' .. uri)
-end)
+events.connect(events.APPLEEVENT_ODOC,
+ function(uri) return events.emit(events.URI_DROPPED, 'file://' .. uri) end)
-- Sets buffer statusbar text.
events.connect(events.UPDATE_UI, function(updated)
@@ -346,11 +336,11 @@ events.connect(events.UPDATE_UI, function(updated)
local col = buffer.column[pos]
local lang = buffer:get_lexer()
local eol = buffer.eol_mode == buffer.EOL_CRLF and _L['CRLF'] or _L['LF']
- local tabs = string.format(
- '%s %d', buffer.use_tabs and _L['Tabs:'] or _L['Spaces:'], buffer.tab_width)
+ local tabs = string.format('%s %d', buffer.use_tabs and _L['Tabs:'] or _L['Spaces:'],
+ buffer.tab_width)
local encoding = buffer.encoding or ''
- ui.buffer_statusbar_text = string.format(
- text, _L['Line:'], line, max, _L['Col:'], col, lang, eol, tabs, encoding)
+ ui.buffer_statusbar_text = string.format(text, _L['Line:'], line, max, _L['Col:'], col, lang, eol,
+ tabs, encoding)
end)
-- Save buffer properties.
@@ -420,8 +410,7 @@ end
events.connect(events.BUFFER_AFTER_SWITCH, restore_view_state)
events.connect(events.VIEW_AFTER_SWITCH, restore_view_state)
-events.connect(
- events.RESET_AFTER, function() ui.statusbar_text = _L['Lua reset'] end)
+events.connect(events.RESET_AFTER, function() ui.statusbar_text = _L['Lua reset'] end)
-- Prompts for confirmation if any buffers are modified.
events.connect(events.QUIT, function()
@@ -435,19 +424,16 @@ events.connect(events.QUIT, function()
end
if #utf8_list == 0 then return end
local button = ui.dialogs.msgbox{
- title = _L['Quit without saving?'],
- text = _L['The following buffers are unsaved:'],
- informative_text = table.concat(utf8_list, '\n'),
- icon = 'gtk-dialog-question', button1 = _L['Cancel'],
- button2 = _L['Quit without saving'],
+ title = _L['Quit without saving?'], text = _L['The following buffers are unsaved:'],
+ informative_text = table.concat(utf8_list, '\n'), icon = 'gtk-dialog-question',
+ button1 = _L['Cancel'], button2 = _L['Quit without saving'],
width = CURSES and ui.size[1] - 2 or nil
}
if button ~= 2 then return true end -- prevent quit
end)
-- Keeps track of, and switches back to the previous buffer after buffer close.
-events.connect(
- events.BUFFER_BEFORE_SWITCH, function() view._prev_buffer = buffer end)
+events.connect(events.BUFFER_BEFORE_SWITCH, function() view._prev_buffer = buffer end)
events.connect(events.BUFFER_DELETED, function()
if _BUFFERS[view._prev_buffer] and buffer ~= view._prev_buffer then
restore_view_state() -- events.BUFFER_AFTER_SWITCH is not emitted in time
@@ -455,15 +441,11 @@ events.connect(events.BUFFER_DELETED, function()
end
end)
--- Properly handle clipboard text between views in curses, enables and disables
--- mouse mode, and focuses and resizes views based on mouse events.
+-- Properly handle clipboard text between views in curses, enables and disables mouse mode,
+-- and focuses and resizes views based on mouse events.
if CURSES then
- events.connect(events.VIEW_BEFORE_SWITCH, function()
- ui._clipboard_text = ui.clipboard_text
- end)
- events.connect(events.VIEW_AFTER_SWITCH, function()
- ui.clipboard_text = ui._clipboard_text
- end)
+ events.connect(events.VIEW_BEFORE_SWITCH, function() ui._clipboard_text = ui.clipboard_text end)
+ events.connect(events.VIEW_AFTER_SWITCH, function() ui.clipboard_text = ui._clipboard_text end)
if not WIN32 then
local function enable_mouse() io.stdout:write("\x1b[?1002h"):flush() end
@@ -485,8 +467,7 @@ if CURSES then
return get_view(view[1], y, x)
elseif vertical and x > size or not vertical and y > size then
-- Zero y or x relative to the other view based on split orientation.
- return get_view(
- view[2], vertical and y or y - size - 1, vertical and x - size - 1 or x)
+ return get_view(view[2], vertical and y or y - size - 1, vertical and x - size - 1 or x)
else
return view -- in-between views; return the split itself
end
@@ -516,8 +497,8 @@ end
events.connect(events.INITIALIZED, function()
local lua_error = (not WIN32 and '^/' or '^%a:[/\\]') .. '.-%.lua:%d+:'
-- Print internal Lua error messages as they are reported.
- -- Attempt to mimic the Lua interpreter's error message format so tools that
- -- look for it can recognize these errors too.
+ -- Attempt to mimic the Lua interpreter's error message format so tools that look for it can
+ -- recognize these errors too.
events.connect(events.ERROR, function(text)
if text and text:find(lua_error) then text = 'lua: ' .. text end
ui.print(text)
@@ -528,8 +509,7 @@ end)
---
-- A table of menus defining a menubar. (Write-only).
--- This is a low-level field. You probably want to use the higher-level
--- `textadept.menu.menubar`.
+-- This is a low-level field. You probably want to use the higher-level `textadept.menu.menubar`.
-- @see textadept.menu.menubar
-- @class table
-- @name menubar
@@ -544,13 +524,11 @@ local size
The functions below are Lua C functions.
---
--- Low-level function for prompting the user with a [gtdialog][] of kind *kind*
--- with the given string and table arguments, returning a formatted string of
--- the dialog's output.
--- You probably want to use the higher-level functions in the [`ui.dialogs`]()
--- module.
--- Table arguments containing strings are allowed and expanded in place. This is
--- useful for filtered list dialogs with many items.
+-- Low-level function for prompting the user with a [gtdialog][] of kind *kind* with the given
+-- string and table arguments, returning a formatted string of the dialog's output.
+-- You probably want to use the higher-level functions in the [`ui.dialogs`]() module.
+-- Table arguments containing strings are allowed and expanded in place. This is useful for
+-- filtered list dialogs with many items.
--
-- [gtdialog]: https://orbitalquark.github.io/gtdialog/manual.html
-- @param kind The kind of gtdialog.
@@ -563,18 +541,16 @@ local dialog
---
-- Returns a split table that contains Textadept's current split view structure.
-- This is primarily used in session saving.
--- @return table of split views. Each split view entry is a table with 4
--- fields: `1`, `2`, `vertical`, and `size`. `1` and `2` have values of either
--- nested split view entries or the views themselves; `vertical` is a flag
--- that indicates if the split is vertical or not; and `size` is the integer
--- position of the split resizer.
+-- @return table of split views. Each split view entry is a table with 4 fields: `1`, `2`,
+-- `vertical`, and `size`. `1` and `2` have values of either nested split view entries or
+-- the views themselves; `vertical` is a flag that indicates if the split is vertical or not;
+-- and `size` is the integer position of the split resizer.
-- @class function
-- @name get_split_table
local get_split_table
---
--- Shifts to view *view* or the view *view* number of views relative to the
--- current one.
+-- Shifts to view *view* or the view *view* number of views relative to the current one.
-- Emits `VIEW_BEFORE_SWITCH` and `VIEW_AFTER_SWITCH` events.
-- @param view A view or relative view number (typically 1 or -1).
-- @see _G._VIEWS
@@ -585,17 +561,15 @@ local get_split_table
local goto_view
---
--- Low-level function for creating a menu from table *menu_table* and returning
--- the userdata.
+-- Low-level function for creating a menu from table *menu_table* and returning the userdata.
-- You probably want to use the higher-level `textadept.menu.menubar`,
-- `textadept.menu.context_menu`, or `textadept.menu.tab_context_menu` tables.
-- Emits a `MENU_CLICKED` event when a menu item is selected.
--- @param menu_table A table defining the menu. It is an ordered list of tables
--- with a string menu item, integer menu ID, and optional GDK keycode and
--- modifier mask. The latter two are used to display key shortcuts in the
--- menu. '_' characters are treated as a menu mnemonics. If the menu item is
--- empty, a menu separator item is created. Submenus are just nested
--- menu-structure tables. Their title text is defined with a `title` key.
+-- @param menu_table A table defining the menu. It is an ordered list of tables with a string
+-- menu item, integer menu ID, and optional GDK keycode and modifier mask. The latter
+-- two are used to display key shortcuts in the menu. '_' characters are treated as a menu
+-- mnemonics. If the menu item is empty, a menu separator item is created. Submenus are just
+-- nested menu-structure tables. Their title text is defined with a `title` key.
-- @usage ui.menu{ {'_New', 1}, {'_Open', 2}, {''}, {'_Quit', 4} }
-- @usage ui.menu{ {'_New', 1, string.byte('n'), 4} } -- 'Ctrl+N'
-- @see events.MENU_CLICKED