From 9dc8ce16a1efc6482db6f1d5456d42958e79a06c Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Wed, 12 Sep 2012 11:24:11 -0400 Subject: Documentation overhaul. Rewrote most of the manual and Lua API to complement each other. Key bindings reference moved from Appendix to modules/textadept/keys.lua LuaDoc. --- core/._M.luadoc | 165 ++++++++++------ core/.buffer.luadoc | 543 +++++++++++++++++++++++++++------------------------- core/.iconv.luadoc | 6 +- core/.view.luadoc | 33 ++-- core/args.lua | 9 +- core/events.lua | 357 ++++++++++++++++++---------------- core/file_io.lua | 39 ++-- core/gui.lua | 72 ++++--- core/iface.lua | 23 ++- core/init.lua | 55 ++++-- core/keys.lua | 149 +++++++------- core/locale.lua | 3 + 12 files changed, 805 insertions(+), 649 deletions(-) (limited to 'core') diff --git a/core/._M.luadoc b/core/._M.luadoc index b73e9000..ea969647 100644 --- a/core/._M.luadoc +++ b/core/._M.luadoc @@ -6,92 +6,149 @@ --- -- A table of loaded modules. -- --- ## Overview +-- ## Module Guidelines -- --- Note that while language-specific modules can only be used by files of that --- language, they persist in Textadept's Lua state. Because of this, it is not --- recommended to set global functions or variables and depend on them, as they --- may be inadvertantly overwritten. Keep them inside the module. +-- At the very least, modules consist of a single directory with an `init.lua` +-- script. However, the script can load additional Lua files present in the +-- directory. (For an example, see `modules/textadept/init.lua`.) -- --- ## Structure +-- Once modules are loaded, regardless of whether they are generic or +-- language-specific, they persist in Textadept's Lua State; they are never +-- unloaded. Therefore, modules should not set global functions or variables in +-- order to avoid polluting the global environment. All functions and variables +-- should be contained within the module. -- --- Each module should have an `init.lua` that `require`s all submodules it --- needs. For an example, see `modules/textadept/init.lua`. +-- ### Language-Specific -- --- ## Language-Specific Modules +-- To fully take advantage of Textadept's features, language-specific modules +-- should have at a minimum: a block comment string, run and/or compile +-- commands, a buffer property setter function, and if possible, an Adeptsense. +-- Optional features are extra snippets and commands and a context menu. -- --- The following is a list of recommended features for Language-Specific --- modules. They are all entirely optional. +-- #### Block Comment -- --- ### Snippets +-- The `Ctrl+/` (`⌘/` on Mac OSX | `M-/` in ncurses) key binding toggles code +-- comments. In order for this to work for your language, the +-- [`_M.textadept.editing.comment_string`][] table must have a key with the +-- language's lexer name assigned to a comment prefix string. For Lua, it would +-- look like -- --- [Snippets][] for common code constructs. +-- _M.textadept.editing.comment_string.lua = '--' -- --- [Snippets]: _M.textadept.snippets.html +-- [`_M.textadept.editing.comment_string`]: _M.textadept.editing.html#comment_string -- --- ### Commands +-- #### Compile and Run -- --- #### Run +-- The `Ctrl+Shift+R` and `Ctrl+R` (`⌘⇧R` and `⌘R` on Mac OSX | `M-^R` and `^R` +-- in ncurses) key bindings compile and run code, respectively. In order for +-- these to work for your language, the [`_M.textadept.run.compile_command`][] +-- and [`_M.textadept.run.run_command`][] tables must have keys with the +-- language's lexer name assigned to compile and run shell commands, +-- respectively. Commands may contain [macros][]. For Lua, it would look like -- --- If the code can be run by an interpreter or other executable, create a [run --- command][] for it as well as an [error format][] for the ability to jump to --- the position in a file where the error occured. +-- _M.textadept.run.compile_command.lua = 'luac %(filename)' +-- _M.textadept.run.run_command = 'lua %(filename)' -- --- For example: +-- The module should also define error details in +-- [`_M.textadept.run.error_detail`][] so double-clicking on compile or runtime +-- errors will jump to the error's location. The format for Lua errors looks +-- like -- --- _M.textadept.run.run_command.lua = 'lua %(filename)' +-- _M.textadept.run.error_detail.lua = { +-- pattern = '^lua: (.-):(%d+): (.+)$', +-- filename = 1, line = 2, message = 3 +-- } -- --- [run command]: _M.textadept.run.html#run_command --- [error format]: _M.textadept.run.html#error_detail +-- [`_M.textadept.run.compile_command`]: _M.textadept.run.html#compile_command +-- [`_M.textadept.run.run_command`]: _M.textadept.run.html#run_command +-- [macros]: _M.textadept.run.html#execute +-- [`_M.textadept.run.error_detail`]: _M.textadept.run.html#error_detail -- --- #### Compile +-- #### Buffer Properties -- --- If the code can be compiled by an executable, create a [compile command][] --- for it. +-- By default, Textadept uses 2 spaces as indentation. If your language has +-- different indentation guidelines, change them in a `set_buffer_properties()` +-- function. Using tabs of width 8 would look like -- --- For example: +-- function M.set_buffer_properties() +-- buffer.tab_width = 8 +-- buffer.use_tabs = true +-- end -- --- _M.textadept.run.compile_command.lua = 'luac %(filename)' +-- This function is called automatically to set the properties for the +-- language's source files. -- --- [compile command]: _M.textadept.run.html#compile_command +-- #### Adeptsense -- --- #### Block Comment +-- The `Ctrl+Space` and `Ctrl+H` (`⌥⎋` and `^H` on Mac OSX | `^Space` and `M-H` +-- or `M-S-H` in ncurses) key bindings autocomplete symbols and show API +-- documentation, respectively, when editing code. In order for these to work +-- for your language, you must create an [Adeptsense][]. -- --- Create a [comment prefix][] for it so code can be easily commented and --- uncommented. +-- [Adeptsense]: _M.textadept.adeptsense.html -- --- [comment prefix]: _M.textadept.editing.html#comment_string +-- #### Snippets -- --- For example: +-- [Snippets][] for common language constructs can be useful. Some snippets for +-- common Lua control structures look like -- --- _M.textadept.editing.comment_string.lua = '--' --- --- [comment prefix]: _M.textadept.editing.html#comment_string +-- snippets.lua = { +-- f = "function %1(name)(%2(args))\n\t%0\nend", +-- ['for'] = "for i = %1(1), %2(10)%3(, -1) do\n\t%0\nend", +-- fori = "for %1(i), %2(val) in ipairs(%3(table)) do\n\t%0\nend", +-- forp = "for %1(k), %2(v) in pairs(%3(table)) do\n\t%0\nend", +-- } -- --- ### Buffer Properties +-- [Snippets]: _M.textadept.snippets.html -- --- Add a `set_buffer_properties` function with default buffer properties for --- code like tab and indentation settings. +-- #### Commands -- --- For example: +-- Additional editing features for the language can be useful. For example, the +-- [Lua][] module has a feature to autocomplete the `end` keyword in a control +-- structure and the [C/C++][] module has a feature to add a `;` to the end of +-- the current line and insert a new line. Both are bound to the `Shift+Enter` +-- (`⇧↩` on Mac OSX | `S-Enter` in ncurses) key for easy access. -- --- function set_buffer_properties() --- local buffer = buffer --- buffer.use_tabs = false --- buffer.tab_width = 2 --- buffer.indent = 2 +-- function M.try_to_autocomplete_end() +-- ... -- end -- --- ### Context Menu +-- keys.lua = { +-- ['s\n'] = M.try_to_autocomplete_end +-- } -- --- Language-specific context menus, accessible by right-clicking inside the --- view, can be defined as: +-- --- -- --- context_menu = { --- { 'label1', action1 }, --- { 'label2', action2 }, --- ... +-- keys.cpp = { +-- ['s\n'] = function() +-- buffer:line_end() +-- buffer:add_text(';') +-- buffer:new_line() +-- end +-- } +-- +-- [Lua]: _M.lua.html +-- [C/C++]: _M.cpp.html +-- +-- #### Context Menu +-- +-- Language-specific [context menus][], accessible by right-clicking inside the +-- view, can be useful for accessing module features without using key bindings. +-- For Lua this may look like +-- +-- M.context_menu = { +-- { _L['_Undo'], buffer.undo }, +-- { _L['_Redo'], buffer.redo }, +-- { '' }, +-- { _L['Cu_t'], buffer.cut }, +-- { _L['_Copy'], buffer.copy }, +-- { _L['_Paste'], buffer.paste }, +-- { _L['_Delete'], buffer.clear }, +-- { '' }, +-- { _L['Select _All'], buffer.select_all }, +-- { '' }, +-- { 'Autocomplete "end"', M.try_to_autocomplete_end } -- } -- --- See `modules/textadept/menu.lua` for examples on how to define menus. +-- [context menus]: _M.textadept.menu.html#set_contextmenu module('_M')]] diff --git a/core/.buffer.luadoc b/core/.buffer.luadoc index 5686df1d..c224cac5 100644 --- a/core/.buffer.luadoc +++ b/core/.buffer.luadoc @@ -3,8 +3,12 @@ -- global buffer table. --- --- The current buffer in the current view. --- It also represents the structure of any buffer table in `_G._BUFFER`. +-- A Textadept buffer object. +-- Be careful when storing references to a buffer object because if you attempt +-- call a buffer function with a non-global buffer, you will get an error. See +-- [`check_global()`](#check_global) for more information. +-- +-- [buffer]: _G.html#buffer -- @field additional_caret_fore (number) -- The foreground color of additional carets in `0xBBGGRR` format. -- @field additional_carets_blink (bool) @@ -893,7 +897,7 @@ module('buffer') -- @param buffer The global buffer. -- @param caret The caret. -- @param anchor The anchor. -function buffer.add_selection(buffer, caret, anchor) end +function add_selection(buffer, caret, anchor) end --- -- Add text to the document at current position. @@ -901,19 +905,19 @@ function buffer.add_selection(buffer, caret, anchor) end -- scrolled into view. -- @param buffer The global buffer. -- @param text The text to add. -function buffer.add_text(buffer, text) end +function add_text(buffer, text) end --- -- Enlarge the document to a particular size of text bytes. -- The document will not be made smaller than its current contents. -- @param buffer The global buffer. -- @param bytes -function buffer.allocate(buffer, bytes) end +function allocate(buffer, bytes) end --- -- Clear the annotations from all lines. -- @param buffer The global buffer. -function buffer.annotation_clear_all(buffer) end +function annotation_clear_all(buffer) end --- -- Append a string to the end of the document without changing the selection. @@ -921,33 +925,33 @@ function buffer.annotation_clear_all(buffer) end -- view. -- @param buffer The global buffer. -- @param text The text. -function buffer.append_text(buffer, text) end +function append_text(buffer, text) end --- -- Is there an auto-completion list visible? -- @param buffer -- @return bool -function buffer.auto_c_active(buffer) end +function auto_c_active(buffer) end --- -- Remove the auto-completion list from the screen. -- A set of characters that will cancel autocompletion can be specified with -- `buffer:auto_c_stops()`. -- @param buffer The global buffer. -function buffer.auto_c_cancel(buffer) end +function auto_c_cancel(buffer) end --- -- User has selected an item so remove the list and insert the selection. -- This has the same effect as the tab key. -- @param buffer The global buffer. -function buffer.auto_c_complete(buffer) end +function auto_c_complete(buffer) end --- -- Retrieve the position of the caret when the auto-completion list was -- displayed. -- @param buffer The global buffer. -- @return number -function buffer.auto_c_pos_start(buffer) end +function auto_c_pos_start(buffer) end --- -- Select the item in the auto-completion list that starts with a string. @@ -955,7 +959,7 @@ function buffer.auto_c_pos_start(buffer) end -- `buffer.auto_c_ignore_case`. -- @param buffer The global buffer. -- @param string -function buffer.auto_c_select(buffer, string) end +function auto_c_select(buffer, string) end --- -- Display an auto-completion list. @@ -963,30 +967,30 @@ function buffer.auto_c_select(buffer, string) end -- the context. -- @param item_list List of words separated by separator characters (initially -- spaces). The list of words should be in sorted order. -function buffer.auto_c_show(buffer, len_entered, item_list) end +function auto_c_show(buffer, len_entered, item_list) end --- -- Define a set of characters that when typed cancel the auto-completion list. -- @param buffer The global buffer. -- @param chars String list of characters. This list is empty by default. -function buffer.auto_c_stops(buffer, chars) end +function auto_c_stops(buffer, chars) end --- -- Dedent the selected lines. -- @param buffer The global buffer. -function buffer.back_tab(buffer) end +function back_tab(buffer) end --- -- Start a sequence of actions that is undone and redone as a unit. -- May be nested. -- @param buffer The global buffer. -function buffer.begin_undo_action(buffer) end +function begin_undo_action(buffer) end --- -- Highlight the character at a position indicating there is no matching brace. -- @param buffer The global buffer. -- @param pos The position or -1 to remove the highlight. -function buffer.brace_bad_light(buffer, pos) end +function brace_bad_light(buffer, pos) end --- -- Use specified indicator to highlight non matching brace instead of changing @@ -994,7 +998,7 @@ function buffer.brace_bad_light(buffer, pos) end -- @param buffer The global buffer. -- @param use_indicator Use an indicator. -- @param indic_num The indicator number. -function buffer.brace_bad_light_indicator(buffer, use_indicator, indic_num) end +function brace_bad_light_indicator(buffer, use_indicator, indic_num) end --- -- Highlight the characters at two positions. @@ -1004,7 +1008,7 @@ function buffer.brace_bad_light_indicator(buffer, use_indicator, indic_num) end -- @param buffer The global buffer. -- @param pos1 The first position. -- @param pos2 The second position. -function buffer.brace_highlight(buffer, pos1, pos2) end +function brace_highlight(buffer, pos1, pos2) end --- -- Use specified indicator to highlight matching braces instead of changing @@ -1012,7 +1016,7 @@ function buffer.brace_highlight(buffer, pos1, pos2) end -- @param buffer The global buffer. -- @param use_indicator Use an indicator. -- @param indic_num The indicator number. -function buffer.brace_highlight_indicator(buffer, use_indicator, indic_num) end +function brace_highlight_indicator(buffer, use_indicator, indic_num) end --- -- Find the position of a matching brace or `-1` if no match. @@ -1024,33 +1028,33 @@ function buffer.brace_highlight_indicator(buffer, use_indicator, indic_num) end -- @param buffer The global buffer. -- @param pos The position. -- @return number. -function buffer.brace_match(buffer, pos) end +function brace_match(buffer, pos) end --- -- Is there an active call tip? -- @param buffer The global buffer. -- @return bool -function buffer.call_tip_active(buffer) end +function call_tip_active(buffer) end --- -- Remove the call tip from the screen. -- Call tips are also removed if any keyboard commands that are not compatible -- with editing the argument list of a function are used. -- @param buffer The global buffer. -function buffer.call_tip_cancel(buffer) end +function call_tip_cancel(buffer) end --- -- Retrieve the position where the caret was before displaying the call tip. -- @param buffer The global buffer. -- @return number -function buffer.call_tip_pos_start(buffer) end +function call_tip_pos_start(buffer) end --- -- Highlights a segment of a call tip. -- @param buffer The global buffer. -- @param start_pos The start position. -- @param end_pos The end position. -function buffer.call_tip_set_hlt(buffer, start_pos, end_pos) end +function call_tip_set_hlt(buffer, start_pos, end_pos) end --- -- Show a call tip containing a definition near position pos. @@ -1061,30 +1065,30 @@ function buffer.call_tip_set_hlt(buffer, start_pos, end_pos) end -- @param buffer The global buffer. -- @param pos The position. -- @param text The text. -function buffer.call_tip_show(buffer, pos, text) end +function call_tip_show(buffer, pos, text) end --- -- Will a paste succeed? -- @param buffer The global buffer. -- @return bool -function buffer.can_paste(buffer) end +function can_paste(buffer) end --- -- Are there any redoable actions in the undo history? -- @param buffer The global buffer. -- @return bool -function buffer.can_redo(buffer) end +function can_redo(buffer) end --- -- Are there any undoable actions in the undo history? -- @param buffer The global buffer. -- @return bool -function buffer.can_undo(buffer) end +function can_undo(buffer) end --- -- Cancel any modes such as call tip or auto-completion list display. -- @param buffer The global buffer. -function buffer.cancel(buffer) end +function cancel(buffer) end --- -- Indicate that the internal state of a lexer has changed over a range and @@ -1092,23 +1096,23 @@ function buffer.cancel(buffer) end -- @param buffer The global buffer. -- @param start_pos The start position. -- @param end_pos The end position. -function buffer.change_lexer_state(buffer, start_pos, end_pos) end +function change_lexer_state(buffer, start_pos, end_pos) end --- -- Move caret left one character. -- @param buffer The global buffer. -function buffer.char_left(buffer) end +function char_left(buffer) end --- -- Move caret left one character extending selection to new caret position. -- @param buffer The global buffer. -function buffer.char_left_extend(buffer) end +function char_left_extend(buffer) end --- -- Move caret left one character, extending rectangular selection to new caret -- position. -- @param buffer The global buffer. -function buffer.char_left_rect_extend(buffer) end +function char_left_rect_extend(buffer) end --- -- Find the position of a character from a point within the window. @@ -1116,7 +1120,7 @@ function buffer.char_left_rect_extend(buffer) end -- @param x -- @param y -- @return number -function buffer.char_position_from_point(buffer, x, y) end +function char_position_from_point(buffer, x, y) end --- -- Find the position of a character from a point within the window. @@ -1125,23 +1129,23 @@ function buffer.char_position_from_point(buffer, x, y) end -- @param x -- @param y -- @return number -function buffer.char_position_from_point_close(buffer, x, y) end +function char_position_from_point_close(buffer, x, y) end --- -- Move caret right one character. -- @param buffer The global buffer. -function buffer.char_right(buffer) end +function char_right(buffer) end --- -- Move caret right one character extending selection to new caret position. -- @param buffer The global buffer. -function buffer.char_right_extend(buffer) end +function char_right_extend(buffer) end --- -- Move caret right one character, extending rectangular selection to new caret -- position. -- @param buffer The global buffer. -function buffer.char_right_rect_extend(buffer) end +function char_right_rect_extend(buffer) end --- -- Set the last x chosen value to be the caret x position. @@ -1150,37 +1154,37 @@ function buffer.char_right_rect_extend(buffer) end -- such as by using the up and down keys. This function sets the current x -- position of the caret as the remembered value. -- @param buffer The global buffer. -function buffer.choose_caret_x(buffer) end +function choose_caret_x(buffer) end --- -- Clear the selection. -- @param buffer The global buffer. -function buffer.clear(buffer) end +function clear(buffer) end --- -- Delete all text in the document. -- @param buffer The global buffer. -function buffer.clear_all(buffer) end +function clear_all(buffer) end --- -- Drop all key mappings. -- @param buffer The global buffer. -function buffer.clear_all_cmd_keys(buffer) end +function clear_all_cmd_keys(buffer) end --- -- Set all style bytes to `0`, remove all folding information. -- @param buffer The global buffer. -function buffer.clear_document_style(buffer) end +function clear_document_style(buffer) end --- -- Clear all the registered XPM images. -- @param buffer The global buffer. -function buffer.clear_registered_images(buffer) end +function clear_registered_images(buffer) end --- -- Clear selections to a single empty stream selection. -- @param buffer The global buffer. -function buffer.clear_selections(buffer) end +function clear_selections(buffer) end --- -- Colorise a segment of the document using the current lexing language. @@ -1188,7 +1192,7 @@ function buffer.clear_selections(buffer) end -- @param start_pos The start position. -- @param end_pos The end position or `-1` to style from `start_pos` to the end -- of the document. -function buffer.colourise(buffer, start_pos, end_pos) end +function colourise(buffer, start_pos, end_pos) end --- -- Find the next line at or after line_start that is a contracted fold header @@ -1197,7 +1201,7 @@ function buffer.colourise(buffer, start_pos, end_pos) end -- @param buffer The global buffer. -- @param line_start The start line number. -- @return number -function buffer.contracted_fold_next(buffer, line_start) end +function contracted_fold_next(buffer, line_start) end --- -- Converts all line endings in the document to one mode. @@ -1206,17 +1210,17 @@ function buffer.contracted_fold_next(buffer, line_start) end -- `_SCINTILLA.constants.SC_EOL_CRLF` (0), -- `_SCINTILLA.constants.SC_EOL_CR (1)`, or -- `_SCINTILLA.constants.SC_EOL_LF (2)`. -function buffer.convert_eo_ls(buffer, mode) end +function convert_eo_ls(buffer, mode) end --- -- Copy the selection to the clipboard. -- @param buffer The buffer -function buffer.copy(buffer) end +function copy(buffer) end --- -- Copy the selection, if selection empty copy the line with the caret. -- @param buffer The global buffer. -function buffer.copy_allow_line(buffer) end +function copy_allow_line(buffer) end --- -- Copy a range of text to the clipboard. Positions are clipped into the @@ -1224,107 +1228,107 @@ function buffer.copy_allow_line(buffer) end -- @param buffer The global buffer. -- @param start_pos The start position. -- @param end_pos The end position. -function buffer.copy_range(buffer, start_pos, end_pos) end +function copy_range(buffer, start_pos, end_pos) end --- -- Copy argument text to the clipboard. -- @param buffer The global buffer. -- @param text The text. -function buffer.copy_text(buffer, text) end +function copy_text(buffer, text) end --- -- Count characters between two positions. -- @param start_pos -- @param end_pos -- @return number -function buffer.count_characters(buffer, start_pos, end_pos) end +function count_characters(buffer, start_pos, end_pos) end --- -- Cut the selection to the clipboard. -- @param buffer The global buffer. -function buffer.cut(buffer) end +function cut(buffer) end --- -- Delete back from the current position to the start of the line. -- @param buffer The global buffer. -function buffer.del_line_left(buffer) end +function del_line_left(buffer) end --- -- Delete forwards from the current position to the end of the line. -- @param buffer The global buffer. -function buffer.del_line_right(buffer) end +function del_line_right(buffer) end --- -- Delete the word to the left of the caret. -- @param buffer The global buffer. -function buffer.del_word_left(buffer) end +function del_word_left(buffer) end --- -- Delete the word to the right of the caret. -- @param buffer The global buffer. -function buffer.del_word_right(buffer) end +function del_word_right(buffer) end --- -- Delete the word to the right of the caret, but not the trailing non-word -- characters. -- @param buffer The global buffer. -function buffer.del_word_right_end(buffer) end +function del_word_right_end(buffer) end --- -- Delete the selection or if no selection, the character before the caret. -- @param buffer The global buffer. -function buffer.delete_back(buffer) end +function delete_back(buffer) end --- -- Delete the selection or if no selection, the character before the caret. -- Will not delete the character before at the start of a line. -function buffer.delete_back_not_line(buffer) end +function delete_back_not_line(buffer) end --- -- Delete a range of text in the document. -- @param pos The start position of the range to delete. -- @param length The length of the range to delete. -function buffer.delete_range(buffer, pos, length) end +function delete_range(buffer, pos, length) end --- -- Find the document line of a display line taking hidden lines into account. -- @param buffer The global buffer. -- @return number -function buffer.doc_line_from_visible(buffer) end +function doc_line_from_visible(buffer) end --- -- Move caret to last position in document. -- @param buffer The global buffer. -function buffer.document_end(buffer) end +function document_end(buffer) end --- -- Move caret to last position in document extending selection to new caret -- position. -- @param buffer The global buffer. -function buffer.document_end_extend(buffer) end +function document_end_extend(buffer) end --- -- Move caret to first position in document. -- @param buffer The global buffer. -function buffer.document_start(buffer) end +function document_start(buffer) end --- -- Move caret to first position in document extending selection to new caret -- position. -- @param buffer The global buffer. -function buffer.document_start_extend(buffer) end +function document_start_extend(buffer) end --- -- Switch from insert to overtype mode or the reverse. -- @param buffer The global buffer. -function buffer.edit_toggle_overtype(buffer) end +function edit_toggle_overtype(buffer) end --- -- Delete the undo history. -- It also sets the save point to the start of the undo buffer, so the document -- will appear to be unmodified. -- @param buffer The global buffer. -function buffer.empty_undo_buffer(buffer) end +function empty_undo_buffer(buffer) end --- -- Translates a UTF8 string into the document encoding. @@ -1332,25 +1336,25 @@ function buffer.empty_undo_buffer(buffer) end -- @param buffer The global buffer. -- @param string The string. -- @return number -function buffer.encoded_from_utf8(buffer, string) end +function encoded_from_utf8(buffer, string) end --- -- End a sequence of actions that is undone and redone as a unit. -- @param buffer The global buffer. -function buffer.end_undo_action(buffer) end +function end_undo_action(buffer) end --- -- Ensure a particular line is visible by expanding any header line hiding it. -- @param buffer The global buffer. -- @param line The line number. -function buffer.ensure_visible(buffer, line) end +function ensure_visible(buffer, line) end --- -- Ensure a particular line is visible by expanding any header line hiding it. -- Use the currently set visibility policy to determine which range to display. -- @param buffer The global buffer. -- @param line The line number. -function buffer.ensure_visible_enforce_policy(buffer, line) end +function ensure_visible_enforce_policy(buffer, line) end --- -- Find the position of a column on a line taking into account tabs and @@ -1359,38 +1363,38 @@ function buffer.ensure_visible_enforce_policy(buffer, line) end -- @param buffer The global buffer. -- @param line The line number. -- @param column The column number. -function buffer.find_column(buffer, line, column) end +function find_column(buffer, line, column) end --- -- Insert a Form Feed character. -- @param buffer The global buffer. -function buffer.form_feed(buffer) end +function form_feed(buffer) end --- -- Retrieve the text of the line containing the caret. -- Also returns the index of the caret on the line. -- @param buffer The global buffer. -- @return string, number -function buffer.get_cur_line(buffer) end +function get_cur_line(buffer) end --- -- Get the back color for active hotspots in 0xBBGGRR format. -- @param buffer The global buffer. -- @return number -function buffer.get_hotspot_active_back(buffer) end +function get_hotspot_active_back(buffer) end --- -- Get the fore color for active hotspots. -- @param buffer The global buffer. -- @return number -function buffer.get_hotspot_active_fore(buffer) end +function get_hotspot_active_fore(buffer) end --- -- Find the last child line of a header line. -- @param buffer The global buffer. -- @param header_line The line number of a header line. -- @param level The level or `-1` for the level of header_line. -function buffer.get_last_child(buffer, header_line, level) end +function get_last_child(buffer, header_line, level) end --- -- Retrieve the contents of a line. @@ -1398,21 +1402,21 @@ function buffer.get_last_child(buffer, header_line, level) end -- @param buffer The global buffer. -- @param line The line number. -- @return string, number -function buffer.get_line(buffer, line) end +function get_line(buffer, line) end --- -- Retrieve the position of the end of the selection at the given line (`-1` if -- no selection on this line). -- @param buffer The global buffer. -- @param line The line number. -function buffer.get_line_sel_end_position(buffer, line) end +function get_line_sel_end_position(buffer, line) end --- -- Retrieve the position of the start of the selection at the given line (`-1` -- if no selection on this line). -- @param buffer The global buffer. -- @param line The line number. -function buffer.get_line_sel_start_position(buffer, line) end +function get_line_sel_start_position(buffer, line) end --- -- Return a read-only pointer to a range of characters in the document. @@ -1421,38 +1425,38 @@ function buffer.get_line_sel_start_position(buffer, line) end -- The gap is not moved unless it is within the requested range so this call can -- be faster than `SCI_GETCHARACTERPOINTER`. This can be used by application -- code that is able to act on blocks of text or ranges of lines. -function buffer.get_range_pointer(buffer, position, range_length) end +function get_range_pointer(buffer, position, range_length) end --- -- Retrieve the selected text. -- Also returns the length of the text. -- @param buffer The global buffer. -- @return string, number -function buffer.get_sel_text(buffer) end +function get_sel_text(buffer) end --- -- Retrieve all the text in the document. -- Also returns number of characters retrieved. -- @param buffer The global buffer. -function buffer.get_text(buffer) end +function get_text(buffer) end --- -- Set caret to start of a line and ensure it is visible. -- @param buffer The global buffer. -- @param line The line number. -function buffer.goto_line(buffer, line) end +function goto_line(buffer, line) end --- -- Set caret to a position and ensure it is visible. -- The anchor position is set the same as the current position. -- @param buffer The global buffer. -- @param pos The position. -function buffer.goto_pos(buffer, pos) end +function goto_pos(buffer, pos) end --- -- Set the focus to this view. -- @param buffer The global buffer. -function buffer.grab_focus(buffer) end +function grab_focus(buffer) end --- -- Make a range of lines invisible. @@ -1461,52 +1465,52 @@ function buffer.grab_focus(buffer) end -- @param buffer The global buffer. -- @param start_line The start line. -- @param end_line The end line. -function buffer.hide_lines(buffer, start_line, end_line) end +function hide_lines(buffer, start_line, end_line) end --- -- Draw the selection in normal style or with selection highlighted. -- @param buffer The global buffer. -- @param normal Draw normal selection. -function buffer.hide_selection(buffer, normal) end +function hide_selection(buffer, normal) end --- -- Move caret to first position on line. -- @param buffer The global buffer. -function buffer.home(buffer) end +function home(buffer) end --- -- Move caret to first position on display line. -- @param buffer The global buffer. -function buffer.home_display(buffer) end +function home_display(buffer) end --- -- Move caret to first position on display line extending selection to new caret -- position. -- @param buffer The global buffer. -function buffer.home_display_extend(buffer) end +function home_display_extend(buffer) end --- -- Move caret to first position on line extending selection to new caret -- position. -- @param buffer The global buffer. -function buffer.home_extend(buffer) end +function home_extend(buffer) end --- -- Move caret to first position on line, extending rectangular selection to new -- caret position. -- @param buffer The global buffer. -function buffer.home_rect_extend(buffer) end +function home_rect_extend(buffer) end --- -- Move caret to the start of the display line when word-wrap is enabled. -- If already there, go to the start of the document line. -- @param buffer The global buffer. -function buffer.home_wrap(buffer) end +function home_wrap(buffer) end --- -- Like `buffer:home_wrap()` but extending selection to new caret position. -- @param buffer The global buffer. -function buffer.home_wrap_extend(buffer) end +function home_wrap_extend(buffer) end --- -- Retrieve a bitmap value representing which indicators are non-zero at a @@ -1515,21 +1519,21 @@ function buffer.home_wrap_extend(buffer) end -- @param buffer The global buffer. -- @param pos The position. -- @return number -function buffer.indicator_all_on_for(buffer, pos) end +function indicator_all_on_for(buffer, pos) end --- -- Turn a indicator off over a range. -- @param buffer The global buffer. -- @param pos The start position. -- @param clear_length The length. -function buffer.indicator_clear_range(buffer, pos, clear_length) end +function indicator_clear_range(buffer, pos, clear_length) end --- -- Find the position where a particular indicator ends. -- @param buffer The global buffer. -- @param indicator An indicator number in the range of `0` to `31`. -- @param pos The position of the indicator. -function buffer.indicator_end(buffer, indicator, pos) end +function indicator_end(buffer, indicator, pos) end --- -- Turn a indicator on over a range. @@ -1537,14 +1541,14 @@ function buffer.indicator_end(buffer, indicator, pos) end -- @param buffer The global buffer. -- @param pos the start position. -- @param fill_length The length. -function buffer.indicator_fill_range(buffer, pos, fill_length) end +function indicator_fill_range(buffer, pos, fill_length) end --- -- Find the position where a particular indicator starts. -- @param buffer The global buffer. -- @param indicator An indicator number in the range of `0` to `31`. -- @param pos The position of the indicator. -function buffer.indicator_start(buffer, indicator, pos) end +function indicator_start(buffer, indicator, pos) end --- -- Retrieve the value of a particular indicator at a position. @@ -1553,7 +1557,7 @@ function buffer.indicator_start(buffer, indicator, pos) end -- @param indicator The indicator number in the range of `0` to `31`. -- @param pos The position. -- @return number -function buffer.indicator_value_at(buffer, indicator, pos) end +function indicator_value_at(buffer, indicator, pos) end --- -- Insert string at a position. @@ -1562,89 +1566,89 @@ function buffer.indicator_value_at(buffer, indicator, pos) end -- @param buffer The global buffer. -- @param pos The position to insert text at or `-1` for the current position. -- @param text The text to insert. -function buffer.insert_text(buffer, pos, text) end +function insert_text(buffer, pos, text) end --- -- Copy the line containing the caret. -- @param buffer The global buffer. -function buffer.line_copy(buffer) end +function line_copy(buffer) end --- -- Cut the line containing the caret. -- @param buffer The global buffer. -function buffer.line_cut(buffer) end +function line_cut(buffer) end --- -- Delete the line containing the caret. -- @param buffer The global buffer. -function buffer.line_delete(buffer) end +function line_delete(buffer) end --- -- Move caret down one line. -- @param buffer The global buffer. -function buffer.line_down(buffer) end +function line_down(buffer) end --- -- Move caret down one line extending selection to new caret position. -- @param buffer The global buffer. -function buffer.line_down_extend(buffer) end +function line_down_extend(buffer) end --- -- Move caret down one line, extending rectangular selection to new caret -- position. -- @param buffer The global buffer. -function buffer.line_down_rect_extend(buffer) end +function line_down_rect_extend(buffer) end --- -- Duplicate the current line. -- @param buffer The global buffer. -function buffer.line_duplicate(buffer) end +function line_duplicate(buffer) end --- -- Move caret to last position on line. -- @param buffer The global buffer. -function buffer.line_end(buffer) end +function line_end(buffer) end --- -- Move caret to last position on display line. -- @param buffer The global buffer. -function buffer.line_end_display(buffer) end +function line_end_display(buffer) end --- -- Move caret to last position on display line extending selection to new caret -- position. -- @param buffer The global buffer. -function buffer.line_end_display_extend(buffer) end +function line_end_display_extend(buffer) end --- -- Move caret to last position on line extending selection to new caret -- position. -- @param buffer The global buffer. -function buffer.line_end_extend(buffer) end +function line_end_extend(buffer) end --- -- Move caret to last position on line, extending rectangular selection to new -- caret position. -- @param buffer The global buffer. -function buffer.line_end_rect_extend(buffer) end +function line_end_rect_extend(buffer) end --- -- Move caret to the end of the display line when word-wrap is enabled. -- If already there, go to the end of the document line. -- @param buffer The global buffer. -function buffer.line_end_wrap(buffer) end +function line_end_wrap(buffer) end --- -- Like `buffer:line_end_wrap()` but extending selection to new caret position. -- @param buffer The global buffer. -function buffer.line_end_wrap_extend(buffer) end +function line_end_wrap_extend(buffer) end --- -- Retrieve the line containing a position. -- @param buffer The global buffer. -- @param pos The position. -- @return number -function buffer.line_from_position(buffer, pos) end +function line_from_position(buffer, pos) end --- -- Returns how many characters are on a line, including end of line characters. @@ -1653,68 +1657,68 @@ function buffer.line_from_position(buffer, pos) end -- @param buffer The global buffer. -- @param line The line number. -- @return number -function buffer.line_length(buffer, line) end +function line_length(buffer, line) end --- -- Scroll horizontally and vertically. -- @param buffer The global buffer. -- @param columns The number of columns to scroll horizontally. -- @param lines The number of lines to scroll vertically. -function buffer.line_scroll(buffer, columns, lines) end +function line_scroll(buffer, columns, lines) end --- -- Scroll the document down, keeping the caret visible. -- @param buffer The global buffer. -function buffer.line_scroll_down(buffer) end +function line_scroll_down(buffer) end --- -- Scroll the document up, keeping the caret visible. -- @param buffer The global buffer. -function buffer.line_scroll_up(buffer) end +function line_scroll_up(buffer) end --- -- Switch the current line with the previous. -- @param buffer The global buffer. -function buffer.line_transpose(buffer) end +function line_transpose(buffer) end --- -- Move caret up one line. -- @param buffer The global buffer. -function buffer.line_up(buffer) end +function line_up(buffer) end --- -- Move caret up one line extending selection to new caret position. -- @param buffer The global buffer. -function buffer.line_up_extend(buffer) end +function line_up_extend(buffer) end --- -- Move caret up one line, extending rectangular selection to new caret -- position. -- @param buffer The global buffer. -function buffer.line_up_rect_extend(buffer) end +function line_up_rect_extend(buffer) end --- -- Join the lines in the target. -- Where this would lead to no space between words, an extra space is inserted. -- @param buffer The global buffer. -function buffer.lines_join(buffer) end +function lines_join(buffer) end --- -- Split the lines in the target into lines that are less wide than -- `pixel_width` where possible. -- @param buffer The global buffer. -- @param pixel_width The pixel width. When `0`, the width of the view is used. -function buffer.lines_split(buffer, pixel_width) end +function lines_split(buffer, pixel_width) end --- -- Transform the selection to lower case. -- @param buffer The global buffer. -function buffer.lower_case(buffer) end +function lower_case(buffer) end --- -- Clear the margin text on all lines. -- @param buffer The global buffer. -function buffer.margin_text_clear_all(buffer) end +function margin_text_clear_all(buffer) end --- -- Add a marker to a line, returning an ID which can be used to find or delete @@ -1724,7 +1728,7 @@ function buffer.margin_text_clear_all(buffer) end -- @param line The line number. -- @param marker_num A marker number in the range of `0` to `31`. -- @return number -function buffer.marker_add(buffer, line, marker_num) end +function marker_add(buffer, line, marker_num) end --- -- Add a set of markers to a line. @@ -1732,7 +1736,7 @@ function buffer.marker_add(buffer, line, marker_num) end -- @param line The line number. -- @param marker_mask A mask of markers to set. Set bit 0 to set marker 0, bit -- 1 for marker 1 and so on. -function buffer.marker_add_set(buffer, line, marker_mask) end +function marker_add_set(buffer, line, marker_mask) end --- -- Set the symbol used for a particular marker number. @@ -1740,14 +1744,14 @@ function buffer.marker_add_set(buffer, line, marker_mask) end -- @param marker_num A marker number in the range of `0` to `31`. -- @param marker_symbol A marker symbol: `_SCINTILLA.constants.SC_MARK_*`. -- @see _SCINTILLA.next_marker_number -function buffer.marker_define(buffer, marker_num, marker_symbol) end +function marker_define(buffer, marker_num, marker_symbol) end --- -- Define a marker from a pixmap. -- @param buffer The global buffer. -- @param marker_num A marker number in the range of `0` to `31`. -- @param pixmap `NULL`-terminated pixmap data. -function buffer.marker_define_pixmap(buffer, marker_num, pixmap) end +function marker_define_pixmap(buffer, marker_num, pixmap) end --- -- Define a marker from RGBA data. @@ -1762,7 +1766,7 @@ function buffer.marker_define_pixmap(buffer, marker_num, pixmap) end -- byte and an alpha byte. The colour 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 buffer.marker_define_rgba_image(buffer, marker_num, pixels) end +function marker_define_rgba_image(buffer, marker_num, pixels) end --- -- Delete a marker from a line. @@ -1770,27 +1774,27 @@ function buffer.marker_define_rgba_image(buffer, marker_num, pixels) end -- @param line The line number. -- @param marker_num A marker number in the range of `0` to `31` or `-1` to -- delete all markers from the line. -function buffer.marker_delete(buffer, line, marker_num) end +function marker_delete(buffer, line, marker_num) end --- -- Delete all markers with a particular number from all lines. -- @param buffer The global buffer. -- @param marker_num A marker number in the range of `0` to `31` or `-1` to -- delete all markers from the line. -function buffer.marker_delete_all(buffer, marker_num) end +function marker_delete_all(buffer, marker_num) end --- -- Delete a marker. -- @param buffer The global buffer. -- @param handle The identifier of a marker returned by `buffer:marker_add()`. -function buffer.marker_delete_handle(buffer, handle) end +function marker_delete_handle(buffer, handle) end --- -- Enable/disable highlight for current folding block (smallest one that -- contains the caret) -- @param buffer The global buffer. -- @param enabled -function buffer.marker_enable_highlight(buffer, enabled) end +function marker_enable_highlight(buffer, enabled) end --- -- Get a bit mask of all the markers set on a line. @@ -1798,7 +1802,7 @@ function buffer.marker_enable_highlight(buffer, enabled) end -- @param buffer The global buffer. -- @param line The line number. -- @return number. -function buffer.marker_get(buffer, line) end +function marker_get(buffer, line) end --- -- Retrieve the line number at which a particular marker is located. @@ -1806,7 +1810,7 @@ function buffer.marker_get(buffer, line) end -- @param buffer The global buffer. -- @param handle The identifier of a marker returned by `buffer:marker_add()`. -- @return number -function buffer.marker_line_from_handle(buffer, handle) end +function marker_line_from_handle(buffer, handle) end --- -- Find the next line at or after start_line that includes a marker in mask. @@ -1816,7 +1820,7 @@ function buffer.marker_line_from_handle(buffer, handle) end -- @param marker_mask A mask of markers to find. Set bit 0 to find marker 0, bit -- 1 for marker 1 and so on. -- @return number -function buffer.marker_next(buffer, start_line, marker_mask) end +function marker_next(buffer, start_line, marker_mask) end --- -- Find the previous line before `start_line` that includes a marker in mask. @@ -1825,20 +1829,20 @@ function buffer.marker_next(buffer, start_line, marker_mask) end -- @param marker_mask A mask of markers to find. Set bit 0 to find marker 0, bit -- 1 for marker 1 and so on. -- @return number -function buffer.marker_previous(buffer, start_line, marker_mask) end +function marker_previous(buffer, start_line, marker_mask) end --- -- Return the symbol defined for marker_num with `buffer:marker_define()`. -- @param buffer The global buffer. -- @param marker_num A marker number in the range of `0` to `31`. -- @return number -function buffer.marker_symbol_defined(buffer, marker_num) end +function marker_symbol_defined(buffer, marker_num) end --- -- Move the caret inside current view if it is not there already. -- Any selection is lost. -- @param buffer The global buffer. -function buffer.move_caret_inside_view(buffer) end +function move_caret_inside_view(buffer) end --- -- Move the selected lines down one line, shifting the line below before the @@ -1847,7 +1851,7 @@ function buffer.move_caret_inside_view(buffer) end -- selection's first line and the end of the seletion's last line. If nothing -- was selected, the line the cursor is currently at will be selected. -- @param buffer The global buffer. -function buffer.move_selected_lines_down(buffer) end +function move_selected_lines_down(buffer) end --- -- Move the selected lines up one line, shifting the line above after the @@ -1856,79 +1860,79 @@ function buffer.move_selected_lines_down(buffer) end -- selection's first line and the end of the seletion's last line. If nothing -- was selected, the line the cursor is currently at will be selected. -- @param buffer The global buffer. -function buffer.move_selected_lines_up(buffer) end +function move_selected_lines_up(buffer) end --- -- Insert a new line, may use a CRLF, CR or LF depending on EOL mode. -- @param buffer The global buffer. -function buffer.new_line(buffer) end +function new_line(buffer) end --- -- Move caret one page down. -- @param buffer The global buffer. -function buffer.page_down(buffer) end +function page_down(buffer) end --- -- Move caret one page down extending selection to new caret position. -- @param buffer The global buffer. -function buffer.page_down_extend(buffer) end +function page_down_extend(buffer) end --- -- Move caret one page down, extending rectangular selection to new caret -- position. -- @param buffer The global buffer. -function buffer.page_down_rect_extend(buffer) end +function page_down_rect_extend(buffer) end --- -- Move caret one page up. -- @param buffer The global buffer. -function buffer.page_up(buffer) end +function page_up(buffer) end --- -- Move caret one page up extending selection to new caret position. -- @param buffer The global buffer. -function buffer.page_up_extend(buffer) end +function page_up_extend(buffer) end --- -- Move caret one page up, extending rectangular selection to new caret -- position. -- @param buffer The global buffer. -function buffer.page_up_rect_extend(buffer) end +function page_up_rect_extend(buffer) end --- -- Move caret one paragraph down (delimited by empty lines). -- @param buffer The global buffer. -function buffer.para_down(buffer) end +function para_down(buffer) end --- -- Move caret one paragraph down (delimited by empty lines) extending selection -- to new caret position. -- @param buffer The global buffer. -function buffer.para_down_extend(buffer) end +function para_down_extend(buffer) end --- -- Move caret one paragraph up (delimited by empty lines). -- @param buffer The global buffer. -function buffer.para_up(buffer) end +function para_up(buffer) end --- -- Move caret one paragraph up (delimited by empty lines) extending selection to -- new caret position. -- @param buffer The global buffer. -function buffer.para_up_extend(buffer) end +function para_up_extend(buffer) end --- -- Paste the contents of the clipboard into the document replacing the -- selection. -- @param buffer The global buffer. -function buffer.paste(buffer) end +function paste(buffer) end --- -- For private communication between an application and a known lexer. -- @param buffer The global buffer. -- @param operation An operation number. -- @param data Number data. -function buffer.private_lexer_call(buffer, operation, data) end +function private_lexer_call(buffer, operation, data) end --- -- Retrieve the x value of the point in the window where a position is @@ -1936,7 +1940,7 @@ function buffer.private_lexer_call(buffer, operation, data) end -- @param buffer The global buffer. -- @param pos The position. -- @return number -function buffer.point_x_from_position(buffer, pos) end +function point_x_from_position(buffer, pos) end --- -- Retrieve the y value of the point in the window where a position is @@ -1944,14 +1948,14 @@ function buffer.point_x_from_position(buffer, pos) end -- @param buffer The global buffer. -- @param pos The position. -- @return number -function buffer.point_y_from_position(buffer, pos) end +function point_y_from_position(buffer, pos) end --- -- Given a valid document position, return the next position taking code page -- into account. Maximum value returned is the last position in the document. -- @param buffer The global buffer. -- @param pos The position. -function buffer.position_after(buffer, pos) end +function position_after(buffer, pos) end --- -- Given a valid document position, return the previous position taking code @@ -1959,7 +1963,7 @@ function buffer.position_after(buffer, pos) end -- @param buffer The global buffer. -- @param pos The position. -- @return number -function buffer.position_before(buffer, pos) end +function position_before(buffer, pos) end --- -- Retrieve the position at the start of a line. @@ -1967,7 +1971,7 @@ function buffer.position_before(buffer, pos) end -- @param buffer The global buffer. -- @param line The line. -- @return number -function buffer.position_from_line(buffer, line) end +function position_from_line(buffer, line) end --- -- Find the position from a point within the window. @@ -1975,7 +1979,7 @@ function buffer.position_from_line(buffer, line) end -- @param x -- @param y -- @return number -function buffer.position_from_point(buffer, x, y) end +function position_from_point(buffer, x, y) end --- -- Returns the position from a point within the window, but return `-1` if not @@ -1984,19 +1988,19 @@ function buffer.position_from_point(buffer, x, y) end -- @param x -- @param y -- @return number -function buffer.position_from_point_close(buffer, x, y) end +function position_from_point_close(buffer, x, y) end --- -- Redoes the next action on the undo history. -- @param buffer The global buffer. -function buffer.redo(buffer) end +function redo(buffer) end --- -- Register an XPM image for use in autocompletion lists. -- @param buffer The global buffer. -- @param type Integer type to register the image with. -- @param xpm_data XPM data as is described for `buffer:marker_define_pixmap()`. -function buffer.register_image(buffer, type, xpm_data) end +function register_image(buffer, type, xpm_data) end --- -- Register an RGBA image for use in autocompletion lists. @@ -2006,7 +2010,7 @@ function buffer.register_image(buffer, type, xpm_data) end -- @param type Integer type to register the image with. -- @param pixels RGBA data as is described for -- `buffer:marker_define_rgba_image()`. -function buffer.register_rgba_image(buffer, type, pixels) end +function register_rgba_image(buffer, type, pixels) end --- -- Replace the selected text with the argument text. @@ -2014,7 +2018,7 @@ function buffer.register_rgba_image(buffer, type, pixels) end -- into view. -- @param buffer The global buffer. -- @param text The text. -function buffer.replace_sel(buffer, text) end +function replace_sel(buffer, text) end --- -- Replace the target text with the argument text. @@ -2023,7 +2027,7 @@ function buffer.replace_sel(buffer, text) end -- @param buffer The global buffer. -- @param text The text (can contain NULs). -- @return number -function buffer.replace_target(buffer, text) end +function replace_target(buffer, text) end --- -- Replace the target text with the argument text after `\d` processing. @@ -2034,34 +2038,34 @@ function buffer.replace_target(buffer, text) end -- @param buffer The global buffer. -- @param text The text (can contain NULs). -- @return number -function buffer.replace_target_re(buffer, text) end +function replace_target_re(buffer, text) end --- -- Set the main selection to the next selection. -- @param buffer The global buffer. -function buffer.rotate_selection(buffer) end +function rotate_selection(buffer) end --- -- Ensure the caret is visible. -- @param buffer The global buffer. -function buffer.scroll_caret(buffer) end +function scroll_caret(buffer) end --- -- Scroll to end of document. -- @param buffer The global buffer. -function buffer.scroll_to_end(buffer) end +function scroll_to_end(buffer) end --- -- Scroll to start of document. -- @param buffer The global buffer. -function buffer.scroll_to_start(buffer) end +function scroll_to_start(buffer) end --- -- Sets the current caret position to be the search anchor. -- Always call this before calling either of `buffer:search_next()` or -- `buffer:search_prev()`. -- @param buffer The global buffer. -function buffer.search_anchor(buffer) end +function search_anchor(buffer) end --- -- Search for a counted string in the target and set the target to the found @@ -2071,7 +2075,7 @@ function buffer.search_anchor(buffer) end -- @param buffer The global buffer. -- @param text The text (can contain NULs). -- @return number -function buffer.search_in_target(buffer, text) end +function search_in_target(buffer, text) end --- -- Find some text starting at the search anchor. @@ -2082,7 +2086,7 @@ function buffer.search_in_target(buffer, text) end -- @param flags Search flags. See `buffer.search_flags`. -- @param text The text. -- @return number -function buffer.search_next(buffer, flags, text) end +function search_next(buffer, flags, text) end --- -- Find some text starting at the search anchor and moving backwards. @@ -2093,19 +2097,19 @@ function buffer.search_next(buffer, flags, text) end -- @param flags Search flags. See `buffer.search_flags`. -- @param text The text. -- @return number -function buffer.search_prev(buffer, flags, text) end +function search_prev(buffer, flags, text) end --- -- Select all the text in the document. -- The current position is not scrolled into view. -- @param buffer The global buffer. -function buffer.select_all(buffer) end +function select_all(buffer) end --- -- Duplicate the selection. -- If selection empty duplicate the line containing the caret. -- @param buffer The global buffer. -function buffer.selection_duplicate(buffer) end +function selection_duplicate(buffer) end --- -- Reset the set of characters for whitespace and word characters to the @@ -2113,54 +2117,54 @@ function buffer.selection_duplicate(buffer) end -- This sets whitespace to space, tab and other characters with codes less than -- `0x20`, with word characters set to alphanumeric and `'_'`. -- @param buffer The global buffer. -function buffer.set_chars_default(buffer) end +function set_chars_default(buffer) end --- -- Set caret to a position, while removing any existing selection. -- The caret is not scrolled into view. -- @param buffer The buffer -- @param pos The position to move to. -function buffer.set_empty_selection(buffer, pos) end +function set_empty_selection(buffer, pos) end --- -- Set the colors used as a chequerboard pattern in the fold margin. -- @param buffer The global buffer. -- @param use_setting Enable color change. -- @param color A color in `0xBBGGRR` format. -function buffer.set_fold_margin_colour(buffer, use_setting, color) end +function set_fold_margin_colour(buffer, use_setting, color) end --- -- Set the colors used as a checkerboard pattern in the fold margin. -- @param buffer The global buffer. -- @param use_setting Enable color change. -- @param color A color in `0xBBGGRR` format. -function buffer.set_fold_margin_hi_colour(buffer, use_setting, color) end +function set_fold_margin_hi_colour(buffer, use_setting, color) end --- -- Set a back color for active hotspots. -- @param buffer The global buffer. -- @param use_setting Enable the color change. -- @param color A color in `0xBBGGRR` format. -function buffer.set_hotspot_active_back(buffer, use_setting, color) end +function set_hotspot_active_back(buffer, use_setting, color) end --- -- Set a fore color for active hotspots. -- @param buffer The global buffer. -- @param use_setting Enable the color change. -- @param color A color in `0xBBGGRR` format. -function buffer.set_hotspot_active_fore(buffer, use_setting, color) end +function set_hotspot_active_fore(buffer, use_setting, color) end --- -- Set the length of the utf8 argument for calling `buffer:encoded_from_utf8()`. -- @param buffer The global buffer. -- @param bytes Bytes or `-1` for measuring to first NUL. -function buffer.set_length_for_encode(buffer, bytes) end +function set_length_for_encode(buffer, bytes) end --- -- Remember the current position in the undo history as the position at which -- the document was saved. -- @param buffer The global buffer. -function buffer.set_save_point(buffer) end +function set_save_point(buffer) end --- -- Select a range of text. @@ -2170,7 +2174,7 @@ function buffer.set_save_point(buffer) end -- document. -- @param end_pos End position. If negative, it means remove any selection (i.e. -- set the `anchor` to the same position as `current_pos`). -function buffer.set_sel(buffer, start_pos, end_pos) end +function set_sel(buffer, start_pos, end_pos) end --- -- Set the background color of the main and additional selections and whether to @@ -2178,7 +2182,7 @@ function buffer.set_sel(buffer, start_pos, end_pos) end -- @param buffer The global buffer. -- @param use_setting Enable color change. -- @param color A color in `0xBBGGRR` format. -function buffer.set_sel_back(buffer, use_setting, color) end +function set_sel_back(buffer, use_setting, color) end --- -- Set the foreground color of the main and additional selections and whether @@ -2186,14 +2190,14 @@ function buffer.set_sel_back(buffer, use_setting, color) end -- @param buffer The global buffer. -- @param use_setting Enable color change. -- @param color A color in `0xBBGGRR` format. -function buffer.set_sel_fore(buffer, use_setting, color) end +function set_sel_fore(buffer, use_setting, color) end --- -- Set a simple selection from anchor to caret. -- @param buffer The global buffer. -- @param caret The caret. -- @param anchor The anchor. -function buffer.set_selection(buffer, caret, anchor) end +function set_selection(buffer, caret, anchor) end --- -- Change style from current styling position for length characters to a style @@ -2201,13 +2205,13 @@ function buffer.set_selection(buffer, caret, anchor) end -- @param buffer The global buffer. -- @param length The length to style. -- @param style The style number to set. -function buffer.set_styling(buffer, length, style) end +function set_styling(buffer, length, style) end --- -- Replace the contents of the document with the argument text. -- @param buffer The global buffer. -- @param text The text. -function buffer.set_text(buffer, text) end +function set_text(buffer, text) end --- -- Set the way the display area is determined when a particular line is to be @@ -2217,21 +2221,21 @@ function buffer.set_text(buffer, text) end -- @param visible_policy A combination of `_SCINTILLA.constants.VISIBLE_SLOP`, -- (0x01) and `_SCINTILLA.constants.VISIBLE_STRICT` (0x04). -- @param visible_slop The slop value. -function buffer.set_visible_policy(buffer, visible_policy, visible_slop) end +function set_visible_policy(buffer, visible_policy, visible_slop) end --- -- Set the background color of all whitespace and whether to use this setting. -- @param buffer The global buffer. -- @param use_setting Enable color change. -- @param color A color in `0xBBGGRR` format. -function buffer.set_whitespace_back(buffer, use_setting, color) end +function set_whitespace_back(buffer, use_setting, color) end --- -- Set the foreground color of all whitespace and whether to use this setting. -- @param buffer The global buffer. -- @param use_setting Enable color change. -- @param color A color in `0xBBGGRR` format. -function buffer.set_whitespace_fore(buffer, use_setting, color) end +function set_whitespace_fore(buffer, use_setting, color) end --- -- Set the way the caret is kept visible when going sideways. @@ -2242,7 +2246,7 @@ function buffer.set_whitespace_fore(buffer, use_setting, color) end -- `_SCINTILLA.constants.CARET_JUMPS` (0x10), and -- `_SCINTILLA.constants.CARET_EVEN` (0x08). -- @param caret_slop A slop value. -function buffer.set_x_caret_policy(buffer, caret_policy, caret_slop) end +function set_x_caret_policy(buffer, caret_policy, caret_slop) end --- -- Set the way the line the caret is on is kept visible. @@ -2252,7 +2256,7 @@ function buffer.set_x_caret_policy(buffer, caret_policy, caret_slop) end -- `_SCINTILLA.constants.CARET_JUMPS` (0x10), and -- `_SCINTILLA.constants.CARET_EVEN` (0x08). -- @param caret_slop A slop value. -function buffer.set_y_caret_policy(buffer, caret_policy, caret_slop) end +function set_y_caret_policy(buffer, caret_policy, caret_slop) end --- -- Make a range of lines visible. @@ -2261,12 +2265,12 @@ function buffer.set_y_caret_policy(buffer, caret_policy, caret_slop) end -- @param buffer The global buffer. -- @param start_line The start line. -- @param end_line The end line. -function buffer.show_lines(buffer, start_line, end_line) end +function show_lines(buffer, start_line, end_line) end --- -- Start notifying the container of all key presses and commands. -- @param buffer The global buffer. -function buffer.start_record(buffer) end +function start_record(buffer) end --- -- Set the current styling position to pos and the styling mask to mask. @@ -2275,73 +2279,73 @@ function buffer.start_record(buffer) end -- @param buffer The global buffer. -- @param position The styling position. -- @param mask The bit mask of the style bytes that can be set. -function buffer.start_styling(buffer, position, mask) end +function start_styling(buffer, position, mask) end --- -- Stop notifying the container of all key presses and commands. -- @param buffer The global buffer. -function buffer.stop_record(buffer) end +function stop_record(buffer) end --- -- Move caret to bottom of page, or one page down if already at bottom of page. -- @param buffer The global buffer. -function buffer.stuttered_page_down(buffer) end +function stuttered_page_down(buffer) end --- -- Move caret to bottom of page, or one page down if already at bottom of page, -- extending selection to new caret position. -- @param buffer The global buffer. -function buffer.stuttered_page_down_extend(buffer) end +function stuttered_page_down_extend(buffer) end --- -- Move caret to top of page, or one page up if already at top of page. -- @param buffer The global buffer. -function buffer.stuttered_page_up(buffer) end +function stuttered_page_up(buffer) end --- -- Move caret to top of page, or one page up if already at top of page, -- extending selection to new caret position. -- @param buffer The global buffer. -function buffer.stuttered_page_up_extend(buffer) end +function stuttered_page_up_extend(buffer) end --- -- Clear all the styles and make equivalent to the global default style. -- @param buffer The global buffer. -function buffer.style_clear_all(buffer) end +function style_clear_all(buffer) end --- -- Reset the default style to its state at startup. -- @param buffer The global buffer. -function buffer.style_reset_default(buffer) end +function style_reset_default(buffer) end --- -- Swap that caret and anchor of the main selection. -- @param buffer The global buffer. -function buffer.swap_main_anchor_caret(buffer) end +function swap_main_anchor_caret(buffer) end --- -- If selection is empty or all on one line replace the selection with a tab -- character, or if more than one line selected, indent the lines. -- @param buffer The global buffer. -function buffer.tab(buffer) end +function tab(buffer) end --- -- Returns the target converted to UTF8. -- @param buffer The global buffer. -function buffer.target_as_utf8(buffer) end +function target_as_utf8(buffer) end --- -- Make the target range start and end be the same as the selection range start -- and end. -- @param buffer The global buffer. -function buffer.target_from_selection(buffer) end +function target_from_selection(buffer) end --- -- Retrieve the height of a particular line of text in pixels. -- @param buffer The global buffer. -- @param line The line number. -- @return number -function buffer.text_height(buffer, line) end +function text_height(buffer, line) end --- -- Measure the pixel width of some text in a particular style. @@ -2350,36 +2354,36 @@ function buffer.text_height(buffer, line) end -- @param style_num The style number between `0` and `255`. -- @param text The text. -- @return number -function buffer.text_width(buffer, style_num, text) end +function text_width(buffer, style_num, text) end --- -- Switch between sticky and non-sticky: meant to be bound to a key. -- See `buffer.caret_sticky`. -- @param buffer The global buffer. -function buffer.toggle_caret_sticky(buffer) end +function toggle_caret_sticky(buffer) end --- -- Switch a header line between expanded and contracted. -- @param buffer The global buffer. -- @param line The line number. -function buffer.toggle_fold(buffer, line) end +function toggle_fold(buffer, line) end --- -- Undo one action in the undo history. -- @param buffer The global buffer. -function buffer.undo(buffer) end +function undo(buffer) end --- -- Transform the selection to upper case. -- @param buffer The global buffer. -function buffer.upper_case(buffer) end +function upper_case(buffer) end --- -- Sets whether a pop up menu is displayed automatically when the user presses -- the wrong mouse button. -- @param buffer The global buffer. -- @param allow_popup Allow popup menu. -function buffer.use_pop_up(buffer, allow_popup) end +function use_pop_up(buffer, allow_popup) end --- -- Display a list of strings and send notification when user chooses one. @@ -2388,54 +2392,54 @@ function buffer.use_pop_up(buffer, allow_popup) end -- @param item_list List of words separated by separator characters (initially -- spaces). -- @see _SCINTILLA.next_user_list_type -function buffer.user_list_show(buffer, list_type, item_list) end +function user_list_show(buffer, list_type, item_list) end --- -- Move caret to before first visible character on line. -- If already there move to first character on line. -- @param buffer The global buffer. -function buffer.vc_home(buffer) end +function vc_home(buffer) end --- -- Move caret to before first visible character on display line. -- If already there move to first character on display line. -- @param buffer The global buffer. -function buffer.vc_home_display(buffer) end +function vc_home_display(buffer) end --- -- Like `buffer:vc_home_display()` but extending selection to new caret -- position. -- @param buffer The global buffer. -function buffer.vc_home_display_extend(buffer) end +function vc_home_display_extend(buffer) end --- -- Like `buffer:vc_home()` but extending selection to new caret position. -- @param buffer The global buffer. -function buffer.vc_home_extend(buffer) end +function vc_home_extend(buffer) end --- -- Move caret to before first visible character on line. -- If already there move to first character on line. In either case, extend -- rectangular selection to new caret position. -- @param buffer The global buffer. -function buffer.vc_home_rect_extend(buffer) end +function vc_home_rect_extend(buffer) end --- -- Move caret to before first visible character on display line when word-wrap -- is enabled. -- If already there, go to first character on display line. -- @param buffer The global buffer. -function buffer.vc_home_wrap(buffer) end +function vc_home_wrap(buffer) end --- -- Like `buffer:vc_home_wrap()` but extending selection to new caret position. -- @param buffer The global buffer. -function buffer.vc_home_wrap_extend(buffer) end +function vc_home_wrap_extend(buffer) end --- -- Center current line in window. -- @param buffer The global buffer. -function buffer.vertical_centre_caret(buffer) end +function vertical_centre_caret(buffer) end --- -- Find the display line of a document line taking hidden lines into account. @@ -2444,7 +2448,7 @@ function buffer.vertical_centre_caret(buffer) end -- @param buffer The global buffer. -- @param line The line number. -- @return number -function buffer.visible_from_doc_line(buffer, line) end +function visible_from_doc_line(buffer, line) end --- -- Get position of end of word. @@ -2455,71 +2459,71 @@ function buffer.visible_from_doc_line(buffer, line) end -- 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 document. -function buffer.word_end_position(buffer, pos, only_word_chars) end +function word_end_position(buffer, pos, only_word_chars) end --- -- Move caret left one word. -- @param buffer The global buffer. -function buffer.word_left(buffer) end +function word_left(buffer) end --- -- Move caret left one word, position cursor at end of word. -- @param buffer The global buffer. -function buffer.word_left_end(buffer) end +function word_left_end(buffer) end --- -- Move caret left one word, position cursor at end of word, extending selection -- to new caret position. -- @param buffer The global buffer. -function buffer.word_left_end_extend(buffer) end +function word_left_end_extend(buffer) end --- -- Move caret left one word extending selection to new caret position. -- @param buffer The global buffer. -function buffer.word_left_extend(buffer) end +function word_left_extend(buffer) end --- -- Move to the previous change in capitalisation or underscores. -- @param buffer The global buffer. -function buffer.word_part_left(buffer) end +function word_part_left(buffer) end --- -- Move to the previous change in capitalisation or underscores extending -- selection to new caret position. -- @param buffer The global buffer. -function buffer.word_part_left_extend(buffer) end +function word_part_left_extend(buffer) end --- -- Move to the next change in capitalisation or underscores. -- @param buffer The global buffer. -function buffer.word_part_right(buffer) end +function word_part_right(buffer) end --- -- Move to the next change in capitalisation or underscores extending selection -- to new caret position. -- @param buffer The global buffer. -function buffer.word_part_right_extend(buffer) end +function word_part_right_extend(buffer) end --- -- Move caret right one word. -- @param buffer The global buffer. -function buffer.word_right(buffer) end +function word_right(buffer) end --- -- Move caret right one word, position cursor at end of word. -- @param buffer The global buffer. -function buffer.word_right_end(buffer) end +function word_right_end(buffer) end --- -- Move caret right one word, position cursor at end of word, extending -- selection to new caret position. -- @param buffer The global buffer. -function buffer.word_right_end_extend(buffer) end +function word_right_end_extend(buffer) end --- -- Move caret right one word extending selection to new caret position. -- @param buffer The global buffer. -function buffer.word_right_extend(buffer) end +function word_right_extend(buffer) end --- -- Get position of start of word. @@ -2530,26 +2534,26 @@ function buffer.word_right_extend(buffer) end -- 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 document. -function buffer.word_start_position(buffer, pos, only_word_chars) end +function word_start_position(buffer, pos, only_word_chars) end --- -- Returns the number of display lines needed to wrap a document line. -- @param buffer The global buffer. -- @param line The line number. -- @return number -function buffer.wrap_count(buffer, line) end +function wrap_count(buffer, line) end --- -- Magnify the displayed text by increasing the sizes by 1 point if the current -- zoom factor is less than 20 points. -- @param buffer The global buffer. -function buffer.zoom_in(buffer) end +function zoom_in(buffer) end --- -- Make the displayed text smaller by decreasing the sizes by 1 point if the -- current zoom factor is greater than -10 points. -- @param buffer The global buffer. -function buffer.zoom_out(buffer) end +function zoom_out(buffer) end -- External functions. @@ -2559,54 +2563,61 @@ function buffer.zoom_out(buffer) end -- top of all buffer functions to avoid unexpected behavior since most buffer -- functions operate on `_G.buffer`, which is not necessarily the given one. -- @param buffer The buffer to check. -function buffer.check_global(buffer) end +-- @see _G._G.buffer +function check_global(buffer) end --- -- Deletes the current buffer. -- WARNING: this function should NOT be called via scripts. Use `buffer:close()` --- instead, which prompts for confirmation if necessary. Generates a +-- instead, which prompts for confirmation if necessary. Emits a -- `BUFFER_DELETED` event. -- @param buffer The global buffer. -function buffer.delete(buffer) end +-- @see events.BUFFER_DELETED +function delete(buffer) end --- -- Gets a range of text from the current buffer. -- @param buffer The global buffer. -- @param start_pos The beginning position of the range of text to get. -- @param end_pos The end position of the range of text to get. -function buffer.text_range(buffer, start_pos, end_pos) end +function text_range(buffer, start_pos, end_pos) end --- -- Reloads the file in a given buffer. -- @param buffer The global buffer. -function buffer.reload(buffer) end +function reload(buffer) end --- -- Sets the encoding for the buffer, converting its contents in the process. -- @param buffer The global buffer. --- @param encoding The encoding to set. Valid encodings are ones that GTK's --- `g_convert()` function accepts (typically GNU iconv's encodings). +-- @param encoding The encoding to set. Valid encodings are ones that GNU iconv +-- accepts. -- @usage buffer.set_encoding(buffer, 'ASCII') -function buffer.set_encoding(buffer, encoding) end +function set_encoding(buffer, encoding) end --- -- Saves the current buffer to a file. +-- Emits `FILE_BEFORE_SAVE` and `FILE_AFTER_SAVE` events. -- @param buffer The global buffer. -function buffer.save(buffer) end +-- @see _G.events +function save(buffer) end --- -- Saves the current buffer to a file different than its filename property. +-- Emits a `FILE_SAVED_AS` event. -- @param buffer The global buffer. -- @param utf8_filename The new filepath to save the buffer to. Must be UTF-8 -- encoded. -function buffer.save_as(buffer, utf8_filename) end +-- @see _G.events +function save_as(buffer, utf8_filename) end --- -- Closes the current buffer. -- @param buffer The global buffer. -- If the buffer is dirty, the user is prompted to continue. The buffer is not -- saved automatically. It must be done manually. -function buffer.close(buffer) end +-- @return `true` if the buffer was closed; `nil` otherwise. +function close(buffer) end --- -- Replacement for `buffer.lexer_language =`. @@ -2618,21 +2629,21 @@ function buffer.close(buffer) end -- @param buffer The global buffer. -- @param lang The string language to set. -- @usage buffer.set_lexer(buffer, 'language_name') -function buffer.set_lexer(buffer, lang) end +function set_lexer(buffer, lang) end --- -- Replacement for `buffer.lexer_language`. -- @param buffer The global buffer. -- @param current Whether to get the lexer at the current caret position in -- multi-language lexers. The default is `false` and returns the parent lexer. -function buffer.get_lexer(buffer, current) end +function get_lexer(buffer, current) end --- -- Returns the name of the style associated with a style number. -- @param buffer The global buffer. -- @param style_num A style number from `0` to `255`. -- @see buffer.style_at -function buffer.get_style_name(buffer, style_num) end +function get_style_name(buffer, style_num) end -- Unused Fields. -- * use_palette diff --git a/core/.iconv.luadoc b/core/.iconv.luadoc index eb761d56..fcf199ca 100644 --- a/core/.iconv.luadoc +++ b/core/.iconv.luadoc @@ -2,12 +2,14 @@ -- This is a DUMMY FILE used for making LuaDoc for built-in functions in the -- string table. ---- Extends Lua's string package to provide character set conversions. +--- Extends Lua's `string` package to provide character set conversions. module('string') --- -- Converts a string from one character set to another using iconv. --- Valid character sets are GNU iconv's character sets. +-- Valid character sets are [GNU iconv's character sets][]. +-- +-- [GNU iconv's character sets]: http://www.gnu.org/software/libiconv/ -- @param text The text to convert. -- @param to The character set to convert to. -- @param from The character set to convert from. diff --git a/core/.view.luadoc b/core/.view.luadoc index bea8efb8..c658ddfb 100644 --- a/core/.view.luadoc +++ b/core/.view.luadoc @@ -3,35 +3,42 @@ -- global view table. --- --- The currently focused view. --- It also represents the structure of any view table in `_G._VIEWS`. +-- A Textadept view object. -- @field size (number) -- The position of the split resizer (if this view is part of a split view). module('view') --- --- The buffer this view contains. (Read-only) +-- The [buffer](buffer.html) the view contains. (Read-only) -- @class table -- @name buffer local buffer --- --- Splits the indexed view vertically or horizontally and focuses the new view. +-- Splits the given view vertically or horizontally and focuses the new view. +-- Emits a `VIEW_NEW` event. +-- @param view The view to split. -- @param vertical Flag indicating a vertical split. The default value is -- `false` for horizontal. --- @return old view and new view tables. -function view:split(vertical) end +-- @return old view and new view. +-- @see events.VIEW_NEW +function split(view, vertical) end --- --- Unsplits the indexed view if possible. +-- Unsplits the given view if possible. +-- @param view The view to unsplit. -- @return boolean if the view was unsplit or not. -function view:unsplit() end +function view.unsplit(view) end --- --- Goes to the specified buffer in the indexed view. --- Generates `BUFFER_BEFORE_SWITCH` and `BUFFER_AFTER_SWITCH` events. --- @param n A relative or absolute buffer index. An absolute index of `-1` goes --- to the last buffer. +-- Goes to the specified buffer in the given view. +-- Emits `BUFFER_BEFORE_SWITCH` and `BUFFER_AFTER_SWITCH` events. +-- @param view The view to switch buffers in. +-- @param n A relative or absolute buffer index in `_G._BUFFERS`. An absolute +-- index of `-1` goes to the last buffer. -- @param relative Flag indicating if `n` is a relative index or not. The -- default value is `false`. -function view:goto_buffer(n, relative) end +-- @see _G._G._BUFFERS +-- @see events.BUFFER_BEFORE_SWITCH +-- @see events.BUFFER_AFTER_SWITCH +function goto_buffer(view, n, relative) end diff --git a/core/args.lua b/core/args.lua index 687735ce..a7c56c90 100644 --- a/core/args.lua +++ b/core/args.lua @@ -9,7 +9,7 @@ local M = {} -- ## Arg Events -- -- + `'arg_none'` --- Called when no command line arguments are passed to Textadept on init. +-- Called when no command line arguments are passed to Textadept on startup. module('args')]] local arg = arg @@ -25,7 +25,7 @@ local switches = {} -- @param switch2 String switch (long version). -- @param narg The number of expected parameters for the switch. -- @param f The Lua function to run when the switch is tripped. --- @param description Description of the switch. +-- @param description Description of the switch for command line help. -- @name register function M.register(switch1, switch2, narg, f, description) local t = { f, narg, description } @@ -36,9 +36,10 @@ end -- Processes command line arguments. -- Add command line switches with `args.register()`. Any unrecognized arguments -- are treated as filepaths and opened. --- Generates an `'arg_none'` event when no args are present. +-- Emits an `'arg_none'` event when no args are present. -- @param arg Argument table. -- @see register +-- @see events -- @name process function M.process(arg) local no_args = true @@ -94,7 +95,7 @@ if not lfs.attributes(userhome) then lfs.mkdir(userhome) end if not lfs.attributes(userhome..'/init.lua') then local f = io.open(userhome..'/init.lua', 'w') if f then - f:write("require 'textadept'\n") + f:write("_M.textadept = require 'textadept'\n") f:close() end end diff --git a/core/events.lua b/core/events.lua index fabd52e5..3ee2e333 100644 --- a/core/events.lua +++ b/core/events.lua @@ -8,244 +8,262 @@ local M = {} -- -- ## Overview -- --- Textadept is very event-driven. Most of its functionality comes through event --- handlers. Events occur when you create a new buffer, press a key, click on a --- menu, etc. You can even make an event occur with Lua code. Instead of having --- a single event handler however, each event can have a set of handlers. These --- handlers are simply Lua functions that are called in the order they were --- added to an event. This enables dynamically loaded modules to add their own --- handlers to events. +-- Events occur 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. This enables dynamically loaded modules to +-- connect to events. -- -- Events themselves are nothing special. They do not have to be declared in -- order to be used. They are simply strings containing an arbitrary event name. --- When an event of this name occurs, either generated by Textadept or you, all --- event handlers assigned to it are run. +-- When an event of this name is emitted, either by Textadept or you, all event +-- handlers assigned to it are run. Events can be given any number of arguments. +-- These arguments will be passed to the event's handler functions. If an event +-- handler returns a `true` or `false` boolean value explicitly, no subsequent +-- handlers are called. This is useful if you want to stop the propagation of an +-- event like a keypress if it has already been handled. -- --- Events can be given any number of arguments. These arguments will be passed --- to the event's handler functions. If a handler returns either true or false --- explicitly, all subsequent handlers are not called. This is useful if you --- want to stop the propagation of an event like a keypress. --- --- ## Textadept Events --- --- This is the set of default events that Textadept emits with the arguments --- they pass. Events that modules emit are listed on their respective LuaDoc --- pages. --- --- * `APPLEEVENT_ODOC` +-- @field APPLEEVENT_ODOC (string) -- Called when Mac OSX tells Textadept to open a document. --- * `uri`: The URI to open encoded in UTF-8. --- * `AUTO_C_CHAR_DELETED` +-- Arguments: +-- +-- * `uri`: The URI to open encoded in UTF-8. +-- @field AUTO_C_CHAR_DELETED (string) -- Called when the user deleted a character while the autocompletion list was -- active. --- * `AUTO_C_RELEASE` +-- @field AUTO_C_RELEASE (string) -- Called when the user has cancelled the autocompletion list. --- * `AUTO_C_SELECTION` +-- @field AUTO_C_SELECTION (string) -- Called when the user has selected an item in an autocompletion list and -- before the selection is inserted. -- Automatic insertion can be cancelled by calling -- [`buffer:auto_c_cancel()`][] before returning from the event handler. -- Arguments: --- * `text`: The text of the selection. --- * `position`: The start position of the word being completed. --- * `BUFFER_AFTER_SWITCH` +-- +-- * `text`: The text of the selection. +-- * `position`: The start position of the word being completed. +-- @field BUFFER_AFTER_SWITCH (string) -- Called right after a buffer is switched to. --- * `BUFFER_BEFORE_SWITCH` +-- This is emitted by [`view:goto_buffer()`][]. +-- @field BUFFER_BEFORE_SWITCH (string) -- Called right before another buffer is switched to. --- * `BUFFER_DELETED` +-- This is emitted by [`view:goto_buffer()`][]. +-- @field BUFFER_DELETED (string) -- Called after a buffer was deleted. --- * `BUFFER_NEW` +-- This is emitted by [`buffer:delete()`][]. +-- @field BUFFER_NEW (string) -- Called when a new buffer is created. --- * `CALL_TIP_CLICK` +-- This is emitted on startup and by [`new_buffer()`][]. +-- @field CALL_TIP_CLICK (string) -- Called when the user clicks on a calltip. -- Arguments: --- * `position`: Set to 1 if the click is in an up arrow, 2 if in a down --- arrow, and 0 if elsewhere. --- * `CHAR_ADDED` +-- +-- * `position`: Set to 1 if the click is in an up arrow, 2 if in a down +-- arrow, and 0 if elsewhere. +-- @field CHAR_ADDED (string) -- Called when an ordinary text character is added to the buffer. -- Arguments: --- * `ch`: The text character byte. --- * `COMMAND_ENTRY_COMMAND` +-- +-- * `ch`: The text character byte. +-- @field COMMAND_ENTRY_COMMAND (string) -- Called when a command is entered into the Command Entry. -- Arguments: --- * `command`: The command text. --- * `COMMAND_ENTRY_KEYPRESS` +-- +-- * `command`: The command text. +-- @field COMMAND_ENTRY_KEYPRESS (string) -- Called when a key is pressed in the Command Entry. -- Arguments: --- * `code`: The key code. --- * `shift`: The Shift key is held down. --- * `ctrl`: The Control/Command key is held down. --- * `alt`: The Alt/option key is held down. --- * `meta`: The Control key on Mac OSX is held down. --- * `DOUBLE_CLICK` +-- +-- * `code`: The key code. +-- * `shift`: The Shift key is held down. +-- * `ctrl`: The Control/Command key is held down. +-- * `alt`: The Alt/option key is held down. +-- * `meta`: The Control key on Mac OSX is held down. +-- @field DOUBLE_CLICK (string) -- Called when the mouse button is double-clicked. -- Arguments: --- * `position`: The text position of the double click. --- * `line`: The line of the double click. --- * `modifiers`: The key modifiers held down. It is a combination of zero --- or more of `_SCINTILLA.constants.SCMOD_ALT`, --- `_SCINTILLA.constants.SCMOD_CTRL`, --- `_SCINTILLA.constants.SCMOD_SHIFT`, and --- `_SCINTILLA.constants.SCMOD_META`. --- Note: If you set `buffer.rectangular_selection_modifier` to --- `_SCINTILLA.constants.SCMOD_CTRL`, the Ctrl key is reported as *both* --- Ctrl and Alt due to a Scintilla limitation with GTK. --- * `DWELL_END` +-- +-- * `position`: The text position of the double click. +-- * `line`: The line of the double click. +-- * `modifiers`: The key modifiers held down. It is a combination of zero or +-- more of `_SCINTILLA.constants.SCMOD_ALT`, +-- `_SCINTILLA.constants.SCMOD_CTRL`, +-- `_SCINTILLA.constants.SCMOD_SHIFT`, and +-- `_SCINTILLA.constants.SCMOD_META`. +-- Note: If you set `buffer.rectangular_selection_modifier` to +-- `_SCINTILLA.constants.SCMOD_CTRL`, the Ctrl key is reported as *both* +-- Ctrl and Alt due to a Scintilla limitation with GTK+. +-- @field DWELL_END (string) -- Called after a `DWELL_START` and the mouse is moved or other activity such -- as key press indicates the dwell is over. -- Arguments: --- * `position`: The nearest position in the document to the position where --- the mouse pointer was lingering. --- * `x`: Where the pointer lingered. --- * `y`: Where the pointer lingered. --- * `DWELL_START` +-- +-- * `position`: The nearest position in the document to the position where +-- the mouse pointer was lingering. +-- * `x`: Where the pointer lingered. +-- * `y`: Where the pointer lingered. +-- @field DWELL_START (string) -- Called when the user keeps the mouse in one position for the dwell period -- (see `_SCINTILLA.constants.SCI_SETMOUSEDWELLTIME`). -- Arguments: --- * `position`: The nearest position in the document to the position where --- the mouse pointer was lingering. --- * `x`: Where the pointer lingered. --- * `y`: Where the pointer lingered. --- * `ERROR` +-- +-- * `position`: The nearest position in the document to the position where +-- the mouse pointer was lingering. +-- * `x`: Where the pointer lingered. +-- * `y`: Where the pointer lingered. +-- @field ERROR (string) -- Called when an error occurs. -- Arguments: --- * `text`: The error text. --- * `FIND` +-- +-- * `text`: The error text. +-- @field FIND (string) -- Called when finding text via the Find dialog box. -- Arguments: --- * `text`: The text to search for. --- * `next`: Search forward. --- * `HOTSPOT_CLICK` +-- +-- * `text`: The text to search for. +-- * `next`: Search forward. +-- @field HOTSPOT_CLICK (string) -- Called when the user clicks on text that is in a style with the hotspot -- attribute set. -- Arguments: --- * `position`: The text position of the click. --- * `modifiers`: The key modifiers held down. It is a combination of zero --- or more of `_SCINTILLA.constants.SCMOD_ALT`, --- `_SCINTILLA.constants.SCMOD_CTRL`, --- `_SCINTILLA.constants.SCMOD_SHIFT`, and --- `_SCINTILLA.constants.SCMOD_META`. --- Note: If you set `buffer.rectangular_selection_modifier` to --- `_SCINTILLA.constants.SCMOD_CTRL`, the Ctrl key is reported as *both* --- Ctrl and Alt due to a Scintilla limitation with GTK. --- * `HOTSPOT_DOUBLE_CLICK` +-- +-- * `position`: The text position of the click. +-- * `modifiers`: The key modifiers held down. It is a combination of zero or +-- more of `_SCINTILLA.constants.SCMOD_ALT`, +-- `_SCINTILLA.constants.SCMOD_CTRL`, +-- `_SCINTILLA.constants.SCMOD_SHIFT`, and +-- `_SCINTILLA.constants.SCMOD_META`. +-- Note: If you set `buffer.rectangular_selection_modifier` to +-- `_SCINTILLA.constants.SCMOD_CTRL`, the Ctrl key is reported as *both* +-- Ctrl and Alt due to a Scintilla limitation with GTK+. +-- @field HOTSPOT_DOUBLE_CLICK (string) -- Called when the user double clicks on text that is in a style with the -- hotspot attribute set. -- Arguments: --- * `position`: The text position of the double click. --- * `modifiers`: The key modifiers held down. It is a combination of zero --- or more of `_SCINTILLA.constants.SCMOD_ALT`, --- `_SCINTILLA.constants.SCMOD_CTRL`, --- `_SCINTILLA.constants.SCMOD_SHIFT`, and --- `_SCINTILLA.constants.SCMOD_META`. --- Note: If you set `buffer.rectangular_selection_modifier` to --- `_SCINTILLA.constants.SCMOD_CTRL`, the Ctrl key is reported as *both* --- Ctrl and Alt due to a Scintilla limitation with GTK. --- * `HOTSPOT_RELEASE_CLICK` +-- +-- * `position`: The text position of the double click. +-- * `modifiers`: The key modifiers held down. It is a combination of zero or +-- more of `_SCINTILLA.constants.SCMOD_ALT`, +-- `_SCINTILLA.constants.SCMOD_CTRL`, +-- `_SCINTILLA.constants.SCMOD_SHIFT`, and +-- `_SCINTILLA.constants.SCMOD_META`. +-- Note: If you set `buffer.rectangular_selection_modifier` to +-- `_SCINTILLA.constants.SCMOD_CTRL`, the Ctrl key is reported as *both* +-- Ctrl and Alt due to a Scintilla limitation with GTK+. +-- @field HOTSPOT_RELEASE_CLICK (string) -- Called when the user releases the mouse on text that is in a style with the -- hotspot attribute set. -- Arguments: --- * `position`: The text position of the release. --- * `INDICATOR_CLICK` +-- +-- * `position`: The text position of the release. +-- @field INDICATOR_CLICK (string) -- Called when the user clicks the mouse on text that has an indicator. -- Arguments: --- * `position`: The text position of the click. --- * `modifiers`: The key modifiers held down. It is a combination of zero --- or more of `_SCINTILLA.constants.SCMOD_ALT`, --- `_SCINTILLA.constants.SCMOD_CTRL`, --- `_SCINTILLA.constants.SCMOD_SHIFT`, and --- `_SCINTILLA.constants.SCMOD_META`. --- Note: If you set `buffer.rectangular_selection_modifier` to --- `_SCINTILLA.constants.SCMOD_CTRL`, the Ctrl key is reported as *both* --- Ctrl and Alt due to a Scintilla limitation with GTK. --- * `INDICATOR_RELEASE` +-- +-- * `position`: The text position of the click. +-- * `modifiers`: The key modifiers held down. It is a combination of zero or +-- more of `_SCINTILLA.constants.SCMOD_ALT`, +-- `_SCINTILLA.constants.SCMOD_CTRL`, +-- `_SCINTILLA.constants.SCMOD_SHIFT`, and +-- `_SCINTILLA.constants.SCMOD_META`. +-- Note: If you set `buffer.rectangular_selection_modifier` to +-- `_SCINTILLA.constants.SCMOD_CTRL`, the Ctrl key is reported as *both* +-- Ctrl and Alt due to a Scintilla limitation with GTK+. +-- @field INDICATOR_RELEASE (string) -- Called when the user releases the mouse on text that has an indicator. -- Arguments: --- * `position`: The text position of the release. --- * `KEYPRESS` +-- +-- * `position`: The text position of the release. +-- @field KEYPRESS (string) -- Called when a key is pressed. -- Arguments: --- * `code`: The key code. --- * `shift`: The Shift key is held down. --- * `ctrl`: The Control/Command key is held down. --- * `alt`: The Alt/option key is held down. --- * `meta`: The Control key on Mac OSX is held down. --- * `MARGIN_CLICK` +-- +-- * `code`: The key code. +-- * `shift`: The Shift key is held down. +-- * `ctrl`: The Control/Command key is held down. +-- * `alt`: The Alt/option key is held down. +-- * `meta`: The Control key on Mac OSX is held down. +-- @field MARGIN_CLICK (string) -- Called when the mouse is clicked inside a margin. -- Arguments: --- * `margin`: The margin number that was clicked. --- * `position`: The position of the start of the line in the buffer that --- corresponds to the margin click. --- * `modifiers`: The appropriate combination of --- `_SCINTILLA.constants.SCI_SHIFT`, `_SCINTILLA.constants.SCI_CTRL`, --- and `_SCINTILLA.constants.SCI_ALT` to indicate the keys that were --- held down at the time of the margin click. --- Note: If you set `buffer.rectangular_selection_modifier` to --- `_SCINTILLA.constants.SCMOD_CTRL`, the Ctrl key is reported as *both* --- Ctrl and Alt due to a Scintilla limitation with GTK. --- * `MENU_CLICKED` +-- +-- * `margin`: The margin number that was clicked. +-- * `position`: The position of the start of the line in the buffer that +-- corresponds to the margin click. +-- * `modifiers`: The appropriate combination of +-- `_SCINTILLA.constants.SCI_SHIFT`, `_SCINTILLA.constants.SCI_CTRL`, +-- and `_SCINTILLA.constants.SCI_ALT` to indicate the keys that were held +-- down at the time of the margin click. +-- Note: If you set `buffer.rectangular_selection_modifier` to +-- `_SCINTILLA.constants.SCMOD_CTRL`, the Ctrl key is reported as *both* +-- Ctrl and Alt due to a Scintilla limitation with GTK+. +-- @field MENU_CLICKED (string) -- Called when a menu item is selected. -- Arguments: --- * `menu_id`: The numeric ID of the menu item set in [`gui.gtkmenu()`][]. --- * `QUIT` +-- +-- * `menu_id`: The numeric ID of the menu item set in [`gui.menu()`][]. +-- @field QUIT (string) -- Called when quitting Textadept. -- When connecting to this event, connect with an index of 1 or the handler -- will be ignored. --- * `REPLACE` +-- This is emitted by [`quit()`][]. +-- @field REPLACE (string) -- Called to replace selected (found) text. -- Arguments: --- * `text`: The text to replace selected text with. --- * `REPLACE_ALL` +-- +-- * `text`: The text to replace selected text with. +-- @field REPLACE_ALL (string) -- Called to replace all occurances of found text. -- Arguments: --- * `find_text`: The text to search for. --- * `repl_text`: The text to replace found text with. --- * `RESET_AFTER` +-- +-- * `find_text`: The text to search for. +-- * `repl_text`: The text to replace found text with. +-- @field RESET_AFTER (string) -- Called after resetting the Lua state. --- This is triggered by [`reset()`][]. --- * `RESET_BEFORE` +-- This is emitted by [`reset()`][]. +-- @field RESET_BEFORE (string) -- Called before resetting the Lua state. --- This is triggered by [`reset()`][]. --- * `SAVE_POINT_LEFT` +-- This is emitted by [`reset()`][]. +-- @field SAVE_POINT_LEFT (string) -- Called when a save point is left. --- * `SAVE_POINT_REACHED` +-- @field SAVE_POINT_REACHED (string) -- Called when a save point is entered. --- * `UPDATE_UI` +-- @field UPDATE_UI (string) -- Called when either the text or styling of the buffer has changed or the -- selection range has changed. --- * `URI_DROPPED` +-- @field URI_DROPPED (string) -- Called when the user has dragged a URI such as a file name onto the view. -- Arguments: --- * `text`: The URI text encoded in UTF-8. --- * `USER_LIST_SELECTION` +-- +-- * `text`: The URI text encoded in UTF-8. +-- @field USER_LIST_SELECTION (string) -- Called when the user has selected an item in a user list. -- Arguments: --- * `list_type`: This is set to the list_type parameter from the --- [`buffer:user_list_show()`][] call that initiated the list. --- * `text`: The text of the selection. --- * `position`: The position the list was displayed at. --- * `VIEW_NEW` +-- +-- * `list_type`: This is set to the list_type parameter from the +-- [`buffer:user_list_show()`][] call that initiated the list. +-- * `text`: The text of the selection. +-- * `position`: The position the list was displayed at. +-- @field VIEW_NEW (string) -- Called when a new view is created. --- * `VIEW_BEFORE_SWITCH` +-- This is emitted on startup and by [`view:split()`][]. +-- @field VIEW_BEFORE_SWITCH (string) -- Called right before another view is switched to. --- * `VIEW_AFTER_SWITCH` +-- This is emitted by [`gui.goto_view()`][]. +-- @field VIEW_AFTER_SWITCH (string) -- Called right after another view is switched to. +-- This is emitted by [`gui.goto_view()`][]. -- --- [`buffer:auto_c_cancel()`]: buffer.html#buffer.auto_c_cancel --- [`gui.gtkmenu()`]: gui.html#gtkmenu +-- [`buffer:auto_c_cancel()`]: buffer.html#auto_c_cancel +-- [`view:goto_buffer()`]: view.html#goto_buffer +-- [`new_buffer()`]: _G.html#new_buffer +-- [`buffer:delete()`]: buffer.html#delete +-- [`gui.menu()`]: gui.html#menu +-- [`quit()`]: _G.html#quit -- [`reset()`]: _G.html#reset --- [`buffer:user_list_show()`]: buffer.html#buffer.user_list_show --- --- ## Example --- --- The following Lua code generates and handles a custom `my_event` event: --- --- function my_event_handler(message) --- gui.print(message) --- end --- --- events.connect('my_event', my_event_handler) --- events.emit('my_event', 'my message') -- prints 'my message' to a view +-- [`buffer:user_list_show()`]: buffer.html#user_list_show +-- [`view:split()`]: view.html#split +-- [`gui.goto_view()`]: gui.html#goto_view module('events')]] --- @@ -256,11 +274,12 @@ M.handlers = {} --- -- Adds a handler function to an event. --- @param event The string event name. It is arbitrary and need not be defined --- anywhere. +-- @param event The string event name. It is arbitrary and does not need to be +-- defined previously. -- @param f The Lua function to add. -- @param index Optional index to insert the handler into. -- @return Index of handler. +-- @usage events.connect('my_event', function(message) gui.print(message) end) -- @see disconnect -- @name connect function M.connect(event, f, index) @@ -274,7 +293,7 @@ end --- -- Disconnects a handler function from an event. -- @param event The string event name. --- @param index Index of the handler (returned by `events.connect()`). +-- @param index Index of the handler returned by `events.connect()`. -- @see connect -- @name disconnect function M.disconnect(event, index) @@ -285,14 +304,16 @@ end local error_emitted = false --- --- Calls all handlers for the given event in sequence (effectively "generating" --- the event). +-- Calls all handlers for the given event in sequence. -- If `true` or `false` is explicitly returned by any handler, the event is not --- propagated any further; iteration ceases. --- @param event The string event name. +-- propagated any further; iteration ceases. This is useful if you want to stop +-- the propagation of an event like a keypress. +-- @param event The string event name. It is arbitrary and does not need to be +-- defined previously. -- @param ... Arguments passed to the handler. --- @return `true` or `false` if any handler explicitly returned such; nil +-- @return `true` or `false` if any handler explicitly returned such; `nil` -- otherwise. +-- @usage events.emit('my_event', 'my message') -- @name emit function M.emit(event, ...) if not event then error(_L['Undefined event name']) end diff --git a/core/file_io.lua b/core/file_io.lua index 36417661..0ea94bca 100644 --- a/core/file_io.lua +++ b/core/file_io.lua @@ -2,18 +2,16 @@ --[[ This comment is for LuaDoc. --- --- Extends Lua's io package to provide file input/output routines for Textadept. +-- Extends Lua's `io` package with Textadept functions for working with files. -- -- ## Working with UTF-8 -- --- If your filesystem does not use UTF-8 encoded filenames, conversions to and --- from that encoding are necessary since all of Textadept's internal strings --- are UTF-8 encoded. When opening and saving files through dialogs, these --- conversions are performed autmatically, but if you need to do them manually, --- use [`string.iconv()`][] along with `_CHARSET`, your filesystem's detected --- encoding. --- --- Example: +-- If your filesystem does not use UTF-8 encoded filenames (e.g. Windows), +-- conversions to and from that encoding are necessary since all of Textadept's +-- internal strings are UTF-8 encoded. When opening and saving files through +-- dialogs, these conversions are performed automatically, but if you need to do +-- them manually, use [`string.iconv()`][] along with [`_CHARSET`][], your +-- filesystem's detected encoding. An example is -- -- events.connect(events.FILE_OPENED, function(utf8_filename) -- local filename = utf8_filename:iconv(_CHARSET, 'UTF-8') @@ -23,25 +21,33 @@ -- end) -- -- [`string.iconv()`]: string.html#iconv +-- [`_CHARSET`]: _G.html#_CHARSET -- -- ## File Events -- -- * `_G.events.FILE_OPENED` -- Called when a file is opened in a new buffer. +-- This is emitted by [`open_file()`](#open_file) -- Arguments: -- * `filename`: The filename encoded in UTF-8. -- * `_G.events.FILE_BEFORE_SAVE` -- Called right before a file is saved to disk. +-- This is emitted by [`buffer:save()`][] -- Arguments: -- * `filename`: The filename encoded in UTF-8. -- * `_G.events.FILE_AFTER_SAVE` -- Called right after a file is saved to disk. +-- This is emitted by [`buffer:save()`][] -- Arguments: -- * `filename`: The filename encoded in UTF-8. -- * `_G.events.FILE_SAVED_AS` -- Called when a file is saved under a different filename. +-- This is emitted by [`buffer:save_as()`][] -- Arguments: -- * `filename`: The filename encoded in UTF-8. +-- +-- [`buffer:save()`]: buffer.html#save +-- [`buffer:save_as()`]: buffer.html#save_as module('io')]] -- Events. @@ -59,7 +65,7 @@ events.FILE_SAVED_AS = 'file_saved_as' io.recent_files = {} --- --- List of byte-order marks (BOMs). +-- List of byte-order marks (BOMs) for identifying unicode file types. -- @class table -- @name boms io.boms = { @@ -94,16 +100,23 @@ local function detect_encoding(text) end --- --- List of encodings to try to decode files as after UTF-8. +-- List of encodings to try 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][]. +-- +-- [GNU iconv's encodings]: http://www.gnu.org/software/libiconv/ -- @class table -- @name try_encodings io.try_encodings = { 'UTF-8', 'ASCII', 'ISO-8859-1', 'MacRoman' } --- -- Opens a list of files. +-- Emits a `FILE_OPENED` event. -- @param utf8_filenames A `\n` separated list of UTF-8-encoded filenames to -- open. If `nil`, the user is prompted with a fileselect dialog. -- @usage io.open_file(utf8_encoded_filename) +-- @see _G.events -- @name open_file function io.open_file(utf8_filenames) utf8_filenames = utf8_filenames or @@ -259,6 +272,7 @@ end --- -- Saves all dirty buffers to their respective files. -- @usage io.save_all() +-- @see buffer.save -- @name save_all function io.save_all() local current_buffer = _BUFFERS[buffer] @@ -281,7 +295,7 @@ local function close(buffer) '--button1', _L['_Cancel'], '--button2', _L['Close _without saving'], '--no-newline') ~= '2' then - return false + return nil -- returning false can cause unwanted key command propagation end buffer:delete() return true @@ -293,6 +307,7 @@ end -- saved automatically. They must be saved manually. -- @usage io.close_all() -- @return `true` if user did not cancel. +-- @see buffer.close -- @name close_all function io.close_all() while #_BUFFERS > 1 do diff --git a/core/gui.lua b/core/gui.lua index 4431d350..c6170a8b 100644 --- a/core/gui.lua +++ b/core/gui.lua @@ -3,17 +3,18 @@ local gui = gui --[[ This comment is for LuaDoc. ---- The core gui table. +--- +-- Utilities for Textadept's user interface. -- @field title (string, Write-only) -- The title of the Textadept window. -- @field context_menu --- A `gui.menu` defining the editor's context menu. +-- A [`gui.menu`](#menu) defining the editor's context menu. -- @field clipboard_text (string, Read-only) -- The text on the clipboard. -- @field statusbar_text (string, Write-only) -- The text displayed by the statusbar. -- @field docstatusbar_text (string, Write-only) --- The text displayed by the doc statusbar. +-- The text displayed by the buffer statusbar. module('gui')]] local _L = _L @@ -45,10 +46,10 @@ local function _print(buffer_type, ...) end --- -- Helper function for printing messages to buffers. --- Splits the view and opens a new buffer for printing messages. If the message --- buffer is already open and a view is currently showing it, the message is --- printed to that view. Otherwise the view is split, goes to the open message --- buffer, and prints to it. +-- Splits the view and opens a new buffer for printing messages to. If the +-- message buffer is already open in a view, the message is printed to that +-- view. Otherwise the view is split and the message buffer is opened or +-- displayed before being printed to. -- @param buffer_type String type of message buffer. -- @param ... Message strings. -- @usage gui._print(_L['[Error Buffer]'], error_message) @@ -58,26 +59,27 @@ function gui._print(buffer_type, ...) pcall(_print, buffer_type, ...) end --- -- Prints messages to the Textadept message buffer. --- Opens a new buffer (if one has not already been opened) for printing --- messages. +-- Opens a new buffer if one has not already been opened for printing messages. -- @param ... Message strings. -- @name print function gui.print(...) gui._print(_L['[Message Buffer]'], ...) end --- --- Shortcut function for `gui.dialog('filtered_list', ...)` with 'Ok' and +-- Shortcut function for `gui.dialog('filteredlist', ...)` with 'Ok' and -- 'Cancel' buttons. --- @param title The title for the filteredlist dialog. +-- @param title The title for the filtered list dialog. -- @param columns A column name or list of column names. -- @param items An item or list of items. -- @param int_return If `true`, returns the integer index of the selected item --- in the filteredlist. The default value is `false`, which returns the string --- item. Not compatible with a `'--select-multiple'` filteredlist. +-- in the filtered list and is not compatible with the `'--select-multiple'` +-- option. The default value is `false`, which returns the string item(s). -- @param ... Additional parameters to pass to `gui.dialog()`. --- @return Either a string or integer on success; `nil` otherwise. +-- @return Either a string or integer on success; `nil` otherwise. In strings, +-- multiple items are separated by newlines. -- @usage gui.filteredlist('Title', 'Foo', { 'Bar', 'Baz' }) -- @usage gui.filteredlist('Title', { 'Foo', 'Bar' }, { 'a', 'b', 'c', 'd' }, -- false, '--output-column', '2') +-- @see dialog -- @name filteredlist function gui.filteredlist(title, columns, items, int_return, ...) local out = gui.dialog('filteredlist', @@ -151,11 +153,11 @@ local theme_file = not NCURSES and 'theme' or 'theme_term' local THEME --- -- Sets the editor theme from the given name. --- Themes in `_USERHOME/themes/` are checked first, followed by `_HOME/themes/`. --- If the name contains slashes ('/' on Linux and Mac OSX and '\' on Win32), it --- is assumed to be an absolute path so `_USERHOME` and `_HOME` are not checked. --- Throws an error if the theme is not found. Any errors in the theme are --- printed to `io.stderr`. +-- Themes with the given name in the `_USERHOME/themes/` directory override +-- themes of the same name in `_HOME/themes/`. If the name contains slashes (`\` +-- on Windows, `/` otherwise), it is assumed to be an absolute path to a theme +-- instead of a theme name. An error is thrown if the theme is not found. Any +-- errors in the theme are printed to `io.stderr`. -- @param name The name or absolute path of a theme. If nil, sets the default -- theme. -- @name set_theme @@ -210,7 +212,8 @@ function gui.set_theme(name) end --- --- Prompts the user to select an editor theme from a filtered list. +-- Prompts the user to select an editor theme from a filtered list dialog. +-- Themes in the `_HOME/themes/` and `_USERHOME/themes/` directories are listed. -- @name select_theme function gui.select_theme() local themes, themes_found = {}, {} @@ -425,12 +428,13 @@ events_connect(events.ERROR, --- -- A table of menus defining a menubar. (Write-only) +-- @see _M.textadept.menu.set_menubar -- @class table -- @name menubar local menubar --- --- The size of the Textadept window (`{ width, height }`). +-- A table containing the width and height values of the Textadept window. -- @class table -- @name size local size @@ -438,12 +442,13 @@ local size The functions below are Lua C functions. --- --- Displays a gtdialog of a specified type with the given string arguments. +-- Displays a [gtdialog][1] of a specified type with the given string arguments. -- Each argument is like a string in Lua's `arg` table. Tables of strings are -- allowed as arguments and are expanded in place. This is useful for --- filteredlist dialogs with many items. --- For more information on gtdialog, see [http://foicica.com/gtdialog]( --- http://foicica.com/gtdialog). +-- filtered list dialogs with many items. +-- For more information on gtdialog, see [http://foicica.com/gtdialog][1]. +-- +-- [1]: http://foicica.com/gtdialog -- @param kind The kind of gtdialog. -- @param ... Parameters to the gtdialog. -- @return string gtdialog result. @@ -453,6 +458,7 @@ local dialog --- -- Gets the 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 @@ -464,16 +470,22 @@ local get_split_table --- -- Goes to the specified view. --- Generates `VIEW_BEFORE_SWITCH` and `VIEW_AFTER_SWITCH` events. --- @param n A relative or absolute view index. +-- Emits `VIEW_BEFORE_SWITCH` and `VIEW_AFTER_SWITCH` events. +-- @param n A relative or absolute view index in `_G._VIEWS`. -- @param relative Flag indicating if n is a relative index or not. The default -- value is `false`. +-- @see _G._G._VIEWS +-- @see events.VIEW_BEFORE_SWITCH +-- @see events.VIEW_AFTER_SWITCH -- @class function -- @name goto_view local goto_view --- -- Creates a menu, returning the userdata. +-- This is a low-level function. You probably want to use the higher-level +-- `_M.textadept.menu.set_menubar()` or `_M.textadept.menu.set_contextmenu()` +-- functions. 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 @@ -481,8 +493,10 @@ local goto_view -- empty, a menu separator item is created. Submenus are just nested -- menu-structure tables. Their title text is defined with a `title` key. -- @usage gui.menu{ { '_New', 1 }, { '_Open', 2 }, { '' }, { '_Quit', 4 } } --- @usage gui.menu{ { '_New', 1, keys.get_gdk_key('cn') } } --- @see keys.get_gdk_key +-- @usage gui.menu{ { '_New', 1, string.byte('n'), 4 } } -- 'Ctrl+N' +-- @see events.MENU_CLICKED +-- @see _M.textadept.menu.set_menubar +-- @see _M.textadept.menu.set_contextmenu -- @class function -- @name menu local menu diff --git a/core/iface.lua b/core/iface.lua index 84aaf241..db6d0f85 100644 --- a/core/iface.lua +++ b/core/iface.lua @@ -5,23 +5,42 @@ local M = {} --[[ This comment is for LuaDoc. --- -- Scintilla constants, functions, and properties. --- Do not modify anything in this module. Doing so will result in instability. +-- Do not modify anything in this module. Doing so will have unpredicable +-- consequences. module('_SCINTILLA')]] --- -- Scintilla constants. +-- Each key is a Scintilla constant with its associated numeric value. -- @class table -- @name constants M.constants = {ANNOTATION_BOXED=2,ANNOTATION_HIDDEN=0,ANNOTATION_STANDARD=1,CARETSTYLE_BLOCK=2,CARETSTYLE_INVISIBLE=0,CARETSTYLE_LINE=1,CARET_EVEN=0x08,CARET_JUMPS=0x10,CARET_SLOP=0x01,CARET_STRICT=0x04,EDGE_BACKGROUND=2,EDGE_LINE=1,EDGE_NONE=0,INDIC0_MASK=0x20,INDIC1_MASK=0x40,INDIC2_MASK=0x80,INDICS_MASK=0xE0,INDIC_BOX=6,INDIC_CONTAINER=8,INDIC_DASH=9,INDIC_DIAGONAL=3,INDIC_DOTBOX=12,INDIC_DOTS=10,INDIC_HIDDEN=5,INDIC_MAX=31,INDIC_PLAIN=0,INDIC_ROUNDBOX=7,INDIC_SQUIGGLE=1,INDIC_SQUIGGLELOW=11,INDIC_SQUIGGLEPIXMAP=13,INDIC_STRAIGHTBOX=8,INDIC_STRIKE=4,INDIC_TT=2,INVALID_POSITION=-1,KEYWORDSET_MAX=8,MARKER_MAX=31,SCEN_CHANGE=768,SCEN_KILLFOCUS=256,SCEN_SETFOCUS=512,SCFIND_MATCHCASE=4,SCFIND_POSIX=0x00400000,SCFIND_REGEXP=0x00200000,SCFIND_WHOLEWORD=2,SCFIND_WORDSTART=0x00100000,SCI_ANNOTATIONGETLINES=2546,SCI_ANNOTATIONGETSTYLE=2543,SCI_ANNOTATIONGETSTYLEOFFSET=2551,SCI_ANNOTATIONGETSTYLES=2545,SCI_ANNOTATIONGETTEXT=2541,SCI_ANNOTATIONGETVISIBLE=2549,SCI_ANNOTATIONSETSTYLE=2542,SCI_ANNOTATIONSETSTYLEOFFSET=2550,SCI_ANNOTATIONSETSTYLES=2544,SCI_ANNOTATIONSETTEXT=2540,SCI_ANNOTATIONSETVISIBLE=2548,SCI_AUTOCGETAUTOHIDE=2119,SCI_AUTOCGETCANCELATSTART=2111,SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR=2635,SCI_AUTOCGETCHOOSESINGLE=2114,SCI_AUTOCGETCURRENT=2445,SCI_AUTOCGETCURRENTTEXT=2610,SCI_AUTOCGETDROPRESTOFWORD=2271,SCI_AUTOCGETIGNORECASE=2116,SCI_AUTOCGETMAXHEIGHT=2211,SCI_AUTOCGETMAXWIDTH=2209,SCI_AUTOCGETSEPARATOR=2107,SCI_AUTOCGETTYPESEPARATOR=2285,SCI_AUTOCSETAUTOHIDE=2118,SCI_AUTOCSETCANCELATSTART=2110,SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR=2634,SCI_AUTOCSETCHOOSESINGLE=2113,SCI_AUTOCSETDROPRESTOFWORD=2270,SCI_AUTOCSETFILLUPS=2112,SCI_AUTOCSETIGNORECASE=2115,SCI_AUTOCSETMAXHEIGHT=2210,SCI_AUTOCSETMAXWIDTH=2208,SCI_AUTOCSETSEPARATOR=2106,SCI_AUTOCSETTYPESEPARATOR=2286,SCI_CALLTIPSETBACK=2205,SCI_CALLTIPSETFORE=2206,SCI_CALLTIPSETFOREHLT=2207,SCI_CALLTIPSETPOSITION=2213,SCI_CALLTIPUSESTYLE=2212,SCI_GETADDITIONALCARETFORE=2605,SCI_GETADDITIONALCARETSBLINK=2568,SCI_GETADDITIONALCARETSVISIBLE=2609,SCI_GETADDITIONALSELALPHA=2603,SCI_GETADDITIONALSELECTIONTYPING=2566,SCI_GETALLLINESVISIBLE=2236,SCI_GETANCHOR=2009,SCI_GETBACKSPACEUNINDENTS=2263,SCI_GETBUFFEREDDRAW=2034,SCI_GETCARETFORE=2138,SCI_GETCARETLINEBACK=2097,SCI_GETCARETLINEBACKALPHA=2471,SCI_GETCARETLINEVISIBLE=2095,SCI_GETCARETPERIOD=2075,SCI_GETCARETSTICKY=2457,SCI_GETCARETSTYLE=2513,SCI_GETCARETWIDTH=2189,SCI_GETCHARACTERPOINTER=2520,SCI_GETCHARAT=2007,SCI_GETCODEPAGE=2137,SCI_GETCOLUMN=2129,SCI_GETCONTROLCHARSYMBOL=2389,SCI_GETCURRENTPOS=2008,SCI_GETCURSOR=2387,SCI_GETDIRECTFUNCTION=2184,SCI_GETDIRECTPOINTER=2185,SCI_GETDOCPOINTER=2357,SCI_GETEDGECOLOUR=2364,SCI_GETEDGECOLUMN=2360,SCI_GETEDGEMODE=2362,SCI_GETENDATLASTLINE=2278,SCI_GETENDSTYLED=2028,SCI_GETEOLMODE=2030,SCI_GETEXTRAASCENT=2526,SCI_GETEXTRADESCENT=2528,SCI_GETFIRSTVISIBLELINE=2152,SCI_GETFOCUS=2381,SCI_GETFOLDEXPANDED=2230,SCI_GETFOLDLEVEL=2223,SCI_GETFOLDPARENT=2225,SCI_GETFONTQUALITY=2612,SCI_GETGAPPOSITION=2644,SCI_GETHIGHLIGHTGUIDE=2135,SCI_GETHOTSPOTACTIVEUNDERLINE=2496,SCI_GETHOTSPOTSINGLELINE=2497,SCI_GETHSCROLLBAR=2131,SCI_GETIDENTIFIER=2623,SCI_GETINDENT=2123,SCI_GETINDENTATIONGUIDES=2133,SCI_GETINDICATORCURRENT=2501,SCI_GETINDICATORVALUE=2503,SCI_GETKEYSUNICODE=2522,SCI_GETLAYOUTCACHE=2273,SCI_GETLENGTH=2006,SCI_GETLEXER=4002,SCI_GETLEXERLANGUAGE=4012,SCI_GETLINECOUNT=2154,SCI_GETLINEENDPOSITION=2136,SCI_GETLINEINDENTATION=2127,SCI_GETLINEINDENTPOSITION=2128,SCI_GETLINESTATE=2093,SCI_GETLINEVISIBLE=2228,SCI_GETMAINSELECTION=2575,SCI_GETMARGINCURSORN=2249,SCI_GETMARGINLEFT=2156,SCI_GETMARGINMASKN=2245,SCI_GETMARGINOPTIONS=2557,SCI_GETMARGINRIGHT=2158,SCI_GETMARGINSENSITIVEN=2247,SCI_GETMARGINTYPEN=2241,SCI_GETMARGINWIDTHN=2243,SCI_GETMAXLINESTATE=2094,SCI_GETMODEVENTMASK=2378,SCI_GETMODIFY=2159,SCI_GETMOUSEDOWNCAPTURES=2385,SCI_GETMOUSEDWELLTIME=2265,SCI_GETMULTIPASTE=2615,SCI_GETMULTIPLESELECTION=2564,SCI_GETOVERTYPE=2187,SCI_GETPASTECONVERTENDINGS=2468,SCI_GETPOSITIONCACHE=2515,SCI_GETPRINTCOLOURMODE=2149,SCI_GETPRINTMAGNIFICATION=2147,SCI_GETPRINTWRAPMODE=2407,SCI_GETPROPERTY=4008,SCI_GETPROPERTYEXPANDED=4009,SCI_GETPROPERTYINT=4010,SCI_GETPUNCTUATIONCHARS=2649,SCI_GETREADONLY=2140,SCI_GETRECTANGULARSELECTIONANCHOR=2591,SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE=2595,SCI_GETRECTANGULARSELECTIONCARET=2589,SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE=2593,SCI_GETRECTANGULARSELECTIONMODIFIER=2599,SCI_GETSCROLLWIDTH=2275,SCI_GETSCROLLWIDTHTRACKING=2517,SCI_GETSEARCHFLAGS=2199,SCI_GETSELALPHA=2477,SCI_GETSELECTIONEMPTY=2650,SCI_GETSELECTIONEND=2145,SCI_GETSELECTIONMODE=2423,SCI_GETSELECTIONNANCHOR=2579,SCI_GETSELECTIONNANCHORVIRTUALSPACE=2583,SCI_GETSELECTIONNCARET=2577,SCI_GETSELECTIONNCARETVIRTUALSPACE=2581,SCI_GETSELECTIONNEND=2587,SCI_GETSELECTIONNSTART=2585,SCI_GETSELECTIONS=2570,SCI_GETSELECTIONSTART=2143,SCI_GETSELEOLFILLED=2479,SCI_GETSTATUS=2383,SCI_GETSTYLEAT=2010,SCI_GETSTYLEBITS=2091,SCI_GETSTYLEBITSNEEDED=4011,SCI_GETTABINDENTS=2261,SCI_GETTABWIDTH=2121,SCI_GETTAG=2616,SCI_GETTARGETEND=2193,SCI_GETTARGETSTART=2191,SCI_GETTECHNOLOGY=2631,SCI_GETTEXTLENGTH=2183,SCI_GETTWOPHASEDRAW=2283,SCI_GETUNDOCOLLECTION=2019,SCI_GETUSETABS=2125,SCI_GETVIEWEOL=2355,SCI_GETVIEWWS=2020,SCI_GETVIRTUALSPACEOPTIONS=2597,SCI_GETVSCROLLBAR=2281,SCI_GETWHITESPACECHARS=2647,SCI_GETWHITESPACESIZE=2087,SCI_GETWORDCHARS=2646,SCI_GETWRAPINDENTMODE=2473,SCI_GETWRAPMODE=2269,SCI_GETWRAPSTARTINDENT=2465,SCI_GETWRAPVISUALFLAGS=2461,SCI_GETWRAPVISUALFLAGSLOCATION=2463,SCI_GETXOFFSET=2398,SCI_GETZOOM=2374,SCI_INDICGETALPHA=2524,SCI_INDICGETFORE=2083,SCI_INDICGETOUTLINEALPHA=2559,SCI_INDICGETSTYLE=2081,SCI_INDICGETUNDER=2511,SCI_INDICSETALPHA=2523,SCI_INDICSETFORE=2082,SCI_INDICSETOUTLINEALPHA=2558,SCI_INDICSETSTYLE=2080,SCI_INDICSETUNDER=2510,SCI_LEXER_START=4000,SCI_LINESONSCREEN=2370,SCI_MARGINGETSTYLE=2533,SCI_MARGINGETSTYLEOFFSET=2538,SCI_MARGINGETSTYLES=2535,SCI_MARGINGETTEXT=2531,SCI_MARGINSETSTYLE=2532,SCI_MARGINSETSTYLEOFFSET=2537,SCI_MARGINSETSTYLES=2534,SCI_MARGINSETTEXT=2530,SCI_MARKERSETALPHA=2476,SCI_MARKERSETBACK=2042,SCI_MARKERSETBACKSELECTED=2292,SCI_MARKERSETFORE=2041,SCI_OPTIONAL_START=3000,SCI_RGBAIMAGESETHEIGHT=2625,SCI_RGBAIMAGESETSCALE=2651,SCI_RGBAIMAGESETWIDTH=2624,SCI_SELECTIONISRECTANGLE=2372,SCI_SETADDITIONALCARETFORE=2604,SCI_SETADDITIONALCARETSBLINK=2567,SCI_SETADDITIONALCARETSVISIBLE=2608,SCI_SETADDITIONALSELALPHA=2602,SCI_SETADDITIONALSELBACK=2601,SCI_SETADDITIONALSELECTIONTYPING=2565,SCI_SETADDITIONALSELFORE=2600,SCI_SETANCHOR=2026,SCI_SETBACKSPACEUNINDENTS=2262,SCI_SETBUFFEREDDRAW=2035,SCI_SETCARETFORE=2069,SCI_SETCARETLINEBACK=2098,SCI_SETCARETLINEBACKALPHA=2470,SCI_SETCARETLINEVISIBLE=2096,SCI_SETCARETPERIOD=2076,SCI_SETCARETSTICKY=2458,SCI_SETCARETSTYLE=2512,SCI_SETCARETWIDTH=2188,SCI_SETCODEPAGE=2037,SCI_SETCONTROLCHARSYMBOL=2388,SCI_SETCURRENTPOS=2141,SCI_SETCURSOR=2386,SCI_SETDOCPOINTER=2358,SCI_SETEDGECOLOUR=2365,SCI_SETEDGECOLUMN=2361,SCI_SETEDGEMODE=2363,SCI_SETENDATLASTLINE=2277,SCI_SETEOLMODE=2031,SCI_SETEXTRAASCENT=2525,SCI_SETEXTRADESCENT=2527,SCI_SETFIRSTVISIBLELINE=2613,SCI_SETFOCUS=2380,SCI_SETFOLDEXPANDED=2229,SCI_SETFOLDFLAGS=2233,SCI_SETFOLDLEVEL=2222,SCI_SETFONTQUALITY=2611,SCI_SETHIGHLIGHTGUIDE=2134,SCI_SETHOTSPOTACTIVEUNDERLINE=2412,SCI_SETHOTSPOTSINGLELINE=2421,SCI_SETHSCROLLBAR=2130,SCI_SETIDENTIFIER=2622,SCI_SETINDENT=2122,SCI_SETINDENTATIONGUIDES=2132,SCI_SETINDICATORCURRENT=2500,SCI_SETINDICATORVALUE=2502,SCI_SETKEYSUNICODE=2521,SCI_SETKEYWORDS=4005,SCI_SETLAYOUTCACHE=2272,SCI_SETLEXER=4001,SCI_SETLEXERLANGUAGE=4006,SCI_SETLINEINDENTATION=2126,SCI_SETLINESTATE=2092,SCI_SETMAINSELECTION=2574,SCI_SETMARGINCURSORN=2248,SCI_SETMARGINLEFT=2155,SCI_SETMARGINMASKN=2244,SCI_SETMARGINOPTIONS=2539,SCI_SETMARGINRIGHT=2157,SCI_SETMARGINSENSITIVEN=2246,SCI_SETMARGINTYPEN=2240,SCI_SETMARGINWIDTHN=2242,SCI_SETMODEVENTMASK=2359,SCI_SETMOUSEDOWNCAPTURES=2384,SCI_SETMOUSEDWELLTIME=2264,SCI_SETMULTIPASTE=2614,SCI_SETMULTIPLESELECTION=2563,SCI_SETOVERTYPE=2186,SCI_SETPASTECONVERTENDINGS=2467,SCI_SETPOSITIONCACHE=2514,SCI_SETPRINTCOLOURMODE=2148,SCI_SETPRINTMAGNIFICATION=2146,SCI_SETPRINTWRAPMODE=2406,SCI_SETPROPERTY=4004,SCI_SETPUNCTUATIONCHARS=2648,SCI_SETREADONLY=2171,SCI_SETRECTANGULARSELECTIONANCHOR=2590,SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE=2594,SCI_SETRECTANGULARSELECTIONCARET=2588,SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE=2592,SCI_SETRECTANGULARSELECTIONMODIFIER=2598,SCI_SETSCROLLWIDTH=2274,SCI_SETSCROLLWIDTHTRACKING=2516,SCI_SETSEARCHFLAGS=2198,SCI_SETSELALPHA=2478,SCI_SETSELECTIONEND=2144,SCI_SETSELECTIONMODE=2422,SCI_SETSELECTIONNANCHOR=2578,SCI_SETSELECTIONNANCHORVIRTUALSPACE=2582,SCI_SETSELECTIONNCARET=2576,SCI_SETSELECTIONNCARETVIRTUALSPACE=2580,SCI_SETSELECTIONNEND=2586,SCI_SETSELECTIONNSTART=2584,SCI_SETSELECTIONSTART=2142,SCI_SETSELEOLFILLED=2480,SCI_SETSTATUS=2382,SCI_SETSTYLEBITS=2090,SCI_SETTABINDENTS=2260,SCI_SETTABWIDTH=2036,SCI_SETTARGETEND=2192,SCI_SETTARGETSTART=2190,SCI_SETTECHNOLOGY=2630,SCI_SETTWOPHASEDRAW=2284,SCI_SETUNDOCOLLECTION=2012,SCI_SETUSETABS=2124,SCI_SETVIEWEOL=2356,SCI_SETVIEWWS=2021,SCI_SETVIRTUALSPACEOPTIONS=2596,SCI_SETVSCROLLBAR=2280,SCI_SETWHITESPACECHARS=2443,SCI_SETWHITESPACESIZE=2086,SCI_SETWORDCHARS=2077,SCI_SETWRAPINDENTMODE=2472,SCI_SETWRAPMODE=2268,SCI_SETWRAPSTARTINDENT=2464,SCI_SETWRAPVISUALFLAGS=2460,SCI_SETWRAPVISUALFLAGSLOCATION=2462,SCI_SETXOFFSET=2397,SCI_SETZOOM=2373,SCI_START=2000,SCI_STYLEGETBACK=2482,SCI_STYLEGETBOLD=2483,SCI_STYLEGETCASE=2489,SCI_STYLEGETCHANGEABLE=2492,SCI_STYLEGETCHARACTERSET=2490,SCI_STYLEGETEOLFILLED=2487,SCI_STYLEGETFONT=2486,SCI_STYLEGETFORE=2481,SCI_STYLEGETHOTSPOT=2493,SCI_STYLEGETITALIC=2484,SCI_STYLEGETSIZE=2485,SCI_STYLEGETSIZEFRACTIONAL=2062,SCI_STYLEGETUNDERLINE=2488,SCI_STYLEGETVISIBLE=2491,SCI_STYLEGETWEIGHT=2064,SCI_STYLESETBACK=2052,SCI_STYLESETBOLD=2053,SCI_STYLESETCASE=2060,SCI_STYLESETCHANGEABLE=2099,SCI_STYLESETCHARACTERSET=2066,SCI_STYLESETEOLFILLED=2057,SCI_STYLESETFONT=2056,SCI_STYLESETFORE=2051,SCI_STYLESETHOTSPOT=2409,SCI_STYLESETITALIC=2054,SCI_STYLESETSIZE=2055,SCI_STYLESETSIZEFRACTIONAL=2061,SCI_STYLESETUNDERLINE=2059,SCI_STYLESETVISIBLE=2074,SCI_STYLESETWEIGHT=2063,SCK_ADD=310,SCK_BACK=8,SCK_DELETE=308,SCK_DIVIDE=312,SCK_DOWN=300,SCK_END=305,SCK_ESCAPE=7,SCK_HOME=304,SCK_INSERT=309,SCK_LEFT=302,SCK_MENU=315,SCK_NEXT=307,SCK_PRIOR=306,SCK_RETURN=13,SCK_RIGHT=303,SCK_RWIN=314,SCK_SUBTRACT=311,SCK_TAB=9,SCK_UP=301,SCK_WIN=313,SCMOD_ALT=4,SCMOD_CTRL=2,SCMOD_META=16,SCMOD_NORM=0,SCMOD_SHIFT=1,SCMOD_SUPER=8,SCVS_NONE=0,SCVS_RECTANGULARSELECTION=1,SCVS_USERACCESSIBLE=2,SCWS_INVISIBLE=0,SCWS_VISIBLEAFTERINDENT=2,SCWS_VISIBLEALWAYS=1,SC_ALPHA_NOALPHA=256,SC_ALPHA_OPAQUE=255,SC_ALPHA_TRANSPARENT=0,SC_CACHE_CARET=1,SC_CACHE_DOCUMENT=3,SC_CACHE_NONE=0,SC_CACHE_PAGE=2,SC_CARETSTICKY_OFF=0,SC_CARETSTICKY_ON=1,SC_CARETSTICKY_WHITESPACE=2,SC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE=1,SC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE=0,SC_CASE_LOWER=2,SC_CASE_MIXED=0,SC_CASE_UPPER=1,SC_CHARSET_8859_15=1000,SC_CHARSET_ANSI=0,SC_CHARSET_ARABIC=178,SC_CHARSET_BALTIC=186,SC_CHARSET_CHINESEBIG5=136,SC_CHARSET_CYRILLIC=1251,SC_CHARSET_DEFAULT=1,SC_CHARSET_EASTEUROPE=238,SC_CHARSET_GB2312=134,SC_CHARSET_GREEK=161,SC_CHARSET_HANGUL=129,SC_CHARSET_HEBREW=177,SC_CHARSET_JOHAB=130,SC_CHARSET_MAC=77,SC_CHARSET_OEM=255,SC_CHARSET_RUSSIAN=204,SC_CHARSET_SHIFTJIS=128,SC_CHARSET_SYMBOL=2,SC_CHARSET_THAI=222,SC_CHARSET_TURKISH=162,SC_CHARSET_VIETNAMESE=163,SC_CP_UTF8=65001,SC_CURSORARROW=2,SC_CURSORNORMAL=-1,SC_CURSORREVERSEARROW=7,SC_CURSORWAIT=4,SC_EFF_QUALITY_ANTIALIASED=2,SC_EFF_QUALITY_DEFAULT=0,SC_EFF_QUALITY_LCD_OPTIMIZED=3,SC_EFF_QUALITY_MASK=0xF,SC_EFF_QUALITY_NON_ANTIALIASED=1,SC_EOL_CR=1,SC_EOL_CRLF=0,SC_EOL_LF=2,SC_FOLDFLAG_LEVELNUMBERS=0x0040,SC_FOLDFLAG_LINEAFTER_CONTRACTED=0x0010,SC_FOLDFLAG_LINEAFTER_EXPANDED=0x0008,SC_FOLDFLAG_LINEBEFORE_CONTRACTED=0x0004,SC_FOLDFLAG_LINEBEFORE_EXPANDED=0x0002,SC_FOLDLEVELBASE=0x400,SC_FOLDLEVELHEADERFLAG=0x2000,SC_FOLDLEVELNUMBERMASK=0x0FFF,SC_FOLDLEVELWHITEFLAG=0x1000,SC_FONT_SIZE_MULTIPLIER=100,SC_IV_LOOKBOTH=3,SC_IV_LOOKFORWARD=2,SC_IV_NONE=0,SC_IV_REAL=1,SC_LASTSTEPINUNDOREDO=0x100,SC_MARGINOPTION_NONE=0,SC_MARGINOPTION_SUBLINESELECT=1,SC_MARGIN_BACK=2,SC_MARGIN_FORE=3,SC_MARGIN_NUMBER=1,SC_MARGIN_RTEXT=5,SC_MARGIN_SYMBOL=0,SC_MARGIN_TEXT=4,SC_MARKNUM_FOLDER=30,SC_MARKNUM_FOLDEREND=25,SC_MARKNUM_FOLDERMIDTAIL=27,SC_MARKNUM_FOLDEROPEN=31,SC_MARKNUM_FOLDEROPENMID=26,SC_MARKNUM_FOLDERSUB=29,SC_MARKNUM_FOLDERTAIL=28,SC_MARK_ARROW=2,SC_MARK_ARROWDOWN=6,SC_MARK_ARROWS=24,SC_MARK_AVAILABLE=28,SC_MARK_BACKGROUND=22,SC_MARK_BOXMINUS=14,SC_MARK_BOXMINUSCONNECTED=15,SC_MARK_BOXPLUS=12,SC_MARK_BOXPLUSCONNECTED=13,SC_MARK_CHARACTER=10000,SC_MARK_CIRCLE=0,SC_MARK_CIRCLEMINUS=20,SC_MARK_CIRCLEMINUSCONNECTED=21,SC_MARK_CIRCLEPLUS=18,SC_MARK_CIRCLEPLUSCONNECTED=19,SC_MARK_DOTDOTDOT=23,SC_MARK_EMPTY=5,SC_MARK_FULLRECT=26,SC_MARK_LCORNER=10,SC_MARK_LCORNERCURVE=16,SC_MARK_LEFTRECT=27,SC_MARK_MINUS=7,SC_MARK_PIXMAP=25,SC_MARK_PLUS=8,SC_MARK_RGBAIMAGE=30,SC_MARK_ROUNDRECT=1,SC_MARK_SHORTARROW=4,SC_MARK_SMALLRECT=3,SC_MARK_TCORNER=11,SC_MARK_TCORNERCURVE=17,SC_MARK_UNDERLINE=29,SC_MARK_VLINE=9,SC_MASK_FOLDERS=-33554432,SC_MODEVENTMASKALL=0xFFFFF,SC_MOD_BEFOREDELETE=0x800,SC_MOD_BEFOREINSERT=0x400,SC_MOD_CHANGEANNOTATION=0x20000,SC_MOD_CHANGEFOLD=0x8,SC_MOD_CHANGEINDICATOR=0x4000,SC_MOD_CHANGELINESTATE=0x8000,SC_MOD_CHANGEMARGIN=0x10000,SC_MOD_CHANGEMARKER=0x200,SC_MOD_CHANGESTYLE=0x4,SC_MOD_CONTAINER=0x40000,SC_MOD_DELETETEXT=0x2,SC_MOD_INSERTTEXT=0x1,SC_MOD_LEXERSTATE=0x80000,SC_MULTILINEUNDOREDO=0x1000,SC_MULTIPASTE_EACH=1,SC_MULTIPASTE_ONCE=0,SC_MULTISTEPUNDOREDO=0x80,SC_PERFORMED_REDO=0x40,SC_PERFORMED_UNDO=0x20,SC_PERFORMED_USER=0x10,SC_PRINT_BLACKONWHITE=2,SC_PRINT_COLOURONWHITE=3,SC_PRINT_COLOURONWHITEDEFAULTBG=4,SC_PRINT_INVERTLIGHT=1,SC_PRINT_NORMAL=0,SC_SEL_LINES=2,SC_SEL_RECTANGLE=1,SC_SEL_STREAM=0,SC_SEL_THIN=3,SC_STARTACTION=0x2000,SC_STATUS_BADALLOC=2,SC_STATUS_FAILURE=1,SC_STATUS_OK=0,SC_TECHNOLOGY_DEFAULT=0,SC_TECHNOLOGY_DIRECTWRITE=1,SC_TIME_FOREVER=10000000,SC_TYPE_BOOLEAN=0,SC_TYPE_INTEGER=1,SC_TYPE_STRING=2,SC_UPDATE_CONTENT=0x1,SC_UPDATE_H_SCROLL=0x8,SC_UPDATE_SELECTION=0x2,SC_UPDATE_V_SCROLL=0x4,SC_WEIGHT_BOLD=700,SC_WEIGHT_NORMAL=400,SC_WEIGHT_SEMIBOLD=600,SC_WRAPINDENT_FIXED=0,SC_WRAPINDENT_INDENT=2,SC_WRAPINDENT_SAME=1,SC_WRAPVISUALFLAGLOC_DEFAULT=0x0000,SC_WRAPVISUALFLAGLOC_END_BY_TEXT=0x0001,SC_WRAPVISUALFLAGLOC_START_BY_TEXT=0x0002,SC_WRAPVISUALFLAG_END=0x0001,SC_WRAPVISUALFLAG_MARGIN=0x0004,SC_WRAPVISUALFLAG_NONE=0x0000,SC_WRAPVISUALFLAG_START=0x0002,SC_WRAP_CHAR=2,SC_WRAP_NONE=0,SC_WRAP_WORD=1,STYLE_BRACEBAD=35,STYLE_BRACELIGHT=34,STYLE_CALLTIP=38,STYLE_CONTROLCHAR=36,STYLE_DEFAULT=32,STYLE_INDENTGUIDE=37,STYLE_LASTPREDEFINED=39,STYLE_LINENUMBER=33,STYLE_MAX=255,UNDO_MAY_COALESCE=1,VISIBLE_SLOP=0x01,VISIBLE_STRICT=0x04,SCN_DOUBLECLICK=2006,SCN_AUTOCCHARDELETED=2027,SCN_SAVEPOINTLEFT=2003,SCN_PAINTED=2013,SCN_HOTSPOTRELEASECLICK=2028,SCN_UPDATEUI=2007,SCN_STYLENEEDED=2000,SCN_AUTOCCANCELLED=2026,SCN_MACRORECORD=2009,SCN_INDICATORRELEASE=2024,SCN_MODIFIED=2008,SCN_SAVEPOINTREACHED=2002,SCN_HOTSPOTDOUBLECLICK=2020,SCN_NEEDSHOWN=2011,SCN_CALLTIPCLICK=2021,SCN_AUTOCSELECTION=2022,SCN_DWELLEND=2017,SCN_ZOOM=2018,SCN_CHARADDED=2001,SCN_HOTSPOTCLICK=2019,SCN_KEY=2005,SCN_DWELLSTART=2016,SCN_MARGINCLICK=2010,SCN_USERLISTSELECTION=2014,SCN_URIDROPPED=2015,SCN_INDICATORCLICK=2023,SCN_MODIFYATTEMPTRO=2004,SCLEX_CONTAINER=0,SCLEX_AUTOMATIC=1000,SCLEX_LPEG=999,SCLEX_NULL=1} --- -- Scintilla functions. +-- Each key is a Scintilla function name with a table value containing its ID, +-- return type, wParam type, and lParam type. Types are as follows: +-- +-- + `0`: Void. +-- + `1`: Integer. +-- + `2`: Length of the given lParam string. +-- + `3`: Integer position. +-- + `4`: Colour in `0xBBGGRR` format. +-- + `5`: Boolean `true` or `false`. +-- + `6`: Bitmask of Scintilla key modifiers and a key value. +-- + `7`: String parameter. +-- + `8`: String return value. -- @class table -- @name functions M.functions = {add_ref_document={2376,0,0,1},add_selection={2573,1,1,1},add_styled_text={2002,0,2,9},add_text={2001,0,2,7},add_undo_action={2560,0,1,1},allocate={2446,0,1,0},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,1},brace_highlight={2351,0,3,3},brace_highlight_indicator={2498,0,5,1},brace_match={2353,3,3,0},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,1,1},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_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_selections={2571,0,0,0},colourise={4003,0,3,3},contracted_fold_next={2618,1,1,0},convert_eo_ls={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,1,1},create_document={2375,1,0,0},create_loader={2632,1,1,0},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,1},describe_key_word_sets={4017,1,0,8},describe_property={4016,1,7,8},doc_line_from_visible={2221,1,1,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},edit_toggle_overtype={2324,0,0,0},empty_undo_buffer={2175,0,0,0},encoded_from_utf8={2449,1,7,8},end_undo_action={2079,0,0,0},ensure_visible={2232,0,1,0},ensure_visible_enforce_policy={2234,0,1,0},find_column={2456,1,1,1},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},form_feed={2330,0,0,0},format_range={2151,3,5,12},get_cur_line={2027,1,2,8},get_hotspot_active_back={2495,4,0,0},get_hotspot_active_fore={2494,4,0,0},get_last_child={2224,1,1,1},get_line={2153,1,1,8},get_line_sel_end_position={2425,3,1,0},get_line_sel_start_position={2424,3,1,0},get_range_pointer={2643,1,1,1},get_sel_text={2161,1,0,8},get_styled_text={2015,1,0,10},get_text={2182,1,2,8},get_text_range={2162,1,0,10},goto_line={2024,0,1,0},goto_pos={2025,0,3,0},grab_focus={2400,0,0,0},hide_lines={2227,0,1,1},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,1,0},indicator_clear_range={2505,0,1,1},indicator_end={2509,1,1,1},indicator_fill_range={2504,0,1,1},indicator_start={2508,1,1,1},indicator_value_at={2507,1,1,1},insert_text={2003,0,3,7},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,1,3,0},line_length={2350,1,1,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,1,1},marker_add_set={2466,0,1,1},marker_define={2040,0,1,1},marker_define_pixmap={2049,0,1,7},marker_define_rgba_image={2626,0,1,7},marker_delete={2044,0,1,1},marker_delete_all={2045,0,1,0},marker_delete_handle={2018,0,1,0},marker_enable_highlight={2293,0,5,0},marker_get={2046,1,1,0},marker_line_from_handle={2017,1,1,0},marker_next={2047,1,1,1},marker_previous={2048,1,1,1},marker_symbol_defined={2529,1,1,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},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,1,0},position_from_point={2022,3,1,1},position_from_point_close={2023,3,1,1},private_lexer_call={4013,1,1,1},property_names={4014,1,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_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_to_end={2629,0,0,0},scroll_to_start={2628,0,0,0},search_anchor={2366,0,0,0},search_in_target={2197,1,2,7},search_next={2367,1,1,7},search_prev={2368,1,1,7},select_all={2013,0,0,0},selection_duplicate={2469,0,0,0},set_chars_default={2444,0,0,0},set_empty_selection={2556,0,3,0},set_fold_margin_colour={2290,0,5,4},set_fold_margin_hi_colour={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,1,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,1,1,1},set_styling={2033,0,2,1},set_styling_ex={2073,0,2,7},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,1,1},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},target_as_utf8={2447,1,0,8},target_from_selection={2287,0,0,0},text_height={2279,1,1,0},text_width={2276,1,1,7},toggle_caret_sticky={2459,0,0,0},toggle_fold={2231,0,1,0},undo={2176,0,0,0},upper_case={2341,0,0,0},use_pop_up={2371,0,5,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_centre_caret={2619,0,0,0},visible_from_doc_line={2220,1,1,0},word_end_position={2267,1,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,1,3,5},wrap_count={2235,1,1,0},zoom_in={2333,0,0,0},zoom_out={2334,0,0,0}} --- -- Scintilla properties. +-- Each key is a Scintilla property name with a table value containing the ID of +-- its "get" function, the ID of its "set" function, its return type, and its +-- wParam type. The wParam type will be non-zero if the property is an indexable +-- property. Types are the same as in the `functions` table. +-- @see functions -- @class table -- @name properties M.properties = {additional_caret_fore={2605,2604,4,0},additional_carets_blink={2568,2567,5,0},additional_carets_visible={2609,2608,5,0},additional_sel_alpha={2603,2602,1,0},additional_sel_back={0,2601,4,0},additional_sel_fore={0,2600,4,0},additional_selection_typing={2566,2565,5,0},all_lines_visible={2236,0,5,0},anchor={2009,2026,3,0},annotation_lines={2546,0,1,1},annotation_style={2543,2542,1,1},annotation_style_offset={2551,2550,1,0},annotation_styles={2545,2544,8,1},annotation_text={2541,2540,8,1},annotation_visible={2549,2548,1,0},auto_c_auto_hide={2119,2118,5,0},auto_c_cancel_at_start={2111,2110,5,0},auto_c_case_insensitive_behaviour={2635,2634,1,0},auto_c_choose_single={2114,2113,5,0},auto_c_current={2445,0,1,0},auto_c_current_text={2610,0,8,0},auto_c_drop_rest_of_word={2271,2270,5,0},auto_c_fill_ups={0,2112,7,0},auto_c_ignore_case={2116,2115,5,0},auto_c_max_height={2211,2210,1,0},auto_c_max_width={2209,2208,1,0},auto_c_separator={2107,2106,1,0},auto_c_type_separator={2285,2286,1,0},back_space_un_indents={2263,2262,5,0},buffered_draw={2034,2035,5,0},call_tip_back={0,2205,4,0},call_tip_fore={0,2206,4,0},call_tip_fore_hlt={0,2207,4,0},call_tip_position={0,2213,5,0},call_tip_use_style={0,2212,1,0},caret_fore={2138,2069,4,0},caret_line_back={2097,2098,4,0},caret_line_back_alpha={2471,2470,1,0},caret_line_visible={2095,2096,5,0},caret_period={2075,2076,1,0},caret_sticky={2457,2458,1,0},caret_style={2513,2512,1,0},caret_width={2189,2188,1,0},char_at={2007,0,1,3},character_pointer={2520,0,1,0},code_page={2137,2037,1,0},column={2129,0,1,3},control_char_symbol={2389,2388,1,0},current_pos={2008,2141,3,0},cursor={2387,2386,1,0},direct_function={2184,0,1,0},direct_pointer={2185,0,1,0},doc_pointer={2357,2358,1,0},eol_mode={2030,2031,1,0},edge_colour={2364,2365,4,0},edge_column={2360,2361,1,0},edge_mode={2362,2363,1,0},end_at_last_line={2278,2277,5,0},end_styled={2028,0,3,0},extra_ascent={2526,2525,1,0},extra_descent={2528,2527,1,0},first_visible_line={2152,2613,1,0},focus={2381,2380,5,0},fold_expanded={2230,2229,5,1},fold_flags={0,2233,1,0},fold_level={2223,2222,1,1},fold_parent={2225,0,1,1},font_quality={2612,2611,1,0},gap_position={2644,0,3,0},h_scroll_bar={2131,2130,5,0},highlight_guide={2135,2134,1,0},hotspot_active_underline={2496,2412,5,0},hotspot_single_line={2497,2421,5,0},identifier={2623,2622,1,0},indent={2123,2122,1,0},indentation_guides={2133,2132,1,0},indic_alpha={2524,2523,1,1},indic_fore={2083,2082,4,1},indic_outline_alpha={2559,2558,1,1},indic_style={2081,2080,1,1},indic_under={2511,2510,5,1},indicator_current={2501,2500,1,0},indicator_value={2503,2502,1,0},key_words={0,4005,7,1},keys_unicode={2522,2521,5,0},layout_cache={2273,2272,1,0},length={2006,0,1,0},lexer={4002,4001,1,0},lexer_language={4012,4006,8,0},line_count={2154,0,1,0},line_end_position={2136,0,3,1},line_indent_position={2128,0,3,1},line_indentation={2127,2126,1,1},line_state={2093,2092,1,1},line_visible={2228,0,5,1},lines_on_screen={2370,0,1,0},main_selection={2575,2574,1,0},margin_cursor_n={2249,2248,1,1},margin_left={2156,2155,1,0},margin_mask_n={2245,2244,1,1},margin_options={2557,2539,1,0},margin_right={2158,2157,1,0},margin_sensitive_n={2247,2246,5,1},margin_style={2533,2532,1,1},margin_style_offset={2538,2537,1,0},margin_styles={2535,2534,8,1},margin_text={2531,2530,8,1},margin_type_n={2241,2240,1,1},margin_width_n={2243,2242,1,1},marker_alpha={0,2476,1,1},marker_back={0,2042,4,1},marker_back_selected={0,2292,4,1},marker_fore={0,2041,4,1},max_line_state={2094,0,1,0},mod_event_mask={2378,2359,1,0},modify={2159,0,5,0},mouse_down_captures={2385,2384,5,0},mouse_dwell_time={2265,2264,1,0},multi_paste={2615,2614,1,0},multiple_selection={2564,2563,5,0},overtype={2187,2186,5,0},paste_convert_endings={2468,2467,5,0},position_cache={2515,2514,1,0},print_colour_mode={2149,2148,1,0},print_magnification={2147,2146,1,0},print_wrap_mode={2407,2406,1,0},property={4008,4004,8,7},property_expanded={4009,0,8,7},property_int={4010,0,1,7},punctuation_chars={2649,2648,8,0},rgba_image_height={0,2625,1,0},rgba_image_scale={0,2651,1,0},rgba_image_width={0,2624,1,0},read_only={2140,2171,5,0},rectangular_selection_anchor={2591,2590,3,0},rectangular_selection_anchor_virtual_space={2595,2594,1,0},rectangular_selection_caret={2589,2588,3,0},rectangular_selection_caret_virtual_space={2593,2592,1,0},rectangular_selection_modifier={2599,2598,1,0},scroll_width={2275,2274,1,0},scroll_width_tracking={2517,2516,5,0},search_flags={2199,2198,1,0},sel_alpha={2477,2478,1,0},sel_eol_filled={2479,2480,5,0},selection_empty={2650,0,5,0},selection_end={2145,2144,3,0},selection_is_rectangle={2372,0,5,0},selection_mode={2423,2422,1,0},selection_n_anchor={2579,2578,3,1},selection_n_anchor_virtual_space={2583,2582,1,1},selection_n_caret={2577,2576,3,1},selection_n_caret_virtual_space={2581,2580,1,1},selection_n_end={2587,2586,3,1},selection_n_start={2585,2584,3,1},selection_start={2143,2142,3,0},selections={2570,0,1,0},status={2383,2382,1,0},style_at={2010,0,1,3},style_back={2482,2052,4,1},style_bits={2091,2090,1,0},style_bits_needed={4011,0,1,0},style_bold={2483,2053,5,1},style_case={2489,2060,1,1},style_changeable={2492,2099,5,1},style_character_set={2490,2066,1,1},style_eol_filled={2487,2057,5,1},style_font={2486,2056,8,1},style_fore={2481,2051,4,1},style_hot_spot={2493,2409,5,1},style_italic={2484,2054,5,1},style_size={2485,2055,1,1},style_size_fractional={2062,2061,1,1},style_underline={2488,2059,5,1},style_visible={2491,2074,5,1},style_weight={2064,2063,1,1},tab_indents={2261,2260,5,0},tab_width={2121,2036,1,0},tag={2616,0,8,1},target_end={2193,2192,3,0},target_start={2191,2190,3,0},technology={2631,2630,1,0},text_length={2183,0,1,0},two_phase_draw={2283,2284,5,0},undo_collection={2019,2012,5,0},use_tabs={2125,2124,5,0},v_scroll_bar={2281,2280,5,0},view_eol={2355,2356,5,0},view_ws={2020,2021,1,0},virtual_space_options={2597,2596,1,0},whitespace_chars={2647,2443,8,0},whitespace_size={2087,2086,1,0},word_chars={2646,2077,8,0},wrap_indent_mode={2473,2472,1,0},wrap_mode={2269,2268,1,0},wrap_start_indent={2465,2464,1,0},wrap_visual_flags={2461,2460,1,0},wrap_visual_flags_location={2463,2462,1,0},x_offset={2398,2397,1,0},zoom={2374,2373,1,0}} @@ -55,7 +74,7 @@ end --- -- Returns a unique user list type. -- Use this function for custom user lists in order to prevent clashes with --- type identifiers of other custom user lists. +-- 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 diff --git a/core/init.lua b/core/init.lua index fd3e1b9c..4473c11b 100644 --- a/core/init.lua +++ b/core/init.lua @@ -22,19 +22,26 @@ _M = {} -- modules table --[[ This comment is for LuaDoc. --- --- Extends Lua's _G table to provide extra functions and fields. +-- Extends Lua's _G table to provide extra functions and fields for Textadept. -- @field _HOME (string) -- Path to the directory containing Textadept. -- @field _LEXERPATH (string) --- Paths to lexers, formatted like --- [`package.path`](http://lua.org/manual/5.2/manual.html#pdf-package.path). +-- Paths to lexers, formatted like [`package.path`][]. +-- +-- [`package.path`]: http://lua.org/manual/5.2/manual.html#pdf-package.path -- @field _RELEASE (string) -- The Textadept release version. -- @field _USERHOME (string) --- Path to the user's `~/.textadept/`. +-- Path to the user's `~/.textadept/`, where all preferences and user-data is +-- stored. +-- On Windows machines `~/` is the value of the `USERHOME` environment +-- variable, typically `C:\Users\\` or +-- `C:\Documents and Settings\\`. On Linux, BSD, and Mac OSX +-- machines `~/` is the value of `HOME`, typically `/home//` and +-- `/Users//` respectively. -- @field _CHARSET (string) -- The character set encoding of the filesystem. --- This is used in [File I/O](io.html). +-- This is used when [working with files](io.html). -- @field RESETTING (bool) -- If [`reset()`](#reset) has been called, this flag is `true` while the Lua -- state is being re-initialized. @@ -44,13 +51,21 @@ _M = {} -- modules table -- If Textadept is running on Mac OSX, this flag is `true`. -- @field NCURSES (bool) -- If Textadept is running in the terminal, this flag is `true`. +-- ncurses feature incompatibilities are listed in the [Appendix][]. +-- +-- [Appendix]: ../14_Appendix.html#Ncurses.Compatibility +-- @field buffer The current [buffer][] in the current [view](#view). +-- +-- [buffer]: buffer.html +-- @field view The currently focused [view](view.html). module('_G')]] --[[ The tables below were defined in C. --- --- Command line parameters. +-- Command line parameters passed to Textadept. -- @class table +-- @see _G.args -- @name arg local arg @@ -59,9 +74,10 @@ local arg -- Numeric keys have buffer values and buffer keys have their associated numeric -- keys. -- @class table --- @name _BUFFERS -- @usage _BUFFERS[1] contains the first buffer. -- @usage _BUFFERS[buffer] returns the index of the current buffer in _BUFFERS. +-- @see _G.buffer +-- @name _BUFFERS local _BUFFERS --- @@ -69,23 +85,28 @@ local _BUFFERS -- Numeric keys have view values and view keys have their associated numeric -- keys. -- @class table --- @name _VIEWS -- @usage _VIEWS[1] contains the first view. -- @usage _VIEWS[view] returns the index of the current view in _VIEWS. +-- @see _G.view +-- @name _VIEWS local _VIEWS -- The functions below are Lua C functions. --- -- Creates a new buffer. --- Generates a `BUFFER_NEW` event. +-- Emits a `BUFFER_NEW` event. -- @return the new buffer. -- @class function +-- @see events.BUFFER_NEW -- @name new_buffer local new_buffer --- -- Quits Textadept. +-- Emits a `QUIT` event. If any handler returns `false`, Textadept does not +-- quit. +-- @see events.QUIT -- @class function -- @name quit local quit @@ -93,12 +114,12 @@ local quit --- -- Resets the Lua state by reloading all init scripts. -- Language-specific modules for opened files are NOT reloaded. Re-opening the --- files that use them will reload those modules. --- This function is useful for modifying init scripts (such as the user's --- `modules/textadept/keys.lua`) on the fly without having to restart Textadept. --- `_G.RESETTING` is set to `true` when re-initing the Lua State. Any scripts --- that need to differentiate between startup and reset can utilize this --- variable. +-- 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. `_G.RESETTING` is set to `true` +-- when re-initing the Lua State. Any scripts that need to differentiate between +-- startup and reset can utilize this variable. -- @class function -- @see RESETTING -- @name reset @@ -106,8 +127,8 @@ local reset --- -- Calls a given function after an interval of time. --- To repeatedly call the function, return true inside the function. A `nil` or --- `false` return value stops repetition. +-- To repeatedly call the function, return `true` inside the function. A `nil` +-- or `false` return value stops repetition. -- @param interval The interval in seconds to call the function 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 d09a0ef5..65042fe0 100644 --- a/core/keys.lua +++ b/core/keys.lua @@ -4,103 +4,88 @@ local M = {} --[[ This comment is for LuaDoc. --- --- Manages key commands in Textadept. +-- Manages key bindings in Textadept. -- -- ## Overview -- --- Key commands are defined in the global table `keys`. Each key-value pair in --- `keys` consists of either: +-- Key bindings are defined in the global table `keys`. Each key-value pair in +-- `keys` consists of either a string key sequence and its associated command, +-- a string lexer language (from the `lexers/` directory) 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". When searching +-- for a command to run based on a key sequence, key bindings in the current +-- lexer have priority, followed by the ones in the global table. This means if +-- there are two commands with the same key sequence, the one specific to the +-- current lexer is run. However, if the command returns the boolean value +-- `false`, the lower-priority command is also run. (This is useful for +-- language-specific modules to override commands like Adeptsense +-- autocompletion, but fall back to word autocompletion if the first command +-- fails.) -- --- * A string representing a key command and an associated function or table. --- * A string language name and its associated `keys`-like table. --- * A string representing a key command and its associated `keys`-like table. --- (This is a keychain sequence.) +-- ## Key Sequences -- --- Language names are the names of the lexer files in `lexers/` such as `cpp` --- and `lua`. +-- Key sequences are strings built from a combination of modifier keys and the +-- key itself. Modifier keys are `Control`, `Shift`, and `Alt` on Windows, +-- Linux, BSD, and in ncurses. On Mac OSX they are `Command` (`⌘`), `Alt/Option` +-- (`⌥`), `Control` (`^`), and `Shift` (`⇧`). These modifiers have the following +-- string representations: -- --- A key command string is built from a combination of the `CTRL`, `ALT`, --- `META`, `SHIFT`, and `ADD` constants as well as the pressed key itself. The --- value of `ADD` is inserted between each of `CTRL`, `ALT`, `META`, `SHIFT`, --- and the key. For example: +-- Modifier | Linux / Win32 | Mac OSX | Terminal | +-- ---------|---------------|---------|----------| +-- Control | `'c'` | `'m'` | `'c'` | +-- Alt | `'a'` | `'a'` | `'m'` | +-- Shift | `'s'` | `'s'` | `'s'` | +-- Command | N/A | `'c'` | N/A | -- --- -- keys.lua: --- CTRL = 'Ctrl' --- ALT = 'Alt' --- SHIFT = 'Shift' --- META = 'Meta' --- ADD = '+' --- -- pressing control, alt, shift, and 'a' yields: 'Ctrl+Alt+Shift+A' +-- For key values less than 255, their string representation is the character +-- that would normally be inserted if the `Ctrl`, `Alt`, and `Command` modifiers +-- were not held down. Therefore, a combination of `Ctrl+Alt+Shift+A` has the +-- key sequence `caA` on Windows and Linux, but a combination of +-- `Ctrl+Shift+Tab` has the key sequence `cs\t`. On a United States English +-- keyboard, since the combination of `Ctrl+Shift+,` has the key sequence `c<` +-- (`Shift+,` inserts a `<`), the key binding is referred to as `Ctrl+<`. This +-- allows key bindings to be language and layout agnostic. For key values +-- greater than 255, the [`KEYSYMS`](#KEYSYMS) lookup table is used. Therefore, +-- `Ctrl+Right Arrow` has the key sequence `cright`. Uncommenting the `print()` +-- statements in `core/keys.lua` will print key sequences to standard out +-- (stdout) for inspection. -- --- For key values less than 255, Lua's [`string.char()`][] is used to determine --- the key's string representation. Otherwise, the [`KEYSYMS`](#KEYSYMS) lookup --- table is used. +-- ## Commands -- --- [`string.char()`]: http://www.lua.org/manual/5.2/manual.html#pdf-string.char +-- Commands associated with key sequences can be either Lua functions, or +-- tables containing Lua functions with a set of arguments to call the function +-- with. Examples are -- --- Normally, Lua functions are assigned to key commands, but those functions are --- called without any arguments. In order to pass arguments to a function, --- assign a table to the key command. This table contains the function followed --- by its arguments in order. Any [buffer][] or [view][] references are handled --- correctly at runtime. +-- keys['cn'] = new_buffer +-- keys['cs'] = buffer.save +-- keys['a('] = { _M.textadept.editing.enclose, '(', ')' } -- --- [buffer]: buffer.html --- [view]: view.html +-- Note that [`buffer`][] references are handled properly. -- --- Key commands can be chained like in Emacs using keychain sequences. By --- default, the `Esc` key (`Apple+Esc` on Mac OSX) cancels the current keychain, --- but it can be redefined by re-defining [`CLEAR`](#CLEAR). Naturally, the --- clear sequence cannot be chained. +-- [`buffer`]: buffer.html -- --- ## Precedence +-- ## Key Chains -- --- When searching for a key command to execute in the `keys` table, key commands --- in the current lexer have priority, followed by the ones in the global table. +-- Key chains are a powerful concept. They allow multiple key bindings to be +-- assigned to one key sequence. Language-specific modules +-- [use key chains](#LANGUAGE_MODULE_PREFIX) for their functions. By default, +-- the `Esc` (`⎋` on Mac OSX | `Esc` in ncurses) key cancels a key chain, but it +-- can be redefined via [`CLEAR`](#CLEAR). An example key chain looks like -- --- ### Propagation --- --- Normally when the same key command is assigned to two separate functions of --- different precedence, the higher priority key command is run and the lower --- priority one is not. However, it is sometimes desirable to have the lower --- priority command run after the higher one. For example, `Ctrl+Enter` may --- trigger Adeptsense autocompletion in lexers that have Adeptsense, but should --- fall back on autocompleting words in the buffer if no Adeptsense completions --- are available. In order for this to happen, the first function has to return --- `false` (and only `false`; `nil` is not sufficient) when it wants to allow a --- lower priority function to run. Any other return value halts propagation and --- the key is consumed. --- --- ## Example --- --- keys = { --- ['ctrl+f'] = buffer.char_right --- ['ctrl+b'] = buffer.char_left, --- lua = { --- ['ctrl+f'] = { buffer.add_text, buffer, 'function' }, --- ['ctrl+b'] = function() return false end --- } +-- keys['aa'] = { +-- a = function1, +-- b = function2, +-- c = { function3, arg1, arg2 } -- } --- --- The first two key commands are global and call `buffer:char_right()` and --- `buffer:char_left()` respectively. The last two commands apply only in the --- Lua lexer. If `ctrl+f` is pressed in a Lua file, the global key command with --- the same shortcut is overridden and `function` is added to the buffer. --- However, `ctrl+b` in a Lua file does not override its global command because --- of the `false` return. Instead, propagation occurs as described above. --- --- ## Problems --- --- All Lua functions must be defined **before** they are reference in key --- commands. Therefore, any module containing key commands should be loaded --- after all other modules, whose functions are being referenced, have been --- loaded. -- @field CLEAR (string) --- The string representing the key sequence that clears the current keychain. --- The default value is `'esc'` (Escape). +-- The string representing the key sequence that clears the current key chain. +-- It cannot be part of a key chain. +-- The default value is `'esc'` for the `Esc` (`⎋` on Mac OSX | `Esc` in +-- ncurses) key. -- @field LANGUAGE_MODULE_PREFIX (string) --- The starting key command of the keychain reserved for language-specific +-- The starting key command of the key chain reserved for language-specific -- modules. --- The default value is Ctrl/Cmd+L. +-- The default value is `Ctrl+L` (`⌘L` on Mac OSX | `M-L` in ncurses). module('keys')]] local ADD = '' @@ -120,9 +105,9 @@ local getmetatable = getmetatable local error = function(e) events.emit(events.ERROR, e) end --- --- Lookup table for key codes higher than 255. --- If a key code given to `keypress()` is higher than 255, this table is used to --- return a string representation of the key if it exists. +-- Lookup table for string representations of GDK key codes higher than 255. +-- Key codes can be identified by temporarily uncommenting the `print()` +-- statements in `core/keys.lua` -- @class table -- @name KEYSYMS M.KEYSYMS = { @@ -235,7 +220,7 @@ end local function keypress(code, shift, control, alt, meta) local buffer = buffer local key - --print(code, M.KEYSYMS[ch], shift, control, alt, meta) + --print(code, M.KEYSYMS[code], shift, control, alt, meta) if code < 256 then key = string_char(code) shift = shift and code < 32 -- for printable characters, key is upper case diff --git a/core/locale.lua b/core/locale.lua index 449f4dee..68a8266c 100644 --- a/core/locale.lua +++ b/core/locale.lua @@ -5,12 +5,15 @@ local M = {} --[[ This comment is for LuaDoc. --- -- Table of all messages used by Textadept for localization. +-- If the table does not contain the localized version of a given message, it +-- returns a string indicating so via a metamethod. module('_L')]] local none = 'No Localization: ' --- -- Returns whether or not a localized message exists for the given message. +-- This function is necessary since `_L[message]` never returns `nil`. -- @param message The message to localize. -- @return `true` if a localization exists, `false` otherwise. function M._EXISTS(message) return M[message] ~= none..message end -- cgit v1.2.3