aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--core/._G.luadoc12
-rw-r--r--core/.buffer.luadoc555
-rw-r--r--core/.gui.luadoc21
-rw-r--r--core/.view.luadoc19
-rw-r--r--core/file_io.lua12
-rw-r--r--core/gui.lua77
-rw-r--r--core/locale.conf2
-rw-r--r--core/locales/locale.ru.conf2
-rw-r--r--modules/lua/api600
-rw-r--r--modules/lua/tags59
-rw-r--r--modules/textadept/find.lua27
-rw-r--r--modules/textadept/keys.lua12
-rw-r--r--modules/textadept/menu.lua12
-rw-r--r--modules/textadept/mime_types.lua6
-rw-r--r--modules/textadept/session.lua25
-rw-r--r--src/textadept.c2344
16 files changed, 1742 insertions, 2043 deletions
diff --git a/core/._G.luadoc b/core/._G.luadoc
index 1cf55e23..e2d8401c 100644
--- a/core/._G.luadoc
+++ b/core/._G.luadoc
@@ -31,15 +31,23 @@ arg = {}
---
--- A numerically indexed table of open buffers in Textadept.
+-- Table of all open buffers in Textadept.
+-- 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[_BUFFERS[1]] evaluates to 1, the index of the first buffer.
_BUFFERS = {}
---
--- A numerically indexed table of views in Textadept.
+-- Table of all views in Textadept.
+-- 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[_VIEWS[1]] evaluates to 1, the index of the first view.
_VIEWS = {}
---
diff --git a/core/.buffer.luadoc b/core/.buffer.luadoc
index 0f38fa31..e5519c3f 100644
--- a/core/.buffer.luadoc
+++ b/core/.buffer.luadoc
@@ -3,7 +3,7 @@
-- global buffer table.
---
--- The current buffer in the currently focused view.
+-- The current buffer in the current view.
-- It also represents the structure of any buffer table in 'buffers'.
module('buffer')
@@ -150,7 +150,6 @@ module('buffer')
-- when calling the function returned by direct_function. (Read-only)
-- * `dirty` [bool]: Flag indicating whether or not the buffer has been modified
-- since it was last saved.
--- * `doc_pointer` [number]: A pointer to the document object. (Read-only)
-- * `eol_mode` [number]: The current end of line mode.<br />
-- * `_SCINTILLA.constants.SC_EOL_CRLF` (0): `CRLF`.
-- * `_SCINTILLA.constants.SC_EOL_CR` (1): `CR`.
@@ -598,7 +597,7 @@ module('buffer')
-- always at least one selection, to set a list of selections, the first
-- selection should be added with `buffer:set_selection()` and later selections
-- added with this function.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param caret The caret.
-- @param anchor The anchor.
function buffer.add_selection(buffer, caret, anchor) end
@@ -607,32 +606,32 @@ function buffer.add_selection(buffer, caret, anchor) end
-- Add text to the document at current position.
-- The current position is set at the end of the inserted text, but it is not
-- scrolled into view.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param text The text to add.
function buffer.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 focused buffer.
+-- @param buffer The global buffer.
-- @param bytes
function buffer.allocate(buffer, bytes) end
---
-- Clear the annotations from all lines.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.annotation_clear_all(buffer) end
---
-- Get the annotation text for a line.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param line The line number.
-- @return string
function buffer.annotation_get_text(buffer, line) end
---
-- Set the annotation text for a line.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param line The line number.
-- @param text The text.
function buffer.annotation_set_text(buffer, line, text) end
@@ -641,7 +640,7 @@ function buffer.annotation_set_text(buffer, line, text) end
-- Append a string to the end of the document without changing the selection.
-- The current selection is not changed and the new text is not scrolled into
-- view.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param text The text.
function buffer.append_text(buffer, text) end
@@ -655,31 +654,31 @@ function buffer.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 focused buffer.
+-- @param buffer The global buffer.
function buffer.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 focused buffer.
+-- @param buffer The global buffer.
function buffer.auto_c_complete(buffer) end
---
-- Get currently selected item position in the auto-completion list.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @return number
function buffer.auto_c_get_current(buffer) end
---
-- Get currently selected item text in the auto-completion list.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @return string
function buffer.auto_c_get_current_text(buffer) end
---
-- Retrieve the position of the caret when the auto-completion list was
-- displayed.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @return number
function buffer.auto_c_pos_start(buffer) end
@@ -687,7 +686,7 @@ function buffer.auto_c_pos_start(buffer) end
-- Select the item in the auto-completion list that starts with a string.
-- By default, comparisons are case sensitive, but this can change with
-- buffer.auto_c_ignore_case.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param string
function buffer.auto_c_select(buffer, string) end
@@ -701,31 +700,31 @@ function buffer.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 focused buffer.
+-- @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
---
-- Dedent the selected lines.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.back_tab(buffer) end
---
-- Start a sequence of actions that is undone and redone as a unit.
-- May be nested.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.begin_undo_action(buffer) end
---
-- Highlight the character at a position indicating there is no matching brace.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param pos The position or -1 to remove the highlight.
function buffer.brace_bad_light(buffer, pos) end
---
-- Use specified indicator to highlight non matching brace instead of changing
-- its style.
--- @param buffer The focused buffer.
+-- @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
@@ -735,7 +734,7 @@ function buffer.brace_bad_light_indicator(buffer, use_indicator, indic_num) end
-- If indent guides are enabled, the indent that corresponds with the brace can
-- be highlighted by locating the column with `buffer.column` and highlight the
-- indent with `buffer.highlight_guide`.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param pos1 The first position.
-- @param pos2 The second position.
function buffer.brace_highlight(buffer, pos1, pos2) end
@@ -743,7 +742,7 @@ function buffer.brace_highlight(buffer, pos1, pos2) end
---
-- Use specified indicator to highlight matching braces instead of changing
-- their style.
--- @param buffer The focused buffer.
+-- @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
@@ -755,14 +754,14 @@ function buffer.brace_highlight_indicator(buffer, use_indicator, indic_num) end
-- brace. A match only occurs if the style of the matching brace is the same as
-- the starting brace or the matching brace is beyond the end of styling. Nested
-- braces are handled correctly.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param pos The position.
-- @return number.
function buffer.brace_match(buffer, pos) end
---
-- Is there an active call tip?
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @return bool
function buffer.call_tip_active(buffer) end
@@ -770,18 +769,18 @@ function buffer.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 focused buffer.
+-- @param buffer The global buffer.
function buffer.call_tip_cancel(buffer) end
---
-- Retrieve the position where the caret was before displaying the call tip.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @return number
function buffer.call_tip_pos_start(buffer) end
---
-- Highlights a segment of a call tip.
--- @param buffer The focused buffer.
+-- @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
@@ -792,61 +791,61 @@ function buffer.call_tip_set_hlt(buffer, start_pos, end_pos) end
-- and/or down arrows have been included in the call tip text in which case the
-- tip is aligned to the right-hand edge of the rightmost arrow. The assumption
-- is that the text starts with something like "\001 1 of 3 \002".
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param pos The position.
-- @param text The text.
function buffer.call_tip_show(buffer, pos, text) end
---
-- Will a paste succeed?
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @return bool
function buffer.can_paste(buffer) end
---
-- Are there any redoable actions in the undo history?
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @return bool
function buffer.can_redo(buffer) end
---
-- Are there any undoable actions in the undo history?
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @return bool
function buffer.can_undo(buffer) end
---
-- Cancel any modes such as call tip or auto-completion list display.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.cancel(buffer) end
---
-- Indicate that the internal state of a lexer has changed over a range and
-- therefore there may be a need to redraw.
--- @param buffer The focused buffer.
+-- @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
---
-- Move caret left one character.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.char_left(buffer) end
---
-- Move caret left one character extending selection to new caret position.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.char_left_extend(buffer) end
---
-- Move caret left one character, extending rectangular selection to new caret
-- position.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.char_left_rect_extend(buffer) end
---
-- Find the position of a character from a point within the window.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param x
-- @param y
-- @return number
@@ -855,7 +854,7 @@ function buffer.char_position_from_point(buffer, x, y) end
---
-- Find the position of a character from a point within the window.
-- Return -1 if not close to text.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param x
-- @param y
-- @return number
@@ -863,18 +862,18 @@ function buffer.char_position_from_point_close(buffer, x, y) end
---
-- Move caret right one character.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.char_right(buffer) end
---
-- Move caret right one character extending selection to new caret position.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.char_right_extend(buffer) end
---
-- Move caret right one character, extending rectangular selection to new caret
-- position.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.char_right_rect_extend(buffer) end
---
@@ -883,42 +882,42 @@ function buffer.char_right_rect_extend(buffer) end
-- explicitly by the user and this value is then used when moving vertically
-- 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 focused buffer.
+-- @param buffer The global buffer.
function buffer.choose_caret_x(buffer) end
---
-- Clear the selection.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.clear(buffer) end
---
-- Delete all text in the document.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.clear_all(buffer) end
---
-- Drop all key mappings.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.clear_all_cmd_keys(buffer) end
---
-- Set all style bytes to 0, remove all folding information.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.clear_document_style(buffer) end
---
-- Clear all the registered XPM images.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.clear_registered_images(buffer) end
---
-- Clear selections to a single empty stream selection.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.clear_selections(buffer) end
---
-- colorise a segment of the document using the current lexing language.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @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.
@@ -928,14 +927,14 @@ function buffer.colourise(buffer, start_pos, end_pos) end
-- Find the next line at or after line_start that is a contracted fold header
-- line.
-- Return -1 when no more lines.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param line_start The start line number.
-- @return number
function buffer.contracted_fold_next(buffer, line_start) end
---
-- Converts all line endings in the document to one mode.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param mode The line ending mode. Valid values are:
-- _SCINTILLA.constants.SC_EOL_CRLF (0),
-- _SCINTILLA.constants.SC_EOL_CR (1), or
@@ -949,57 +948,57 @@ function buffer.copy(buffer) end
---
-- Copy the selection, if selection empty copy the line with the caret.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.copy_allow_line(buffer) end
---
-- Copy a range of text to the clipboard. Positions are clipped into the
-- document.
--- @param buffer The focused buffer.
+-- @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
---
-- Copy argument text to the clipboard.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param text The text.
function buffer.copy_text(buffer, text) end
---
-- Cut the selection to the clipboard.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.cut(buffer) end
---
-- Delete back from the current position to the start of the line.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.del_line_left(buffer) end
---
-- Delete forwards from the current position to the end of the line.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.del_line_right(buffer) end
---
-- Delete the word to the left of the caret.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.del_word_left(buffer) end
---
-- Delete the word to the right of the caret.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.del_word_right(buffer) end
---
-- Delete the word to the right of the caret, but not the trailing non-word
-- characters.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.del_word_right_end(buffer) end
---
-- Delete the selection or if no selection, the character before the caret.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.delete_back(buffer) end
---
@@ -1009,67 +1008,67 @@ function buffer.delete_back_not_line(buffer) end
---
-- Find the document line of a display line taking hidden lines into account.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @return number
function buffer.doc_line_from_visible(buffer) end
---
-- Move caret to last position in document.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.document_end(buffer) end
---
-- Move caret to last position in document extending selection to new caret
-- position.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.document_end_extend(buffer) end
---
-- Move caret to first position in document.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.document_start(buffer) end
---
-- Move caret to first position in document extending selection to new caret
-- position.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.document_start_extend(buffer) end
---
-- Switch from insert to overtype mode or the reverse.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.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 focused buffer.
+-- @param buffer The global buffer.
function buffer.empty_undo_buffer(buffer) end
---
-- Translates a UTF8 string into the document encoding.
-- Return the length of the result in bytes. On error return 0.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param string The string.
-- @return number
function buffer.encoded_from_utf8(buffer, string) end
---
-- End a sequence of actions that is undone and redone as a unit.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.end_undo_action(buffer) end
---
-- Ensure a particular line is visible by expanding any header line hiding it.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param line The line number.
function buffer.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 focused buffer.
+-- @param buffer The global buffer.
-- @param line The line number.
function buffer.ensure_visible_enforce_policy(buffer, line) end
@@ -1077,51 +1076,51 @@ function buffer.ensure_visible_enforce_policy(buffer, line) end
-- Find the position of a column on a line taking into account tabs and
-- multi-byte characters.
-- If beyond end of line, return line end position.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param line The line number.
-- @param column The column number.
function buffer.find_column(buffer, line, column) end
---
-- Insert a Form Feed character.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.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 focused buffer.
+-- @param buffer The global buffer.
-- @return string, number
function buffer.get_cur_line(buffer) end
---
-- Get the back color for active hotspots in 0xBBGGRR format.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @return number
function buffer.get_hotspot_active_back(buffer) end
---
-- Get the fore color for active hotspots.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @return number
function buffer.get_hotspot_active_fore(buffer) end
---
-- Find the last child line of a header line.
--- @param buffer The focused buffer.
+-- @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
---
-- Retrieve the name of the lexer.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.get_lexer_language(buffer) end
---
-- Retrieve the contents of a line.
-- Also returns the length of the line.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param line The line number.
-- @return string, number
function buffer.get_line(buffer, line) end
@@ -1129,20 +1128,20 @@ function buffer.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 focused buffer.
+-- @param buffer The global buffer.
-- @param line The line number.
function buffer.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 focused buffer.
+-- @param buffer The global buffer.
-- @param line The line number.
function buffer.get_line_sel_start_position(buffer, line) end
---
-- Retrieve a "property" value previously set with `buffer.property`.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param key Keyword.
-- @return string
function buffer.get_property(buffer, key) end
@@ -1150,7 +1149,7 @@ function buffer.get_property(buffer, key) end
---
-- Retrieve a "property" value previously set with `buffer.property`, with "$()"
-- variable replacement on returned buffer.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param key Keyword.
-- @return string
function buffer.get_property_expanded(buffer, key) end
@@ -1158,13 +1157,13 @@ function buffer.get_property_expanded(buffer, key) end
---
-- Retrieve the selected text.
-- Also returns the length of the text.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @return string, number
function buffer.get_sel_text(buffer) end
---
-- Retrieve the value of a tag from a regular expression search.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param tag_num The tag number.
-- @return string
function buffer.get_tag(buffer, tag_num) end
@@ -1172,100 +1171,100 @@ function buffer.get_tag(buffer, tag_num) end
---
-- Retrieve all the text in the document.
-- Also returns number of characters retrieved.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.get_text(buffer) end
---
-- Set caret to start of a line and ensure it is visible.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param line The line number.
function buffer.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 focused buffer.
+-- @param buffer The global buffer.
-- @param pos The position.
function buffer.goto_pos(buffer, pos) end
---
-- Set the focus to this view.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.grab_focus(buffer) end
---
-- Make a range of lines invisible.
-- This has no effect on fold levels or fold flags. start_line can not be
-- hidden.
--- @param buffer The focused buffer.
+-- @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
---
-- Draw the selection in normal style or with selection highlighted.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param normal Draw normal selection.
function buffer.hide_selection(buffer, normal) end
---
-- Move caret to first position on line.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.home(buffer) end
---
-- Move caret to first position on display line.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.home_display(buffer) end
---
-- Move caret to first position on display line extending selection to new caret
-- position.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.home_display_extend(buffer) end
---
-- Move caret to first position on line extending selection to new caret
-- position.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.home_extend(buffer) end
---
-- Move caret to first position on line, extending rectangular selection to new
-- caret position.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.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 focused buffer.
+-- @param buffer The global buffer.
function buffer.home_wrap(buffer) end
---
-- Like `buffer:home_wrap()` but extending selection to new caret position.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.home_wrap_extend(buffer) end
---
-- Retrieve a bitmap value representing which indicators are non-zero at a
-- position.
-- Bit 0 is set if indicator 0 is present, bit 1 for indicator 1 and so on.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param pos The position.
-- @return number
function buffer.indicator_all_on_for(buffer, pos) end
---
-- Turn a indicator off over a range.
--- @param buffer The focused buffer.
+-- @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
---
-- Find the position where a particular indicator ends.
--- @param buffer The focused buffer.
+-- @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
@@ -1273,14 +1272,14 @@ function buffer.indicator_end(buffer, indicator, pos) end
---
-- Turn a indicator on over a range.
-- This function fills with the current indicator value.
--- @param buffer The focused buffer.
+-- @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
---
-- Find the position where a particular indicator starts.
--- @param buffer The focused buffer.
+-- @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
@@ -1288,7 +1287,7 @@ function buffer.indicator_start(buffer, indicator, pos) end
---
-- Retrieve the value of a particular indicator at a position.
-- Currently all values are drawn the same.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param indicator The indicator number in the range of 0 to 31.
-- @param pos The position.
-- @return number
@@ -1298,89 +1297,89 @@ function buffer.indicator_value_at(buffer, indicator, pos) end
-- Insert string at a position.
-- If the current position is after the insertion point then it is moved along
-- with its surrounding text but no scrolling is performed.
--- @param buffer The focused buffer.
+-- @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
---
-- Copy the line containing the caret.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.line_copy(buffer) end
---
-- Cut the line containing the caret.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.line_cut(buffer) end
---
-- Delete the line containing the caret.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.line_delete(buffer) end
---
-- Move caret down one line.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.line_down(buffer) end
---
-- Move caret down one line extending selection to new caret position.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.line_down_extend(buffer) end
---
-- Move caret down one line, extending rectangular selection to new caret
-- position.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.line_down_rect_extend(buffer) end
---
-- Duplicate the current line.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.line_duplicate(buffer) end
---
-- Move caret to last position on line.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.line_end(buffer) end
---
-- Move caret to last position on display line.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.line_end_display(buffer) end
---
-- Move caret to last position on display line extending selection to new caret
-- position.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.line_end_display_extend(buffer) end
---
-- Move caret to last position on line extending selection to new caret
-- position.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.line_end_extend(buffer) end
---
-- Move caret to last position on line, extending rectangular selection to new
-- caret position.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.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 focused buffer.
+-- @param buffer The global buffer.
function buffer.line_end_wrap(buffer) end
---
-- Like `buffer:line_end_wrap()` but extending selection to new caret position.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.line_end_wrap_extend(buffer) end
---
-- Retrieve the line containing a position.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param pos The position.
-- @return number
function buffer.line_from_position(buffer, pos) end
@@ -1389,91 +1388,91 @@ function buffer.line_from_position(buffer, pos) end
-- Returns how many characters are on a line, including end of line characters.
-- To get the length of the line not including any end of line characters, use
-- `buffer.line_end_position[line] - buffer:position_from_line(line)`.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param line The line number.
-- @return number
function buffer.line_length(buffer, line) end
---
-- Scroll horizontally and vertically.
--- @param buffer The focused buffer.
+-- @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
---
-- Scroll the document down, keeping the caret visible.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.line_scroll_down(buffer) end
---
-- Scroll the document up, keeping the caret visible.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.line_scroll_up(buffer) end
---
-- Switch the current line with the previous.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.line_transpose(buffer) end
---
-- Move caret up one line.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.line_up(buffer) end
---
-- Move caret up one line extending selection to new caret position.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.line_up_extend(buffer) end
---
-- Move caret up one line, extending rectangular selection to new caret
-- position.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.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 focused buffer.
+-- @param buffer The global buffer.
function buffer.lines_join(buffer) end
---
-- Split the lines in the target into lines that are less wide than pixel_width
-- where possible.
--- @param buffer The focused buffer.
+-- @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
---
-- Transform the selection to lower case.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.lower_case(buffer) end
---
-- Get the text in the text margin for a line.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param line The line number.
-- @return string
function buffer.margin_get_text(buffer, line) end
---
-- Set the text in the text margin for a line.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param line The line number.
-- @param text The text.
function buffer.margin_set_text(buffer, line, text) end
---
-- Clear the margin text on all lines.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.margin_text_clear_all(buffer) end
---
-- Add a marker to a line, returning an ID which can be used to find or delete
-- the marker.
-- Returns -1 if this fails (illegal line number, out of memory).
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param line The line number.
-- @param marker_num A marker number in the range of 0 to 31.
-- @return number
@@ -1481,7 +1480,7 @@ function buffer.marker_add(buffer, line, marker_num) end
---
-- Add a set of markers to a line.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @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.
@@ -1489,7 +1488,7 @@ function buffer.marker_add_set(buffer, line, marker_mask) end
---
-- Set the symbol used for a particular marker number.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @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
@@ -1497,7 +1496,7 @@ function buffer.marker_define(buffer, marker_num, marker_symbol) end
---
-- Define a marker from a pixmap.
--- @param buffer The focused buffer.
+-- @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
@@ -1506,7 +1505,7 @@ function buffer.marker_define_pixmap(buffer, marker_num, pixmap) end
-- Define a marker from RGBA data.
-- It has the width and height from `buffer.rgba_image_width` and
-- `buffer.rgba_image_height`.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param marker_num A marker number in the range of 0 to 31.
-- @param pixels A sequence of 4 byte pixel values starting with the pixels for
-- the top line, with the leftmost pixel first, then continuing with the
@@ -1519,7 +1518,7 @@ function buffer.marker_define_rgba_image(buffer, marker_num, pixels) end
---
-- Delete a marker from a line.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @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.
@@ -1527,28 +1526,28 @@ function buffer.marker_delete(buffer, line, marker_num) end
---
-- Delete all markers with a particular number from all lines.
--- @param buffer The focused buffer.
+-- @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 all lines.
function buffer.marker_delete_all(buffer, marker_num) end
---
-- Delete a marker.
--- @param buffer The focused buffer.
+-- @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
---
-- Enable/disable highlight for current folding block (smallest one that
-- contains the caret)
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param enabled
function buffer.marker_enable_highlight(buffer, enabled) end
---
-- Get a bit mask of all the markers set on a line.
-- Bit 0 is set if marker 0 is present, bit 1 for marker 1 and so on.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param line The line number.
-- @return number.
function buffer.marker_get(buffer, line) end
@@ -1556,7 +1555,7 @@ function buffer.marker_get(buffer, line) end
---
-- Retrieve the line number at which a particular marker is located.
-- Returns -1 if it not found.
--- @param buffer The focused buffer.
+-- @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
@@ -1564,7 +1563,7 @@ function buffer.marker_line_from_handle(buffer, handle) end
---
-- Find the next line at or after start_line that includes a marker in mask.
-- Return -1 when no more lines.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param start_line The start line.
-- @param marker_mask A mask of markers to find. Set bit 0 to find marker 0, bit
-- 1 for marker 1 and so on.
@@ -1573,7 +1572,7 @@ function buffer.marker_next(buffer, start_line, marker_mask) end
---
-- Find the previous line before lineStart that includes a marker in mask.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param start_line The start line.
-- @param marker_mask A mask of markers to find. Set bit 0 to find marker 0, bit
-- 1 for marker 1 and so on.
@@ -1583,7 +1582,7 @@ function buffer.marker_previous(buffer, start_line, marker_mask) end
---
-- Set the alpha used for a marker that is drawn in the text area, not the
-- margin.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param marker_num A marker number in the range of 0 to 31.
-- @param alpha An alpha value between 0 (transparent) and 255 (opaque), or 256
-- for no alpha.
@@ -1591,7 +1590,7 @@ function buffer.marker_set_alpha(buffer, marker_num, alpha) end
---
-- Set the background color used for a particular marker number.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param marker_num A marker number in the range of 0 to 31.
-- @param color A color in 0xBBGGRR format.
function buffer.marker_set_back(buffer, marker_num, color) end
@@ -1599,21 +1598,21 @@ function buffer.marker_set_back(buffer, marker_num, color) end
---
-- Set the background color used for a particular marker number when its
-- folding block is selected.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param marker_num A marker number in the range of 0 to 31.
-- @param color A color in 0xBBGGRR format. The default color is #FF0000.
function buffer.marker_set_back_selected(buffer, marker_num, color) end
---
-- Set the foreground color used for a particular marker number.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param marker_num A marker number in the range of 0 to 31.
-- @param color A color in 0xBBGGRR format.
function buffer.marker_set_fore(buffer, marker_num, color) end
---
-- Return the symbol defined for marker_num with `buffer:marker_define()`.
--- @param buffer The focused buffer.
+-- @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
@@ -1621,7 +1620,7 @@ function buffer.marker_symbol_defined(buffer, marker_num) end
---
-- Move the caret inside current view if it's not there already.
-- Any selection is lost.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.move_caret_inside_view(buffer) end
---
@@ -1630,7 +1629,7 @@ function buffer.move_caret_inside_view(buffer) end
-- The selection will be automatically extended to the beginning of the
-- 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 focused buffer.
+-- @param buffer The global buffer.
function buffer.move_selected_lines_down(buffer) end
---
@@ -1639,77 +1638,77 @@ function buffer.move_selected_lines_down(buffer) end
-- The selection will be automatically extended to the beginning of the
-- 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 focused buffer.
+-- @param buffer The global buffer.
function buffer.move_selected_lines_up(buffer) end
---
-- Insert a new line, may use a CRLF, CR or LF depending on EOL mode.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.new_line(buffer) end
---
-- Move caret one page down.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.page_down(buffer) end
---
-- Move caret one page down extending selection to new caret position.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.page_down_extend(buffer) end
---
-- Move caret one page down, extending rectangular selection to new caret
-- position.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.page_down_rect_extend(buffer) end
---
-- Move caret one page up.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.page_up(buffer) end
---
-- Move caret one page up extending selection to new caret position.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.page_up_extend(buffer) end
---
-- Move caret one page up, extending rectangular selection to new caret
-- position.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.page_up_rect_extend(buffer) end
---
-- Move caret one paragraph down (delimited by empty lines).
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.para_down(buffer) end
---
-- Move caret one paragraph down (delimited by empty lines) extending selection
-- to new caret position.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.para_down_extend(buffer) end
---
-- Move caret one paragraph up (delimited by empty lines).
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.para_up(buffer) end
---
-- Move caret one paragraph up (delimited by empty lines) extending selection to
-- new caret position.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.para_up_extend(buffer) end
---
-- Paste the contents of the clipboard into the document replacing the
-- selection.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.paste(buffer) end
---
-- For private communication between an application and a known lexer.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param operation An operation number.
-- @param data Number data.
function buffer.private_lexer_call(buffer, operation, data) end
@@ -1717,7 +1716,7 @@ function buffer.private_lexer_call(buffer, operation, data) end
---
-- Retrieve the x value of the point in the window where a position is
-- displayed.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param pos The position.
-- @return number
function buffer.point_x_from_position(buffer, pos) end
@@ -1725,7 +1724,7 @@ function buffer.point_x_from_position(buffer, pos) end
---
-- Retrieve the y value of the point in the window where a position is
-- displayed.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param pos The position.
-- @return number
function buffer.point_y_from_position(buffer, pos) end
@@ -1733,14 +1732,14 @@ function buffer.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 focused buffer.
+-- @param buffer The global buffer.
-- @param pos The position.
function buffer.position_after(buffer, pos) end
---
-- Given a valid document position, return the previous position taking code
-- page into account. Returns 0 if passed 0.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param pos The position.
-- @return number
function buffer.position_before(buffer, pos) end
@@ -1748,14 +1747,14 @@ function buffer.position_before(buffer, pos) end
---
-- Retrieve the position at the start of a line.
-- If line is greater than the lines in the document, returns -1.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param line The line.
-- @return number
function buffer.position_from_line(buffer, line) end
---
-- Find the position from a point within the window.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param x
-- @param y
-- @return number
@@ -1764,7 +1763,7 @@ function buffer.position_from_point(buffer, x, y) end
---
-- Returns the position from a point within the window, but return -1 if not
-- close to text.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param x
-- @param y
-- @return number
@@ -1772,12 +1771,12 @@ function buffer.position_from_point_close(buffer, x, y) end
---
-- Redoes the next action on the undo history.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.redo(buffer) end
---
-- Register an XPM image for use in autocompletion lists.
--- @param buffer The focused buffer.
+-- @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
@@ -1786,7 +1785,7 @@ function buffer.register_image(buffer, type, xpm_data) end
-- Register an RGBA image for use in autocompletion lists.
-- It has the width and height from `buffer.rgba_image_width` and
-- `buffer.rgba_image_height`.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param type Integer type to register the image with.
-- @param pixels RGBA data as is described for
-- buffer:marker_define_rgba_image().
@@ -1796,7 +1795,7 @@ function buffer.register_rgba_image(buffer, type, pixels) end
-- Replace the selected text with the argument text.
-- The caret is positioned after the inserted text and the caret is scrolled
-- into view.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param text The text.
function buffer.replace_sel(buffer, text) end
@@ -1804,7 +1803,7 @@ function buffer.replace_sel(buffer, text) end
-- Replace the target text with the argument text.
-- After replacement, the target range refers to the replacement text.
-- Returns the length of the replacement text.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param text The text (can contain NULs).
-- @return number
function buffer.replace_target(buffer, text) end
@@ -1815,43 +1814,43 @@ function buffer.replace_target(buffer, text) end
-- matched in the last search operation which were surrounded by \( and \).
-- Returns the length of the replacement text including any change caused by
-- processing the \d patterns.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param text The text (can contain NULs).
-- @return number
function buffer.replace_target_re(buffer, text) end
---
-- Set the main selection to the next selection.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.rotate_selection(buffer) end
---
-- Ensure the caret is visible.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.scroll_caret(buffer) end
---
-- Scroll to end of document.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.scroll_to_end(buffer) end
---
-- Scroll to start of document.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.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 focused buffer.
+-- @param buffer The global buffer.
function buffer.search_anchor(buffer) end
---
-- Search for a counted string in the target and set the target to the found
-- range.
-- Returns length of range or -1 for failure in which case target is not moved.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param text The text (can contain NULs).
-- @return number
function buffer.search_in_target(buffer, text) end
@@ -1861,7 +1860,7 @@ function buffer.search_in_target(buffer, text) end
-- The return value is -1 if nothing is found, otherwise the return value is the
-- start position of the matching text. The selection is updated to show the
-- matched text, but is not scrolled into view.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param flags Search flags. See `buffer.search_flags`.
-- @param text The text.
-- @return number
@@ -1872,7 +1871,7 @@ function buffer.search_next(buffer, flags, text) end
-- The return value is -1 if nothing is found, otherwise the return value is the
-- start position of the matching text. The selection is updated to show the
-- matched text, but is not scrolled into view.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param flags Search flags. See `buffer.search_flags`.
-- @param text The text.
-- @return number
@@ -1881,13 +1880,13 @@ function buffer.search_prev(buffer, flags, text) end
---
-- Select all the text in the document.
-- The current position is not scrolled into view.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.select_all(buffer) end
---
-- Duplicate the selection.
-- If selection empty duplicate the line containing the caret.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.selection_duplicate(buffer) end
---
@@ -1895,7 +1894,7 @@ function buffer.selection_duplicate(buffer) end
-- defaults.
-- This sets whitespace to space, tab and other characters with codes less than
-- 0x20, with word characters set to alphanumeric and '_'.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.set_chars_default(buffer) end
---
@@ -1907,7 +1906,7 @@ function buffer.set_empty_selection(buffer, pos) end
---
-- Set some style options for folding.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param flags Mask of fold flags. Flags available are
-- `_SCINTILLA.constants.SC_FOLDFLAG_LINEBEFORE_EXPANDED` (2): Draw above if
-- expanded; `_SCINTILLA.constants.SC_FOLDFLAG_LINEBEFORE_CONTRACTED` (4):
@@ -1919,54 +1918,54 @@ function buffer.set_fold_flags(buffer, flags) end
---
-- Set the colors used as a chequerboard pattern in the fold margin.
--- @param buffer The focused buffer.
+-- @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
---
-- Set the colors used as a chequerboard pattern in the fold margin.
--- @param buffer The focused buffer.
+-- @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
---
-- Set a back color for active hotspots.
--- @param buffer The focused buffer.
+-- @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
---
-- Set a fore color for active hotspots.
--- @param buffer The focused buffer.
+-- @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
---
-- Set the length of the utf8 argument for calling `buffer:encoded_from_utf8()`.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param bytes Bytes or -1 for measuring to first nul.
function buffer.set_length_for_encode(buffer, bytes) end
---
-- Set the lexing language of the document based on string name.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param language_name The language name.
function buffer.set_lexer_language(buffer, language_name) end
---
-- Remember the current position in the undo history as the position at which
-- the document was saved.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.set_save_point(buffer) end
---
-- Select a range of text.
-- The caret is scrolled into view after this operation.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param start_pos Start position. If negative, it means the end of the
-- document.
-- @param end_pos End position. If negative, it means remove any selection (i.e.
@@ -1976,7 +1975,7 @@ function buffer.set_sel(buffer, start_pos, end_pos) end
---
-- Set the background color of the main and additional selections and whether to
-- use this setting.
--- @param buffer The focused buffer.
+-- @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
@@ -1984,14 +1983,14 @@ function buffer.set_sel_back(buffer, use_setting, color) end
---
-- Set the foreground color of the main and additional selections and whether
-- to use this setting.
--- @param buffer The focused buffer.
+-- @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
---
-- Set a simple selection from anchor to caret.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param caret The caret.
-- @param anchor The anchor.
function buffer.set_selection(buffer, caret, anchor) end
@@ -1999,14 +1998,14 @@ function buffer.set_selection(buffer, caret, anchor) end
---
-- Change style from current styling position for length characters to a style
-- and move the current styling position to after this newly styled segment.
--- @param buffer The focused buffer.
+-- @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
---
-- Replace the contents of the document with the argument text.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param text The text.
function buffer.set_text(buffer, text) end
@@ -2014,7 +2013,7 @@ function buffer.set_text(buffer, text) end
-- Set the way the display area is determined when a particular line is to be
-- moved to by `buffer:goto_line()`, etc.
-- It is similar in operation to `buffer:set_y_caret_policy()`.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param visible_policy A combination of `_SCINTILLA.constants.VISIBLE_SLOP`,
-- (0x01) and `_SCINTILLA.constants.VISIBLE_STRICT` (0x04).
-- @param visible_slop The slop value.
@@ -2022,14 +2021,14 @@ function buffer.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 focused buffer.
+-- @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
---
-- Set the foreground color of all whitespace and whether to use this setting.
--- @param buffer The focused buffer.
+-- @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
@@ -2037,7 +2036,7 @@ function buffer.set_whitespace_fore(buffer, use_setting, color) end
---
-- Set the way the caret is kept visible when going sideway.
-- The exclusion zone is given in pixels.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param caret_policy A combination of `_SCINTILLA.constants.CARET_SLOP`
-- (0x01), `_SCINTILLA.constants.CARET_STRICT` (0x04),
-- `_SCINTILLA.constants.CARET_JUMPS` (0x10), and
@@ -2047,7 +2046,7 @@ function buffer.set_x_caret_policy(buffer, caret_policy, caret_slop) end
---
-- Set the way the line the caret is on is kept visible.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param caret_policy A combination of `_SCINTILLA.constants.CARET_SLOP`
-- (0x01), `_SCINTILLA.constants.CARET_STRICT` (0x04),
-- `_SCINTILLA.constants.CARET_JUMPS` (0x10), and
@@ -2059,94 +2058,94 @@ function buffer.set_y_caret_policy(buffer, caret_policy, caret_slop) end
-- Make a range of lines visible.
-- This has no effect on fold levels or fold flags. start_line can not be
-- hidden.
--- @param buffer The focused buffer.
+-- @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
---
-- Start notifying the container of all key presses and commands.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.start_record(buffer) end
---
-- Set the current styling position to pos and the styling mask to mask.
-- The styling mask can be used to protect some bits in each styling byte from
-- modification.
--- @param buffer The focused buffer.
+-- @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
---
-- Stop notifying the container of all key presses and commands.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.stop_record(buffer) end
---
-- Move caret to bottom of page, or one page down if already at bottom of page.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.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 focused buffer.
+-- @param buffer The global buffer.
function buffer.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 focused buffer.
+-- @param buffer The global buffer.
function buffer.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 focused buffer.
+-- @param buffer The global buffer.
function buffer.stuttered_page_up_extend(buffer) end
---
-- Clear all the styles and make equivalent to the global default style.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.style_clear_all(buffer) end
---
-- Returns the font name of a given style.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param style_num The style number.
-- @return string
function buffer.style_get_font(buffer, style_num) end
---
-- Reset the default style to its state at startup.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.style_reset_default(buffer) end
---
-- Swap that caret and anchor of the main selection.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.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 focused buffer.
+-- @param buffer The global buffer.
function buffer.tab(buffer) end
---
-- Returns the target converted to UTF8.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.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 focused buffer.
+-- @param buffer The global buffer.
function buffer.target_from_selection(buffer) end
---
-- Retrieve the height of a particular line of text in pixels.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param line The line number.
-- @return number
function buffer.text_height(buffer, line) end
@@ -2154,7 +2153,7 @@ function buffer.text_height(buffer, line) end
---
-- Measure the pixel width of some text in a particular style.
-- Does not handle tab or control characters.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param style_num The style number.
-- @param text The text.
-- @return number
@@ -2163,35 +2162,35 @@ function buffer.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 focused buffer.
+-- @param buffer The global buffer.
function buffer.toggle_caret_sticky(buffer) end
---
-- Switch a header line between expanded and contracted.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param line The line number.
function buffer.toggle_fold(buffer, line) end
---
-- Undo one action in the undo history.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.undo(buffer) end
---
-- Transform the selection to upper case.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.upper_case(buffer) end
---
-- Sets whether a pop up menu is displayed automatically when the user presses
-- the wrong mouse button.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param allow_popup Allow popup menu.
function buffer.use_pop_up(buffer, allow_popup) end
---
-- Display a list of strings and send notification when user chooses one.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param list_type A list identifier number greater than zero.
-- @param item_list List of words separated by separator characters (initially
-- spaces).
@@ -2201,50 +2200,50 @@ function buffer.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 focused buffer.
+-- @param buffer The global buffer.
function buffer.vc_home(buffer) end
---
-- Like `buffer:vc_home()` but extending selection to new caret position.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.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 focused buffer.
+-- @param buffer The global buffer.
function buffer.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 focused buffer.
+-- @param buffer The global buffer.
function buffer.vc_home_wrap(buffer) end
---
-- Like `buffer:vc_home_wrap()` but extending selection to new caret position.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.vc_home_wrap_extend(buffer) end
---
-- Center current line in window.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.vertical_centre_caret(buffer) end
---
-- Find the display line of a document line taking hidden lines into account.
-- If there is folding and line is outside the range of lines in the document,
-- the return value is -1.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param line The line number.
-- @return number
function buffer.visible_from_doc_line(buffer, line) end
---
-- Get position of end of word.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param pos The position.
-- @param only_word_chars If `true`, stops searching at the first non-word
-- character in the search direction. Otherwise, the first character in the
@@ -2255,71 +2254,71 @@ function buffer.word_end_position(buffer, pos, only_word_chars) end
---
-- Move caret left one word.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.word_left(buffer) end
---
-- Move caret left one word, position cursor at end of word.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.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 focused buffer.
+-- @param buffer The global buffer.
function buffer.word_left_end_extend(buffer) end
---
-- Move caret left one word extending selection to new caret position.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.word_left_extend(buffer) end
---
-- Move to the previous change in capitalisation or underscores.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.word_part_left(buffer) end
---
-- Move to the previous change in capitalisation or underscores extending
-- selection to new caret position.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.word_part_left_extend(buffer) end
---
-- Move to the next change in capitalisation or underscores.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.word_part_right(buffer) end
---
-- Move to the next change in capitalisation or underscores extending selection
-- to new caret position.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.word_part_right_extend(buffer) end
---
-- Move caret right one word.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.word_right(buffer) end
---
-- Move caret right one word, position cursor at end of word.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.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 focused buffer.
+-- @param buffer The global buffer.
function buffer.word_right_end_extend(buffer) end
---
-- Move caret right one word extending selection to new caret position.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.word_right_extend(buffer) end
---
-- Get position of start of word.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param pos The position.
-- @param only_word_chars If `true`, stops searching at the first non-word
-- character in the search direction. Otherwise, the first character in the
@@ -2330,7 +2329,7 @@ function buffer.word_start_position(buffer, pos, only_word_chars) end
---
-- Returns the number of display lines needed to wrap a document line.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param line The line number.
-- @return number
function buffer.wrap_count(buffer, line) end
@@ -2338,40 +2337,49 @@ function buffer.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 focused buffer.
+-- @param buffer The global buffer.
function buffer.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 focused buffer.
+-- @param buffer The global buffer.
function buffer.zoom_out(buffer) end
-- External functions.
---
--- Gets a range of text from the current buffer.
--- @param buffer The currently focused 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
+-- Checks whether the given buffer is the global one.
+-- If not, throws an error indicating so. It is necessary to call this at the
+-- top of all buffer functions to avoid unexpected behavior since most buffer
+-- functions operate on the global 'buffer', which is not necessarily the given
+-- one.
+-- @param buffer The buffer to check.
+function buffer.check_global(buffer) end
---
-- Deletes the current buffer.
-- WARNING: this function should NOT be called via scripts. io provides a
-- close() function for buffers to prompt for confirmation if necessary; this
-- function does not. Activates the 'buffer_deleted' signal.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.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
+
+---
-- Reloads the file in a given buffer.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.reload(buffer) end
---
-- Sets the encoding for the buffer, converting its contents in the process.
--- @param buffer The focused buffer.
+-- @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).
-- @usage buffer.set_encoding(buffer, 'ASCII')
@@ -2379,19 +2387,19 @@ function buffer.set_encoding(buffer) end
---
-- Saves the current buffer to a file.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.save(buffer) end
---
-- Saves the current buffer to a file different than its filename property.
--- @param buffer The focused buffer.
+-- @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) end
---
-- Closes the current buffer.
--- @param buffer The focused 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
@@ -2402,25 +2410,26 @@ function buffer.close(buffer) end
-- mime-types tables. Also if the user manually sets the lexer, it should be
-- restored.
-- Loads the language-specific module if it exists.
--- @param buffer The focused buffer.
+-- @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
---
-- Replacement for buffer.get_lexer_language(buffer).
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
function buffer.get_lexer(buffer) end
---
-- Returns the name of the style associated with a style number.
--- @param buffer The focused buffer.
+-- @param buffer The global buffer.
-- @param style_num A style number in the range 0 <= style_num < 256.
-- @see buffer.style_at
function buffer.get_style_name(buffer, style_num) end
-- Unused Fields.
-- * use_palette
+-- * doc_pointer
-- * mod_event_mask
-- * paste_convert_endings
-- * character_pointer
diff --git a/core/.gui.luadoc b/core/.gui.luadoc
index 56e576df..38001ea9 100644
--- a/core/.gui.luadoc
+++ b/core/.gui.luadoc
@@ -9,8 +9,6 @@ module('gui')
-- ## Fields
--
-- * `title` [string]: The title of the Textadept window.
--- * `focused_doc_pointer` [number]: The pointer to the document associated with
--- the buffer of the currently focused view. (Read-only)
-- * `menubar` [table]: A table of GTK menus defining a menubar. (Write-only)
-- * `context_menu`: A GTK menu defining the editor's context menu.
-- * `clipboard_text` [string]: The text on the clipboard. (Read-only)
@@ -23,8 +21,9 @@ module('gui')
-- Goes to the specified view.
-- Activates the 'view_*_switch' signal.
-- @param n A relative or absolute view index.
--- @param absolute Flag indicating if n is an absolute index or not.
-function goto_view(n, absolute) end
+-- @param relative Flag indicating if n is a relative index or not. Defaults to
+-- false.
+function goto_view(n, relative) end
---
-- Gets the current split view structure.
@@ -38,24 +37,18 @@ function get_split_table() end
---
-- Creates a GTK menu, returning the userdata.
-- @param menu_table A table defining the menu. It is an ordered list of tables
--- with a string menu item and integer menu ID.
--- The string menu item is handled as follows:
+-- with a string menu item, integer menu ID, and optional keycode and modifier
+-- mask. The latter two are used to display key shortcuts in the menu. The
+-- string menu item is handled as follows:
-- 'gtk-*' - a stock menu item is created based on the GTK stock-id.
-- 'separator' - a menu separator item is created.
-- Otherwise a regular menu item with a mnemonic is created.
-- Submenus are just nested menu-structure tables. Their title text is defined
-- with a 'title' key.
+-- @see keys.get_gdk_key
function gtkmenu(menu_table) end
---
--- Checks if the buffer being indexed is the currently focused buffer.
--- This is necessary because any buffer actions are performed in the focused
--- views' buffer, which may not be the buffer being indexed. Throws an error
--- if the check fails.
--- @param buffer The buffer in question.
-function check_focused_buffer(buffer) 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
diff --git a/core/.view.luadoc b/core/.view.luadoc
index bf2fe95c..6bf1fe37 100644
--- a/core/.view.luadoc
+++ b/core/.view.luadoc
@@ -10,14 +10,14 @@ module('view')
-- Markdown:
-- ## Fields
--
--- * `doc_pointer` [number]: The pointer to the document associated with this
--- view's buffer. (Read-only)
+-- * `buffer` [table]: The buffer this view contains. (Read-only)
-- * `size` [number]: The position of the split resizer (if this view is part of
-- a split view).
---
-- Splits the indexed view vertically or horizontally and focuses the new view.
--- @param vertical Flag indicating a vertical split. False for horizontal.
+-- @param vertical Flag indicating a vertical split. Defaults to false for
+-- horizontal.
-- @return old view and new view tables.
function view:split(vertical) end
@@ -29,11 +29,8 @@ function view:unsplit() end
---
-- Goes to the specified buffer in the indexed view.
-- Activates the 'buffer_*_switch' signals.
--- @param n A relative or absolute buffer index.
--- @param absolute Flag indicating if n is an absolute index or not.
-function view:goto_buffer(n, absolute) end
-
----
--- Focuses the indexed view if it hasn't been already.
-function view:focus() end
-
+-- @param n A relative or absolute buffer index. An absolute index of -1 goes
+-- to the last buffer.
+-- @param relative Flag indicating if n is a relative index or not. Defaults to
+-- false.
+function view:goto_buffer(n, relative) end
diff --git a/core/file_io.lua b/core/file_io.lua
index 750f0827..a5c42a20 100644
--- a/core/file_io.lua
+++ b/core/file_io.lua
@@ -188,7 +188,7 @@ end
-- LuaDoc is in core/.buffer.luadoc.
local function reload(buffer)
if not buffer then buffer = _G.buffer end
- gui.check_focused_buffer(buffer)
+ buffer:check_global()
if not buffer.filename then return end
local pos, first_visible_line = buffer.current_pos, buffer.first_visible_line
local filename = buffer.filename:iconv(_CHARSET, 'UTF-8')
@@ -209,7 +209,7 @@ end
-- LuaDoc is in core/.buffer.luadoc.
local function set_encoding(buffer, encoding)
- gui.check_focused_buffer(buffer)
+ buffer:check_global()
if not buffer.encoding then error(L('Cannot change binary file encoding')) end
local pos, first_visible_line = buffer.current_pos, buffer.first_visible_line
local text = buffer:get_text(buffer.length)
@@ -226,7 +226,7 @@ end
-- LuaDoc is in core/.buffer.luadoc.
local function save(buffer)
if not buffer then buffer = _G.buffer end
- gui.check_focused_buffer(buffer)
+ buffer:check_global()
if not buffer.filename then return buffer:save_as() end
events.emit(events.FILE_BEFORE_SAVE, buffer.filename)
local text = buffer:get_text(buffer.length)
@@ -248,7 +248,7 @@ end
-- LuaDoc is in core/.buffer.luadoc.
local function save_as(buffer, utf8_filename)
if not buffer and not utf8_filename then buffer = _G.buffer end
- gui.check_focused_buffer(buffer)
+ buffer:check_global()
if not utf8_filename then
utf8_filename = gui.dialog('filesave',
'--title', L('Save'),
@@ -281,7 +281,7 @@ end
-- LuaDoc is in core/.buffer.luadoc.
local function close(buffer)
if not buffer then buffer = _G.buffer end
- gui.check_focused_buffer(buffer)
+ buffer:check_global()
if buffer.dirty and
gui.dialog('msgbox',
'--title', L('Close without saving?'),
@@ -353,7 +353,7 @@ end)
events.connect(events.FILE_OPENED, function(utf8_filename)
local b = _BUFFERS[1]
if #_BUFFERS == 2 and not (b.filename or b._type or b.dirty) then
- view:goto_buffer(1, true)
+ view:goto_buffer(1)
buffer:close()
end
end)
diff --git a/core/gui.lua b/core/gui.lua
index 467864d0..40e6ce4a 100644
--- a/core/gui.lua
+++ b/core/gui.lua
@@ -3,56 +3,47 @@
local L = locale.localize
local gui = gui
--- LuaDoc is in core/.gui.luadoc.
-function gui.check_focused_buffer(buffer)
- if type(buffer) ~= 'table' or not buffer.doc_pointer then
- error(L('Buffer argument expected.'), 2)
- elseif gui.focused_doc_pointer ~= buffer.doc_pointer then
- error(L('This buffer is not the current one.'), 2)
- end
-end
-
--- LuaDoc is in core/.gui.luadoc.
-function gui._print(buffer_type, ...)
- local function safe_print(...)
- if buffer._type ~= buffer_type then
- -- Try to find a message buffer to print to. Otherwise create one.
- local message_buffer, message_buffer_index
- local message_view, message_view_index
- for i, buffer in ipairs(_BUFFERS) do
- if buffer._type == buffer_type then
- message_buffer, message_buffer_index = buffer, i
- for j, view in ipairs(_VIEWS) do
- if view.doc_pointer == message_buffer.doc_pointer then
- message_view, message_view_index = view, j
- break
- end
+-- TODO:
+-- @param buffer_type
+-- @param ...
+local function _print(buffer_type, ...)
+ if buffer._type ~= buffer_type then
+ -- Try to find a message buffer to print to. Otherwise create one.
+ local message_buffer, message_view
+ for _, buffer in ipairs(_BUFFERS) do
+ if buffer._type == buffer_type then
+ message_buffer = buffer
+ for _, view in ipairs(_VIEWS) do
+ if view.buffer == message_buffer then
+ message_view = view
+ break
end
- break
end
+ break
end
- if not message_view then
- local _, message_view = view:split(false) -- horizontal split
- if not message_buffer then
- message_buffer = new_buffer()
- message_buffer._type = buffer_type
- events.emit(events.FILE_OPENED)
- else
- message_view:goto_buffer(message_buffer_index, true)
- end
+ end
+ if not message_view then
+ local _, message_view = view:split()
+ if not message_buffer then
+ message_buffer = new_buffer()
+ message_buffer._type = buffer_type
+ events.emit(events.FILE_OPENED)
else
- gui.goto_view(message_view_index, true)
+ message_view:goto_buffer(_BUFFERS[message_buffer])
end
+ else
+ gui.goto_view(_VIEWS[message_view])
end
- local args, n = {...}, select('#', ...)
- for i = 1, n do args[i] = tostring(args[i]) end
- buffer:append_text(table.concat(args, '\t'))
- buffer:append_text('\n')
- buffer:goto_pos(buffer.length)
- buffer:set_save_point()
end
- pcall(safe_print, ...) -- prevent endless loops on error
+ local args, n = {...}, select('#', ...)
+ for i = 1, n do args[i] = tostring(args[i]) end
+ buffer:append_text(table.concat(args, '\t'))
+ buffer:append_text('\n')
+ buffer:goto_pos(buffer.length)
+ buffer:set_save_point()
end
+-- LuaDoc is in core/.gui.luadoc.
+function gui._print(buffer_type, ...) pcall(_print, buffer_type, ...) end
-- LuaDoc is in core/.gui.luadoc.
function gui.print(...) gui._print(L('[Message Buffer]'), ...) end
@@ -84,7 +75,7 @@ function gui.switch_buffer()
items[#items + 1] = filename
end
local i = gui.filteredlist(L('Switch Buffers'), columns, items, true)
- if i then view:goto_buffer(i + 1, true) end
+ if i then view:goto_buffer(i + 1) end
end
local connect = events.connect
diff --git a/core/locale.conf b/core/locale.conf
index 295e44b2..c272c343 100644
--- a/core/locale.conf
+++ b/core/locale.conf
@@ -32,8 +32,6 @@ has been modified. Reload it? = has been modified. Reload it?
File = File
% core/gui.lua
-Buffer argument expected. = Buffer argument expected.
-This buffer is not the current one. = This buffer is not the current one.
[Message Buffer] = [Message Buffer]
Name = Name
%File = File
diff --git a/core/locales/locale.ru.conf b/core/locales/locale.ru.conf
index eee3757e..8ec93ec1 100644
--- a/core/locales/locale.ru.conf
+++ b/core/locales/locale.ru.conf
@@ -32,8 +32,6 @@ Reload modified file? = Перезагрузить файл Ñ Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ñ
has been modified. Reload it? = был изменён. Открыть заново?
% core/gui.lua
-Buffer argument expected. = Ðеобходим аргумент Ð´Ð»Ñ Ð±ÑƒÑ„ÐµÑ€Ð°.
-This buffer is not the current one. = Это не текущий буфер.
[Message Buffer] = [Буфер Ñообщений]
Name = Ðазвание
%File = Файл
diff --git a/modules/lua/api b/modules/lua/api
index e60ed9d9..fd0f3bc1 100644
--- a/modules/lua/api
+++ b/modules/lua/api
@@ -41,6 +41,8 @@ DEFAULT lexer.DEFAULT\n\n
DEFAULT_DEPTH _m.textadept.snapopen.DEFAULT_DEPTH [number]\nMaximum directory depth to search. The default value is 4.\n
DEFAULT_SESSION _m.textadept.session.DEFAULT_SESSION [string]\nThe path to the default session file.\n
DOUBLE_CLICK events.DOUBLE_CLICK\nCalled when the mouse button is double-clicked.\n * `position`: The text position of the double click.\n * `line`: The line of the double click.\n * `modifiers`: The key modifiers held down. It is a combination of zero\n or more of `_SCINTILLA.constants.SCMOD_ALT`,\n `_SCINTILLA.constants.SCMOD_CTRL`,\n `_SCINTILLA.constants.SCMOD_SHIFT`, and\n `_SCINTILLA.constants.SCMOD_META`.\n\n
+DWELL_END events.DWELL_END\nCalled after a `DWELL_START` and the mouse is moved or other activity such\nas key press indicates the dwell is over.\n * `position`: The nearest position in the document to the position\n where the mouse pointer was lingering.\n * `x`: Where the pointer lingered.\n * `y`: Where the pointer lingered.\n\n
+DWELL_START events.DWELL_START\nCalled when the user keeps the mouse in one position for the dwell period\n(see `_SCINTILLA.constants.SCI_SETMOUSEDWELLTIME`).\n * `position`: The nearest position in the document to the position\n where the mouse pointer was lingering.\n * `x`: Where the pointer lingered.\n * `y`: Where the pointer lingered.\n\n
EDGE_BACKGROUND _SCINTILLA.constants.EDGE_BACKGROUND\n2\n
EDGE_LINE _SCINTILLA.constants.EDGE_LINE\n1\n
EDGE_NONE _SCINTILLA.constants.EDGE_NONE\n0\n
@@ -58,7 +60,6 @@ HIGHLIGHT_BRACES _m.textadept.editing.HIGHLIGHT_BRACES [bool]\nHighlight matchin
HOTSPOT_CLICK events.HOTSPOT_CLICK\nCalled when the user clicks on text that is in a style with the hotspot\nattribute set.\n * `position`: The text position of the click.\n * `modifiers`: The key modifiers held down. It is a combination of zero\n or more of `_SCINTILLA.constants.SCMOD_ALT`,\n `_SCINTILLA.constants.SCMOD_CTRL`,\n `_SCINTILLA.constants.SCMOD_SHIFT`, and\n `_SCINTILLA.constants.SCMOD_META`.\n\n
HOTSPOT_DOUBLE_CLICK events.HOTSPOT_DOUBLE_CLICK\nCalled when the user double clicks on text that is in a style with the\nhotspot attribute set.\n * `position`: The text position of the double click.\n * `modifiers`: The key modifiers held down. It is a combination of zero\n or more of `_SCINTILLA.constants.SCMOD_ALT`,\n `_SCINTILLA.constants.SCMOD_CTRL`,\n `_SCINTILLA.constants.SCMOD_SHIFT`, and\n `_SCINTILLA.constants.SCMOD_META`.\n\n
HOTSPOT_RELEASE_CLICK events.HOTSPOT_RELEASE_CLICK\nCalled when the user releases the mouse on text that is in a style with the\nhotspot attribute set.\n * `position`: The text position of the release.\n\n
-HUGE_VAL math.HUGE_VAL\nThe value `HUGE_VAL`, a value larger than or equal to any other numerical\nvalue.\n
IDENTIFIER lexer.IDENTIFIER\n\n
INDIC0_MASK _SCINTILLA.constants.INDIC0_MASK\n32\n
INDIC1_MASK _SCINTILLA.constants.INDIC1_MASK\n64\n
@@ -696,7 +697,7 @@ VISIBLE_SLOP _SCINTILLA.constants.VISIBLE_SLOP\n1\n
VISIBLE_STRICT _SCINTILLA.constants.VISIBLE_STRICT\n4\n
WHITESPACE lexer.WHITESPACE\n\n
WIN32 _G.WIN32 [bool]\nIf Textadept is running on Windows, this flag is `true`.\n
-_BUFFERS _G._BUFFERS [table]\nA numerically indexed table of open buffers in Textadept.\n
+_BUFFERS _G._BUFFERS [table]\nTable of all open buffers in Textadept. Numeric keys have buffer values and\nbuffer keys have their associated numeric keys.\n
_CHARSET _G._CHARSET [string]\nThe character set encoding of the filesystem. This is used in File I/O.\n
_EMBEDDEDRULES lexer._EMBEDDEDRULES [table]\nSet of rules for an embedded lexer. For a parent lexer name, contains child's\n`start_rule`, `token_rule`, and `end_rule` patterns.\n
_G _G._G [module]\nLua _G module.\n
@@ -709,7 +710,7 @@ _SCINTILLA _G._SCINTILLA [module]\nScintilla constants, functions, and propertie
_THEME _G._THEME [string]\nThe theme file to use.\n
_USERHOME _G._USERHOME [string]\nPath to the user's `~/.textadept/`.\n
_VERSION _G._VERSION\nA global variable (not a function) that holds a string containing the current\ninterpreter version. The current contents of this variable is "`Lua 5.1`".\n
-_VIEWS _G._VIEWS [table]\nA numerically indexed table of views in Textadept.\n
+_VIEWS _G._VIEWS [table]\nTable of all views in Textadept. Numeric keys have view values and view keys\nhave their associated numeric keys.\n
_cancel_current _m.textadept.snippets._cancel_current()\nCancels the active snippet, reverting to the state before its activation,\nand restores the previously running snippet (if any).\n
_insert _m.textadept.snippets._insert(text)\nInserts a snippet.\n@param text Optional snippet text. If none is specified, the snippet text\nis determined from the trigger and lexer.\n@return false if no snippet was expanded; true otherwise.\n
_m _G._m [module]\nA table of loaded modules.\n
@@ -719,8 +720,8 @@ _select _m.textadept.snippets._select()\nPrompts the user to select a snippet to
abs math.abs(x)\nReturns the absolute value of `x`.\n
acos math.acos(x)\nReturns the arc cosine of `x` (in radians).\n
add _m.textadept.bookmarks.add()\nAdds a bookmark to the current line.\n
-add_selection buffer.add_selection(buffer, caret, anchor)\nAdd a selection from anchor to caret as the main selection. Retainings all\nother selections as additional selections. Since there is always at least one\nselection, to set a list of selections, the first selection should be added\nwith `buffer:set_selection()` and later selections added with this function.\n@param buffer The focused buffer.\n@param caret The caret.\n@param anchor The anchor.\n
-add_text buffer.add_text(buffer, text)\nAdd text to the document at current position. The current position is set\nat the end of the inserted text, but it is not scrolled into view.\n@param buffer The focused buffer.\n@param text The text to add.\n
+add_selection buffer.add_selection(buffer, caret, anchor)\nAdd a selection from anchor to caret as the main selection. Retainings all\nother selections as additional selections. Since there is always at least one\nselection, to set a list of selections, the first selection should be added\nwith `buffer:set_selection()` and later selections added with this function.\n@param buffer The global buffer.\n@param caret The caret.\n@param anchor The anchor.\n
+add_text buffer.add_text(buffer, text)\nAdd text to the document at current position. The current position is set\nat the end of the inserted text, but it is not scrolled into view.\n@param buffer The global buffer.\n@param text The text to add.\n
add_trigger _m.textadept.adeptsense.add_trigger(sense, c, only_fields, only_functions)\nSets the trigger for autocompletion.\n@param sense The adeptsense returned by adeptsense.new().\n@param c The character(s) that triggers the autocompletion. You can have up\nto two characters.\n@param only_fields If true, this trigger only completes fields. Defaults\nto false.\n@param only_functions If true, this trigger only completes functions. Defaults\nto false.\n@usage sense:add_trigger('.')\n@usage sense:add_trigger(':', false, true) -- only functions\n@usage sense:add_trigger('->')\n
additional_caret_fore buffer.additional_caret_fore [number]\nThe foreground color of additional carets in 0xBBGGRR format.\n
additional_carets_blink buffer.additional_carets_blink [bool]\nWhether additional carets will blink.\n
@@ -730,21 +731,21 @@ additional_sel_back buffer.additional_sel_back [number]\nThe background color of
additional_sel_fore buffer.additional_sel_fore [number]\nThe foreground color of additional selections in 0xBBGGRR\nformat. `buffer:set_sel_fore(true, ...)` must have been called previously\nfor this to have an effect.\n
additional_selection_typing buffer.additional_selection_typing [bool]\nWhether typing can be performed into multiple selections.\n
adeptsense _m.textadept.adeptsense [module]\nLanguage autocompletion support for the textadept module.\n
-allocate buffer.allocate(buffer, bytes)\nEnlarge the document to a particular size of text bytes. The document will\nnot be made smaller than its current contents.\n@param buffer The focused buffer.\n
+allocate buffer.allocate(buffer, bytes)\nEnlarge the document to a particular size of text bytes. The document will\nnot be made smaller than its current contents.\n@param buffer The global buffer.\n
alnum lexer.alnum\nMatches any alphanumeric character (`A-Z`, `a-z`, `0-9`).\n
alpha lexer.alpha\nMatches any alphabetic character (`A-Z`, `a-z`).\n
always_show_globals _m.textadept.adeptsense.always_show_globals [bool]\nInclude globals in the list of completions offered. Globals are classes,\nfunctions, and fields that do not belong to another class. They are contained\nin `completions['']`. The default value is `true`.\n
anchor buffer.anchor [number]\nThe position of the opposite end of the selection to the caret.\n
-annotation_clear_all buffer.annotation_clear_all(buffer)\nClear the annotations from all lines.\n@param buffer The focused buffer.\n
-annotation_get_text buffer.annotation_get_text(buffer, line)\nGet the annotation text for a line.\n@param buffer The focused buffer.\n@param line The line number.\n@return string\n
+annotation_clear_all buffer.annotation_clear_all(buffer)\nClear the annotations from all lines.\n@param buffer The global buffer.\n
+annotation_get_text buffer.annotation_get_text(buffer, line)\nGet the annotation text for a line.\n@param buffer The global buffer.\n@param line The line number.\n@return string\n
annotation_lines buffer.annotation_lines [table]\nTable of the number of annotation lines for lines starting from\nzero. (Read-only)\n
-annotation_set_text buffer.annotation_set_text(buffer, line, text)\nSet the annotation text for a line.\n@param buffer The focused buffer.\n@param line The line number.\n@param text The text.\n
+annotation_set_text buffer.annotation_set_text(buffer, line, text)\nSet the annotation text for a line.\n@param buffer The global buffer.\n@param line The line number.\n@param text The text.\n
annotation_style buffer.annotation_style [table]\nTable of style numbers for annotations for lines starting at zero.\n
annotation_style_offset buffer.annotation_style_offset [number]\nThe start of the range of style numbers used for annotations. Annotation\nstyles may be completely separated from standard text styles by setting a\nstyle offset. For example, setting this to 512 would allow the annotation\nstyles to be numbered from 512 upto 767 so they do not overlap styles set\nby lexers (or margins if margins offset is 256). Each style number set with\n`buffer.annotation_style` has the offset added before looking up the style.\n
annotation_visible buffer.annotation_visible [number]\nThe visibility of annotations.\n * `_SCINTILLA.constants.ANNOTATION_HIDDEN` (0): Annotations are not\n displayed.\n * `_SCINTILLA.constants.ANNOTATION_STANDARD` (1): Annotations are drawn\n left justified with no adornment.\n * `_SCINTILLA.constants.ANNOTATION_BOXED` (2): Annotations are indented\n to match the text and are surrounded by a box.\n\n
any lexer.any\nMatches any single character.\n
api_files _m.textadept.adeptsense.api_files [table]\nContains a list of api files used by show_apidoc(). Each line in the api file\ncontains a symbol name (not the full symbol) followed by a space character\nand then the symbol's documentation. Since there may be many duplicate symbol\nnames, it is recommended to put the full symbol and arguments, if any, on the\nfirst line. (e.g. Class.function(arg1, arg2, ...)). This allows the correct\ndocumentation to be shown based on the current context. In the documentation,\nnewlines are represented with '\\n'. A '\' before '\\n' escapes the newline.\n
-append_text buffer.append_text(buffer, text)\nAppend a string to the end of the document without changing the selection. The\ncurrent selection is not changed and the new text is not scrolled into view.\n@param buffer The focused buffer.\n@param text The text.\n
+append_text buffer.append_text(buffer, text)\nAppend a string to the end of the document without changing the selection. The\ncurrent selection is not changed and the new text is not scrolled into view.\n@param buffer The global buffer.\n@param text The text.\n
arg _G.arg [table]\nCommand line parameters.\n
args _G.args [module]\nProcesses command line arguments for Textadept.\n
ascii lexer.ascii\nMatches any ASCII character (`0`..`127`).\n
@@ -755,54 +756,55 @@ atan2 math.atan2(y, x)\nReturns the arc tangent of `y/x` (in radians), but uses
attributes lfs.attributes(filepath [, aname])\nReturns a table with the file attributes corresponding to filepath (or\nnil followed by an error message in case of error). If the second optional\nargument is given, then only the value of the named attribute is returned\n(this use is equivalent to lfs.attributes(filepath).aname, but the table is not\ncreated and only one attribute is retrieved from the O.S.). The attributes are\ndescribed as follows; attribute mode is a string, all the others are numbers,\nand the time related attributes use the same time reference of os.time: dev:\non Unix systems, this represents the device that the inode resides on. On\nWindows systems, represents the drive number of the disk containing the file\nino: on Unix systems, this represents the inode number. On Windows systems\nthis has no meaning mode: string representing the associated protection mode\n(the values could be file, directory, link, socket, named pipe, char device,\nblock device or other) nlink: number of hard links to the file uid: user-id\nof owner (Unix only, always 0 on Windows) gid: group-id of owner (Unix only,\nalways 0 on Windows) rdev: on Unix systems, represents the device type, for\nspecial file inodes. On Windows systems represents the same as dev access:\ntime of last access modification: time of last data modification change:\ntime of last file status change size: file size, in bytes blocks: block\nallocated for file; (Unix only) blksize: optimal file system I/O blocksize;\n(Unix only) This function uses stat internally thus if the given filepath is\na symbolic link, it is followed (if it points to another link the chain is\nfollowed recursively) and the information is about the file it refers to. To\nobtain information about the link itself, see function lfs.symlinkattributes.\n
auto_c_active buffer.auto_c_active(buffer)\nIs there an auto-completion list visible?\n@return bool\n
auto_c_auto_hide buffer.auto_c_auto_hide [bool]\nWhether or not autocompletion is hidden automatically when nothing matches. By\ndefault, the list is cancelled if there are no viable matches (the user has\ntyped characters that no longer match a list entry).\n
-auto_c_cancel buffer.auto_c_cancel(buffer)\nRemove the auto-completion list from the screen. A set of characters that\nwill cancel autocompletion can be specified with buffer:auto_c_stops().\n@param buffer The focused buffer.\n
+auto_c_cancel buffer.auto_c_cancel(buffer)\nRemove the auto-completion list from the screen. A set of characters that\nwill cancel autocompletion can be specified with buffer:auto_c_stops().\n@param buffer The global buffer.\n
auto_c_cancel_at_start buffer.auto_c_cancel_at_start [bool]\nWhether auto-completion is cancelled by backspacing to a position before\nwhere the box was created. If `false`, the list is not cancelled until the\ncaret moves before the first character of the word being completed. should\nbe cancelled if the user backspaces to a position before where it was created.\n
auto_c_choose_single buffer.auto_c_choose_single [bool]\nWhether a single item auto-completion list automatically choose the item. The\ndefault is to display the list even if there is only a single item.\n
-auto_c_complete buffer.auto_c_complete(buffer)\nUser has selected an item so remove the list and insert the selection. This\nhas the same effect as the tab key.\n@param buffer The focused buffer.\n
+auto_c_complete buffer.auto_c_complete(buffer)\nUser has selected an item so remove the list and insert the selection. This\nhas the same effect as the tab key.\n@param buffer The global buffer.\n
auto_c_drop_rest_of_word buffer.auto_c_drop_rest_of_word [bool]\nWhether or not autocompletion deletes any word characters after the inserted\ntext upon completion. The default is `false`.\n
auto_c_fill_ups buffer.auto_c_fill_ups [string]\nA set of characters that when typed will cause the autocompletion to choose\nthe selected item. By default, no fillup characters are set. (Write-only)\n
-auto_c_get_current buffer.auto_c_get_current(buffer)\nGet currently selected item position in the auto-completion list.\n@param buffer The focused buffer.\n@return number\n
-auto_c_get_current_text buffer.auto_c_get_current_text(buffer)\nGet currently selected item text in the auto-completion list.\n@param buffer The focused buffer.\n@return string\n
+auto_c_get_current buffer.auto_c_get_current(buffer)\nGet currently selected item position in the auto-completion list.\n@param buffer The global buffer.\n@return number\n
+auto_c_get_current_text buffer.auto_c_get_current_text(buffer)\nGet currently selected item text in the auto-completion list.\n@param buffer The global buffer.\n@return string\n
auto_c_ignore_case buffer.auto_c_ignore_case [bool]\nWhether case is significant when performing auto-completion searches. By\ndefault, matching of characters to list members is case sensitive.\n
auto_c_max_height buffer.auto_c_max_height [number]\nThe maximum height, in rows, of auto-completion and user lists. The default\nis 5 rows.\n
auto_c_max_width buffer.auto_c_max_width [number]\nThe maximum width, in characters, of auto-completion and user lists. Set to\n0 to autosize to fit longest item, which is the default.\n
-auto_c_pos_start buffer.auto_c_pos_start(buffer)\nRetrieve the position of the caret when the auto-completion list was displayed.\n@param buffer The focused buffer.\n@return number\n
-auto_c_select buffer.auto_c_select(buffer, string)\nSelect the item in the auto-completion list that starts with a string. By\ndefault, comparisons are case sensitive, but this can change with\nbuffer.auto_c_ignore_case.\n@param buffer The focused buffer.\n
+auto_c_pos_start buffer.auto_c_pos_start(buffer)\nRetrieve the position of the caret when the auto-completion list was displayed.\n@param buffer The global buffer.\n@return number\n
+auto_c_select buffer.auto_c_select(buffer, string)\nSelect the item in the auto-completion list that starts with a string. By\ndefault, comparisons are case sensitive, but this can change with\nbuffer.auto_c_ignore_case.\n@param buffer The global buffer.\n
auto_c_separator buffer.auto_c_separator [number]\nThe auto-completion list separator character byte. The default is the space\ncharacter.\n
auto_c_show buffer.auto_c_show(buffer, len_entered, item_list)\nDisplay an auto-completion list.\n@param len_entered The number of characters before the caret used to provide\nthe context.\n@param item_list List of words separated by separator characters (initially\nspaces). The list of words should be in sorted order.\n
-auto_c_stops buffer.auto_c_stops(buffer, chars)\nDefine a set of characters that when typed cancel the auto-completion list.\n@param buffer The focused buffer.\n@param chars String list of characters. This list is empty by default.\n
+auto_c_stops buffer.auto_c_stops(buffer, chars)\nDefine a set of characters that when typed cancel the auto-completion list.\n@param buffer The global buffer.\n@param chars String list of characters. This list is empty by default.\n
auto_c_type_separator buffer.auto_c_type_separator [number]\nThe auto-completion list type-separator character byte. The default is\n'?'. Autocompletion list items may display an image as well as text. Each\nimage is first registered with an integer type. Then this integer is included\nin the text of the list separated by a '?' from the text.\n
autocomplete_word _m.textadept.editing.autocomplete_word(word_chars)\nPops up an autocompletion list for the current word based on other words in\nthe document.\n@param word_chars String of chars considered to be part of words.\n@return true if there were completions to show; false otherwise.\n
back_space_un_indents buffer.back_space_un_indents [bool]\nWhether a backspace pressed when caret is within indentation unindents.\n
-back_tab buffer.back_tab(buffer)\nDedent the selected lines.\n@param buffer The focused buffer.\n
-begin_undo_action buffer.begin_undo_action(buffer)\nStart a sequence of actions that is undone and redone as a unit. May be nested.\n@param buffer The focused buffer.\n
+back_tab buffer.back_tab(buffer)\nDedent the selected lines.\n@param buffer The global buffer.\n
+begin_undo_action buffer.begin_undo_action(buffer)\nStart a sequence of actions that is undone and redone as a unit. May be nested.\n@param buffer The global buffer.\n
black lexer.colors.black\nBlack.\n
block_comment _m.textadept.editing.block_comment(comment)\nBlock comments or uncomments code with a given comment string.\n@param comment The comment string inserted or removed from the beginning of\neach line in the selection.\n
blue lexer.colors.blue\nBlue.\n
boms io.boms [table]\nList of byte-order marks (BOMs).\n
bookmarks _m.textadept.bookmarks [module]\nBookmarks for the textadept module.\n
-brace_bad_light buffer.brace_bad_light(buffer, pos)\nHighlight the character at a position indicating there is no matching brace.\n@param buffer The focused buffer.\n@param pos The position or -1 to remove the highlight.\n
-brace_bad_light_indicator buffer.brace_bad_light_indicator(buffer, use_indicator, indic_num)\nUse specified indicator to highlight non matching brace instead of changing\nits style.\n@param buffer The focused buffer.\n@param use_indicator Use an indicator.\n@param indic_num The indicator number.\n
-brace_highlight buffer.brace_highlight(buffer, pos1, pos2)\nHighlight the characters at two positions. If indent guides are enabled,\nthe indent that corresponds with the brace can be highlighted by\nlocating the column with `buffer.column` and highlight the indent with\n`buffer.highlight_guide`.\n@param buffer The focused buffer.\n@param pos1 The first position.\n@param pos2 The second position.\n
-brace_highlight_indicator buffer.brace_highlight_indicator(buffer, use_indicator, indic_num)\nUse specified indicator to highlight matching braces instead of changing\ntheir style.\n@param buffer The focused buffer.\n@param use_indicator Use an indicator.\n@param indic_num The indicator number.\n
-brace_match buffer.brace_match(buffer, pos)\nFind the position of a matching brace or -1 if no match. The brace characters\nhandled are '(', ')', '[', ']', '{', '}', '<', and '>'. The search is\nforwards from an opening brace and backwards from a closing brace. A match\nonly occurs if the style of the matching brace is the same as the starting\nbrace or the matching brace is beyond the end of styling. Nested braces are\nhandled correctly.\n@param buffer The focused buffer.\n@param pos The position.\n@return number.\n
+brace_bad_light buffer.brace_bad_light(buffer, pos)\nHighlight the character at a position indicating there is no matching brace.\n@param buffer The global buffer.\n@param pos The position or -1 to remove the highlight.\n
+brace_bad_light_indicator buffer.brace_bad_light_indicator(buffer, use_indicator, indic_num)\nUse specified indicator to highlight non matching brace instead of changing\nits style.\n@param buffer The global buffer.\n@param use_indicator Use an indicator.\n@param indic_num The indicator number.\n
+brace_highlight buffer.brace_highlight(buffer, pos1, pos2)\nHighlight the characters at two positions. If indent guides are enabled,\nthe indent that corresponds with the brace can be highlighted by\nlocating the column with `buffer.column` and highlight the indent with\n`buffer.highlight_guide`.\n@param buffer The global buffer.\n@param pos1 The first position.\n@param pos2 The second position.\n
+brace_highlight_indicator buffer.brace_highlight_indicator(buffer, use_indicator, indic_num)\nUse specified indicator to highlight matching braces instead of changing\ntheir style.\n@param buffer The global buffer.\n@param use_indicator Use an indicator.\n@param indic_num The indicator number.\n
+brace_match buffer.brace_match(buffer, pos)\nFind the position of a matching brace or -1 if no match. The brace characters\nhandled are '(', ')', '[', ']', '{', '}', '<', and '>'. The search is\nforwards from an opening brace and backwards from a closing brace. A match\nonly occurs if the style of the matching brace is the same as the starting\nbrace or the matching brace is beyond the end of styling. Nested braces are\nhandled correctly.\n@param buffer The global buffer.\n@param pos The position.\n@return number.\n
braces _m.textadept.editing.braces [table]\nHighlighted brace characters. Keys are lexer language names and values\nare tables of characters that count as brace characters. This table can be\npopulated by language-specific modules.\n
-buffer _G.buffer [module]\nThe current buffer in the currently focused view. It also represents the\nstructure of any buffer table in 'buffers'.\n
+buffer _G.buffer [module]\nThe current buffer in the current view. It also represents the structure of\nany buffer table in 'buffers'.\n
+buffer view.buffer [table]\nThe buffer this view contains. (Read-only)\n
buffered_draw buffer.buffered_draw [bool]\nWhether drawing is buffered. If drawing is buffered then each line of text\nis drawn into a bitmap buffer before drawing it to the screen to avoid\nflicker. The default is for drawing to be buffered. first or directly onto\nthe screen.\n
byte string.byte(s [, i [, j]])\nReturns the internal numerical codes of the characters `s[i]`, `s[i+1]`,\n···, `s[j]`. The default value for `i` is 1; the default value for `j` is\n`i`. Note that numerical codes are not necessarily portable across platforms.\n
-call_tip_active buffer.call_tip_active(buffer)\nIs there an active call tip?\n@param buffer The focused buffer.\n@return bool\n
+call_tip_active buffer.call_tip_active(buffer)\nIs there an active call tip?\n@param buffer The global buffer.\n@return bool\n
call_tip_back buffer.call_tip_back [number]\nThe background color for the call tip in 0xBBGGRR format. (Write-only)\n
-call_tip_cancel buffer.call_tip_cancel(buffer)\nRemove the call tip from the screen. Call tips are also removed if any\nkeyboard commands that are not compatible with editing the argument list of\na function are used.\n@param buffer The focused buffer.\n
+call_tip_cancel buffer.call_tip_cancel(buffer)\nRemove the call tip from the screen. Call tips are also removed if any\nkeyboard commands that are not compatible with editing the argument list of\na function are used.\n@param buffer The global buffer.\n
call_tip_fore buffer.call_tip_fore [number]\nThe foreground color for the call tip in 0xBBGGRR format. (Write-only)\n
call_tip_fore_hlt buffer.call_tip_fore_hlt [number]\nThe foreground color for the highlighted part of the call tip in 0xBBGGRR\nformat. (Write-only)\n
-call_tip_pos_start buffer.call_tip_pos_start(buffer)\nRetrieve the position where the caret was before displaying the call tip.\n@param buffer The focused buffer.\n@return number\n
-call_tip_set_hlt buffer.call_tip_set_hlt(buffer, start_pos, end_pos)\nHighlights a segment of a call tip.\n@param buffer The focused buffer.\n@param start_pos The start position.\n@param end_pos The end position.\n
-call_tip_show buffer.call_tip_show(buffer, pos, text)\nShow a call tip containing a definition near position pos. The call tip text\nis aligned to start 1 line below this character unless up and/or down arrows\nhave been included in the call tip text in which case the tip is aligned to\nthe right-hand edge of the rightmost arrow. The assumption is that the text\nstarts with something like "\001 1 of 3 \002".\n@param buffer The focused buffer.\n@param pos The position.\n@param text The text.\n
+call_tip_pos_start buffer.call_tip_pos_start(buffer)\nRetrieve the position where the caret was before displaying the call tip.\n@param buffer The global buffer.\n@return number\n
+call_tip_set_hlt buffer.call_tip_set_hlt(buffer, start_pos, end_pos)\nHighlights a segment of a call tip.\n@param buffer The global buffer.\n@param start_pos The start position.\n@param end_pos The end position.\n
+call_tip_show buffer.call_tip_show(buffer, pos, text)\nShow a call tip containing a definition near position pos. The call tip text\nis aligned to start 1 line below this character unless up and/or down arrows\nhave been included in the call tip text in which case the tip is aligned to\nthe right-hand edge of the rightmost arrow. The assumption is that the text\nstarts with something like "\001 1 of 3 \002".\n@param buffer The global buffer.\n@param pos The position.\n@param text The text.\n
call_tip_use_style buffer.call_tip_use_style [number]\nEnable use of `_SCINTILLA.constants.STYLE_CALLTIP` and set call tip tab\nsize in pixels. If the tab size is less than 1, Tab characters are not\ntreated specially.\n
-can_paste buffer.can_paste(buffer)\nWill a paste succeed?\n@param buffer The focused buffer.\n@return bool\n
-can_redo buffer.can_redo(buffer)\nAre there any redoable actions in the undo history?\n@param buffer The focused buffer.\n@return bool\n
-can_undo buffer.can_undo(buffer)\nAre there any undoable actions in the undo history?\n@param buffer The focused buffer.\n@return bool\n
-cancel buffer.cancel(buffer)\nCancel any modes such as call tip or auto-completion list display.\n@param buffer The focused buffer.\n
+can_paste buffer.can_paste(buffer)\nWill a paste succeed?\n@param buffer The global buffer.\n@return bool\n
+can_redo buffer.can_redo(buffer)\nAre there any redoable actions in the undo history?\n@param buffer The global buffer.\n@return bool\n
+can_undo buffer.can_undo(buffer)\nAre there any undoable actions in the undo history?\n@param buffer The global buffer.\n@return bool\n
+cancel buffer.cancel(buffer)\nCancel any modes such as call tip or auto-completion list display.\n@param buffer The global buffer.\n
caret_fore buffer.caret_fore [number]\nThe foreground color of the caret in 0xBBGGRR format.\n
caret_line_back buffer.caret_line_back [number]\nThe color of the background of the line containing the caret in 0xBBGGRR\nformat.\n
caret_line_back_alpha buffer.caret_line_back_alpha [number]\nThe background alpha of the caret line. Alpha ranges from 0 (transparent)\nto 255 (opaque) or 256 for no alpha.\n
@@ -812,33 +814,33 @@ caret_sticky buffer.caret_sticky [number]\nThe caret preferred x position changi
caret_style buffer.caret_style [number]\nThe style of the caret to be drawn.\n * `_SCINTILLA.constants.CARETSTYLE_INVISIBLE` (0): Not draw the caret\n at all.\n * `_SCINTILLA.constants.CARETSTYLE_LINE` (1): A line caret. This is the\n default value.\n * `_SCINTILLA.constants.CARETSTYLE_BLOCK` (2): A block caret.\n\n
caret_width buffer.caret_width [number]\nThe width of the insert mode caret in pixels. Can be 0, 1, 2 or 3 pixels. The\ndefault width is 1 pixel. This setting only affects the width of the cursor\nwhen the cursor style is set to line caret mode, it does not affect the\nwidth for a block caret.\n
ceil math.ceil(x)\nReturns the smallest integer larger than or equal to `x`.\n
-change_lexer_state buffer.change_lexer_state(buffer, start_pos, end_pos)\nIndicate that the internal state of a lexer has changed over a range and\ntherefore there may be a need to redraw.\n@param buffer The focused buffer.\n@param start_pos The start position.\n@param end_pos The end position.\n
+change_lexer_state buffer.change_lexer_state(buffer, start_pos, end_pos)\nIndicate that the internal state of a lexer has changed over a range and\ntherefore there may be a need to redraw.\n@param buffer The global buffer.\n@param start_pos The start position.\n@param end_pos The end position.\n
char string.char(···)\nReceives zero or more integers. Returns a string with length equal to the\nnumber of arguments, in which each character has the internal numerical\ncode equal to its corresponding argument. Note that numerical codes are not\nnecessarily portable across platforms.\n
char_at buffer.char_at [table]\nTable of character bytes at positions in the document starting at\nzero. (Read-only)\n
-char_left buffer.char_left(buffer)\nMove caret left one character.\n@param buffer The focused buffer.\n
-char_left_extend buffer.char_left_extend(buffer)\nMove caret left one character extending selection to new caret position.\n@param buffer The focused buffer.\n
-char_left_rect_extend buffer.char_left_rect_extend(buffer)\nMove caret left one character, extending rectangular selection to new caret\nposition.\n@param buffer The focused buffer.\n
+char_left buffer.char_left(buffer)\nMove caret left one character.\n@param buffer The global buffer.\n
+char_left_extend buffer.char_left_extend(buffer)\nMove caret left one character extending selection to new caret position.\n@param buffer The global buffer.\n
+char_left_rect_extend buffer.char_left_rect_extend(buffer)\nMove caret left one character, extending rectangular selection to new caret\nposition.\n@param buffer The global buffer.\n
char_matches _m.textadept.editing.char_matches [table]\nAuto-matched characters. Used for auto-matching parentheses, brackets, braces,\nquotes, etc. Keys are lexer language names and values are tables of character\nmatch pairs. This table can be populated by language-specific modules.\n
-char_position_from_point buffer.char_position_from_point(buffer, x, y)\nFind the position of a character from a point within the window.\n@param buffer The focused buffer.\n@return number\n
-char_position_from_point_close buffer.char_position_from_point_close(buffer, x, y)\nFind the position of a character from a point within the window. Return -1\nif not close to text.\n@param buffer The focused buffer.\n@return number\n
-char_right buffer.char_right(buffer)\nMove caret right one character.\n@param buffer The focused buffer.\n
-char_right_extend buffer.char_right_extend(buffer)\nMove caret right one character extending selection to new caret position.\n@param buffer The focused buffer.\n
-char_right_rect_extend buffer.char_right_rect_extend(buffer)\nMove caret right one character, extending rectangular selection to new\ncaret position.\n@param buffer The focused buffer.\n
+char_position_from_point buffer.char_position_from_point(buffer, x, y)\nFind the position of a character from a point within the window.\n@param buffer The global buffer.\n@return number\n
+char_position_from_point_close buffer.char_position_from_point_close(buffer, x, y)\nFind the position of a character from a point within the window. Return -1\nif not close to text.\n@param buffer The global buffer.\n@return number\n
+char_right buffer.char_right(buffer)\nMove caret right one character.\n@param buffer The global buffer.\n
+char_right_extend buffer.char_right_extend(buffer)\nMove caret right one character extending selection to new caret position.\n@param buffer The global buffer.\n
+char_right_rect_extend buffer.char_right_rect_extend(buffer)\nMove caret right one character, extending rectangular selection to new\ncaret position.\n@param buffer The global buffer.\n
chdir lfs.chdir(path)\nChanges the current working directory to the given path. Returns true in\ncase of success or nil plus an error string.\n
-check_focused_buffer gui.check_focused_buffer(buffer)\nChecks if the buffer being indexed is the currently focused buffer. This is\nnecessary because any buffer actions are performed in the focused views'\nbuffer, which may not be the buffer being indexed. Throws an error if the\ncheck fails.\n@param buffer The buffer in question.\n
-choose_caret_x buffer.choose_caret_x(buffer)\nSet the last x chosen value to be the caret x position. The view remembers\nthe x value of the last position horizontally moved to explicitly by the\nuser and this value is then used when moving vertically such as by using the\nup and down keys. This function sets the current x position of the caret as\nthe remembered value.\n@param buffer The focused buffer.\n
+check_global buffer.check_global(buffer)\nChecks whether the given buffer is the global one. If not, throws an error\nindicating so. It is necessary to call this at the top of all buffer functions\nto avoid unexpected behavior since most buffer functions operate on the global\n'buffer', which is not necessarily the given one.\n@param buffer The buffer to check.\n
+choose_caret_x buffer.choose_caret_x(buffer)\nSet the last x chosen value to be the caret x position. The view remembers\nthe x value of the last position horizontally moved to explicitly by the\nuser and this value is then used when moving vertically such as by using the\nup and down keys. This function sets the current x position of the caret as\nthe remembered value.\n@param buffer The global buffer.\n
class_definition _m.textadept.adeptsense.syntax.class_definition\nA Lua pattern representing the language's class definition syntax. The first\ncapture returned must be the class name. A second, optional capture contains\nthe class' superclass (if any). If no completions are found for the class\nname, completions for the superclass are shown (if any). Completions will\nnot be shown for both a class and superclass unless defined in a previously\nloaded ctags file. Also, multiple superclasses cannot be recognized by this\npattern; use a ctags file instead. Defaults to 'class%s+([%w_]+)'.\n
clear _m.textadept.adeptsense.clear(sense)\nClears an adeptsense. This is necessary for loading a new ctags file or\ncompletions from a different project.\n@param sense The adeptsense returned by adeptsense.new().\n
clear _m.textadept.bookmarks.clear()\nClears all bookmarks in the current buffer.\n
-clear buffer.clear(buffer)\nClear the selection.\n@param buffer The focused buffer.\n
-clear_all buffer.clear_all(buffer)\nDelete all text in the document.\n@param buffer The focused buffer.\n
-clear_all_cmd_keys buffer.clear_all_cmd_keys(buffer)\nDrop all key mappings.\n@param buffer The focused buffer.\n
-clear_document_style buffer.clear_document_style(buffer)\nSet all style bytes to 0, remove all folding information.\n@param buffer The focused buffer.\n
-clear_registered_images buffer.clear_registered_images(buffer)\nClear all the registered XPM images.\n@param buffer The focused buffer.\n
-clear_selections buffer.clear_selections(buffer)\nClear selections to a single empty stream selection.\n@param buffer The focused buffer.\n
+clear buffer.clear(buffer)\nClear the selection.\n@param buffer The global buffer.\n
+clear_all buffer.clear_all(buffer)\nDelete all text in the document.\n@param buffer The global buffer.\n
+clear_all_cmd_keys buffer.clear_all_cmd_keys(buffer)\nDrop all key mappings.\n@param buffer The global buffer.\n
+clear_document_style buffer.clear_document_style(buffer)\nSet all style bytes to 0, remove all folding information.\n@param buffer The global buffer.\n
+clear_registered_images buffer.clear_registered_images(buffer)\nClear all the registered XPM images.\n@param buffer The global buffer.\n
+clear_selections buffer.clear_selections(buffer)\nClear selections to a single empty stream selection.\n@param buffer The global buffer.\n
clipboard_text gui.clipboard_text [string]\nThe text on the clipboard. (Read-only)\n
clock os.clock()\nReturns an approximation of the amount in seconds of CPU time used by the\nprogram.\n
-close buffer.close(buffer)\nCloses the current buffer.\n@param buffer The focused buffer. If the buffer is dirty, the user is prompted\nto continue. The buffer is not saved automatically. It must be done manually.\n
+close buffer.close(buffer)\nCloses the current buffer.\n@param buffer The global buffer. If the buffer is dirty, the user is prompted\nto continue. The buffer is not saved automatically. It must be done manually.\n
close file:close()\nCloses `file`. Note that files are automatically closed when their handles are\ngarbage collected, but that takes an unpredictable amount of time to happen.\n
close io.close([file])\nEquivalent to `file:close()`. Without a `file`, closes the default output file.\n
close_all io.close_all()\nCloses all open buffers. If any buffer is dirty, the user is prompted to\ncontinue. No buffers are saved automatically. They must be saved manually.\n@usage io.close_all()\n@return true if user did not cancel.\n
@@ -847,7 +849,7 @@ code_page buffer.code_page [number]\nThe code page used to interpret the bytes o
collectgarbage _G.collectgarbage(opt [, arg])\nThis function is a generic interface to the garbage collector. It performs\ndifferent functions according to its first argument, `opt`: "stop": stops the\ngarbage collector. "restart": restarts the garbage collector. "collect":\nperforms a full garbage-collection cycle. "count": returns the total\nmemory in use by Lua (in Kbytes). "step": performs a garbage-collection\nstep. The step "size" is controlled by `arg` (larger values mean more\nsteps) in a non-specified way. If you want to control the step size you\nmust experimentally tune the value of `arg`. Returns true if the step\nfinished a collection cycle. "setpause": sets `arg` as the new value for\nthe *pause* of the collector (see §2.10). Returns the previous value for\n*pause*. "setstepmul": sets `arg` as the new value for the *step multiplier*\nof the collector (see §2.10). Returns the previous value for *step*.\n
color lexer.color(r, g, b)\nCreates a Scintilla color.\n@param r The string red component of the hexadecimal color.\n@param g The string green component of the color.\n@param b The string blue component of the color.\n@usage local red = color('FF', '00', '00')\n
colors lexer.colors [table]\nTable of common colors for a theme. This table should be redefined in\neach theme.\n
-colourise buffer.colourise(buffer, start_pos, end_pos)\ncolorise a segment of the document using the current lexing language.\n@param buffer The focused buffer.\n@param start_pos The start position.\n@param end_pos The end position or -1 to style from start_pos to the end of\nthe document.\n
+colourise buffer.colourise(buffer, start_pos, end_pos)\ncolorise a segment of the document using the current lexing language.\n@param buffer The global buffer.\n@param start_pos The start position.\n@param end_pos The end position or -1 to style from start_pos to the end of\nthe document.\n
column buffer.column [table]\nTable of column numbers, taking tab widths into account, for positions\nstarting from zero. (Read-only)\n
command_entry gui.command_entry [module]\nTextadept's Command entry.\n
comment_string _m.textadept.editing.comment_string [table]\nComment strings for various lexer languages. Used for the block_comment()\nfunction. Keys are lexer language names and values are the line comment\ndelimiters for the language. This table is typically populated by\nlanguage-specific modules.\n@see block_comment\n
@@ -861,16 +863,15 @@ connect events.connect(event, f, index)\nAdds a handler function to an event.\n@
constants _SCINTILLA.constants [table]\nScintilla constants.\n
context_menu _m.textadept.menu.context_menu [table]\nContains the right-click context menu.\n
context_menu gui.context_menu\nA GTK menu defining the editor's context menu.\n
-contracted_fold_next buffer.contracted_fold_next(buffer, line_start)\nFind the next line at or after line_start that is a contracted fold header\nline. Return -1 when no more lines.\n@param buffer The focused buffer.\n@param line_start The start line number.\n@return number\n
+contracted_fold_next buffer.contracted_fold_next(buffer, line_start)\nFind the next line at or after line_start that is a contracted fold header\nline. Return -1 when no more lines.\n@param buffer The global buffer.\n@param line_start The start line number.\n@return number\n
control_char_symbol buffer.control_char_symbol [number]\nThe way control characters are displayed. If less than 32, keep the rounded\nrectangle as ASCII mnemonics. Otherwise, use the given character byte. The\ndefault value is 0.\n
control_structure_patterns _m.lua.control_structure_patterns [table]\nPatterns for auto 'end' completion for control structures.\n@see try_to_autocomplete_end\n
-control_structure_patterns _m.ruby.control_structure_patterns [table]\nPatterns for auto 'end' completion for control structures.\n@see try_to_autocomplete_end\n
-convert_eo_ls buffer.convert_eo_ls(buffer, mode)\nConverts all line endings in the document to one mode.\n@param buffer The focused buffer.\n@param mode The line ending mode. Valid values are:\n_SCINTILLA.constants.SC_EOL_CRLF (0), _SCINTILLA.constants.SC_EOL_CR (1),\nor _SCINTILLA.constants.SC_EOL_LF (2).\n
+convert_eo_ls buffer.convert_eo_ls(buffer, mode)\nConverts all line endings in the document to one mode.\n@param buffer The global buffer.\n@param mode The line ending mode. Valid values are:\n_SCINTILLA.constants.SC_EOL_CRLF (0), _SCINTILLA.constants.SC_EOL_CR (1),\nor _SCINTILLA.constants.SC_EOL_LF (2).\n
convert_indentation _m.textadept.editing.convert_indentation()\nConverts indentation between tabs and spaces.\n
copy buffer.copy(buffer)\nCopy the selection to the clipboard.\n@param buffer The buffer\n
-copy_allow_line buffer.copy_allow_line(buffer)\nCopy the selection, if selection empty copy the line with the caret.\n@param buffer The focused buffer.\n
-copy_range buffer.copy_range(buffer, start_pos, end_pos)\nCopy a range of text to the clipboard. Positions are clipped into the document.\n@param buffer The focused buffer.\n@param start_pos The start position.\n@param end_pos The end position.\n
-copy_text buffer.copy_text(buffer, text)\nCopy argument text to the clipboard.\n@param buffer The focused buffer.\n@param text The text.\n
+copy_allow_line buffer.copy_allow_line(buffer)\nCopy the selection, if selection empty copy the line with the caret.\n@param buffer The global buffer.\n
+copy_range buffer.copy_range(buffer, start_pos, end_pos)\nCopy a range of text to the clipboard. Positions are clipped into the document.\n@param buffer The global buffer.\n@param start_pos The start position.\n@param end_pos The end position.\n
+copy_text buffer.copy_text(buffer, text)\nCopy argument text to the clipboard.\n@param buffer The global buffer.\n@param text The text.\n
coroutine _G.coroutine [module]\nLua coroutine module.\n
cos math.cos(x)\nReturns the cosine of `x` (assumed to be in radians).\n
cosh math.cosh(x)\nReturns the hyperbolic cosine of `x`.\n
@@ -879,27 +880,24 @@ cpp _G.keys.cpp [table]\nContainer for C/C++-specific key commands.\n
cpp _G.snippets.cpp [table]\nContainer for C/C++-specific snippets.\n
cpp _m.cpp [module]\nThe cpp module. It provides utilities for editing C/C++ code. User tags\nare loaded from _USERHOME/modules/cpp/tags and user apis are loaded from\n_USERHOME/modules/cpp/api.\n
create coroutine.create(f)\nCreates a new coroutine, with body `f`. `f` must be a Lua function. Returns\nthis new coroutine, an object with type `"thread"`.\n
-css _G.keys.css [table]\nContainer for CSS-specific key commands.\n
-css _G.snippets.css [table]\nContainer for CSS-specific snippets.\n
-css _m.css [module]\nThe css module. It provides utilities for editing CSS code. User tags\nare loaded from _USERHOME/modules/css/tags and user apis are loaded from\n_USERHOME/modules/css/api.\n
ctags_kinds _m.textadept.adeptsense.ctags_kinds [table]\nContains a map of ctags kinds to adeptsense kinds. Recognized kinds are\n'functions', 'fields', and 'classes'. Classes are quite simply containers\nfor functions and fields so Lua modules would count as classes. Any other\nkinds will be passed to handle_ctag() for user-defined handling.\n@see handle_ctag\n
current_pos buffer.current_pos [number]\nThe position of the caret. When setting, the caret is not scrolled into view.\n
current_word _m.textadept.editing.current_word(action)\nSelects the current word under the caret and if action indicates, deletes it.\n@param action Optional action to perform with selected word. If 'delete',\nit is deleted.\n
currentdir lfs.currentdir()\nReturns a string with the current working directory or nil plus an error\nstring.\n
cursor buffer.cursor [number]\nThe cursor type.\n * `_SCINTILLA.constants.SC_CURSORNORMAL` (-1): The normal cursor is\n displayed.\n * `_SCINTILLA.constants.SC_CURSORWAIT` (4): The wait cursor is\n displayed when the mouse is over the view.\n\n
-cut buffer.cut(buffer)\nCut the selection to the clipboard.\n@param buffer The focused buffer.\n
+cut buffer.cut(buffer)\nCut the selection to the clipboard.\n@param buffer The global buffer.\n
date os.date([format [, time]])\nReturns a string or a table containing date and time, formatted according to\nthe given string `format`. If the `time` argument is present, this is the\ntime to be formatted (see the `os.time` function for a description of this\nvalue). Otherwise, `date` formats the current time. If `format` starts with\n'`!`', then the date is formatted in Coordinated Universal Time. After\nthis optional character, if `format` is the string "`*t`", then `date`\nreturns a table with the following fields: `year` (four digits), `month`\n(1--12), `day` (1--31), `hour` (0--23), `min` (0--59), `sec` (0--61), `wday`\n(weekday, Sunday is 1), `yday` (day of the year), and `isdst` (daylight\nsaving flag, a boolean). If `format` is not "`*t`", then `date` returns the\ndate as a string, formatted according to the same rules as the C function\n`strftime`. When called without arguments, `date` returns a reasonable date\nand time representation that depends on the host system and on the current\nlocale (that is, `os.date()` is equivalent to `os.date("%c")`).\n
debug _G.debug [module]\nLua debug module.\n
debug debug.debug()\nEnters an interactive mode with the user, running each string that the user\nenters. Using simple commands and other debug facilities, the user can inspect\nglobal and local variables, change their values, evaluate expressions, and so\non. A line containing only the word `cont` finishes this function, so that\nthe caller continues its execution. Note that commands for `debug.debug`\nare not lexically nested within any function, and so have no direct access\nto local variables.\n
dec_num lexer.dec_num\nMatches a decimal number.\n
deg math.deg(x)\nReturns the angle `x` (given in radians) in degrees.\n
-del_line_left buffer.del_line_left(buffer)\nDelete back from the current position to the start of the line.\n@param buffer The focused buffer.\n
-del_line_right buffer.del_line_right(buffer)\nDelete forwards from the current position to the end of the line.\n@param buffer The focused buffer.\n
-del_word_left buffer.del_word_left(buffer)\nDelete the word to the left of the caret.\n@param buffer The focused buffer.\n
-del_word_right buffer.del_word_right(buffer)\nDelete the word to the right of the caret.\n@param buffer The focused buffer.\n
-del_word_right_end buffer.del_word_right_end(buffer)\nDelete the word to the right of the caret, but not the trailing non-word\ncharacters.\n@param buffer The focused buffer.\n
-delete buffer.delete(buffer)\nDeletes the current buffer. WARNING: this function should NOT be called via\nscripts. io provides a close() function for buffers to prompt for confirmation\nif necessary; this function does not. Activates the 'buffer_deleted' signal.\n@param buffer The focused buffer.\n
-delete_back buffer.delete_back(buffer)\nDelete the selection or if no selection, the character before the caret.\n@param buffer The focused buffer.\n
+del_line_left buffer.del_line_left(buffer)\nDelete back from the current position to the start of the line.\n@param buffer The global buffer.\n
+del_line_right buffer.del_line_right(buffer)\nDelete forwards from the current position to the end of the line.\n@param buffer The global buffer.\n
+del_word_left buffer.del_word_left(buffer)\nDelete the word to the left of the caret.\n@param buffer The global buffer.\n
+del_word_right buffer.del_word_right(buffer)\nDelete the word to the right of the caret.\n@param buffer The global buffer.\n
+del_word_right_end buffer.del_word_right_end(buffer)\nDelete the word to the right of the caret, but not the trailing non-word\ncharacters.\n@param buffer The global buffer.\n
+delete buffer.delete(buffer)\nDeletes the current buffer. WARNING: this function should NOT be called via\nscripts. io provides a close() function for buffers to prompt for confirmation\nif necessary; this function does not. Activates the 'buffer_deleted' signal.\n@param buffer The global buffer.\n
+delete_back buffer.delete_back(buffer)\nDelete the selection or if no selection, the character before the caret.\n@param buffer The global buffer.\n
delete_back_not_line buffer.delete_back_not_line(buffer)\nDelete the selection or if no selection, the character before the caret. Will\nnot delete the character before at the start of a line.\n
delimited_range lexer.delimited_range(chars, escape, end_optional, balanced, forbidden)\nCreates an LPeg pattern that matches a range of characters delimitted by a\nspecific character(s). This can be used to match a string, parenthesis, etc.\n@param chars The character(s) that bound the matched range.\n@param escape Optional escape character. This parameter may be omitted, nil,\nor the empty string.\n@param end_optional Optional flag indicating whether or not an ending delimiter\nis optional or not. If true, the range begun by the start delimiter matches\nuntil an end delimiter or the end of the input is reached.\n@param balanced Optional flag indicating whether or not a balanced range is\nmatched, like `%b` in Lua's `string.find`. This flag only applies if `chars`\nconsists of two different characters (e.g. '()').\n@param forbidden Optional string of characters forbidden in a delimited\nrange. Each character is part of the set.\n@usage local sq_str_noescapes = delimited_range("'")\n@usage local sq_str_escapes = delimited_range("'", '\\', true)\n@usage local unbalanced_parens = delimited_range('()', '\\', true)\n@usage local balanced_parens = delimited_range('()', '\\', true, true)\n
dialog gui.dialog(kind, ...)\nDisplays a CocoaDialog of a specified type with the given string\narguments. Each argument is like a string in Lua's 'arg' table. Tables of\nstrings are allowed as arguments and are expanded in place. This is useful\nfor filteredlist dialogs with many items.\n@return string CocoaDialog result.\n
@@ -910,33 +908,31 @@ direct_function buffer.direct_function [number]\nA pointer to a function that pr
direct_pointer buffer.direct_pointer [number]\nA pointer value to use as the first argument when calling the function\nreturned by direct_function. (Read-only)\n
dirty buffer.dirty [bool]\nFlag indicating whether or not the buffer has been modified since it was\nlast saved.\n
disconnect events.disconnect(event, index)\nDisconnects a handler function from an event.\n@param event The string event name.\n@param index Index of the handler (returned by events.connect).\n@see connect\n
-doc_line_from_visible buffer.doc_line_from_visible(buffer)\nFind the document line of a display line taking hidden lines into account.\n@param buffer The focused buffer.\n@return number\n
-doc_pointer buffer.doc_pointer [number]\nA pointer to the document object. (Read-only)\n
-doc_pointer view.doc_pointer [number]\nThe pointer to the document associated with this view's buffer. (Read-only)\n
+doc_line_from_visible buffer.doc_line_from_visible(buffer)\nFind the document line of a display line taking hidden lines into account.\n@param buffer The global buffer.\n@return number\n
docstatusbar_text gui.docstatusbar_text [string]\nThe text displayed by the doc statusbar. (Write-only)\n
-document_end buffer.document_end(buffer)\nMove caret to last position in document.\n@param buffer The focused buffer.\n
-document_end_extend buffer.document_end_extend(buffer)\nMove caret to last position in document extending selection to new caret\nposition.\n@param buffer The focused buffer.\n
-document_start buffer.document_start(buffer)\nMove caret to first position in document.\n@param buffer The focused buffer.\n
-document_start_extend buffer.document_start_extend(buffer)\nMove caret to first position in document extending selection to new caret\nposition.\n@param buffer The focused buffer.\n
+document_end buffer.document_end(buffer)\nMove caret to last position in document.\n@param buffer The global buffer.\n
+document_end_extend buffer.document_end_extend(buffer)\nMove caret to last position in document extending selection to new caret\nposition.\n@param buffer The global buffer.\n
+document_start buffer.document_start(buffer)\nMove caret to first position in document.\n@param buffer The global buffer.\n
+document_start_extend buffer.document_start_extend(buffer)\nMove caret to first position in document extending selection to new caret\nposition.\n@param buffer The global buffer.\n
dofile _G.dofile(filename)\nOpens the named file and executes its contents as a Lua chunk. When called\nwithout arguments, `dofile` executes the contents of the standard input\n(`stdin`). Returns all values returned by the chunk. In case of errors,\n`dofile` propagates the error to its caller (that is, `dofile` does not run\nin protected mode).\n
dump string.dump(function)\nReturns a string containing a binary representation of the given function,\nso that a later `loadstring` on this string returns a copy of the\nfunction. `function` must be a Lua function without upvalues.\n
edge_colour buffer.edge_colour [number]\nThe color used in edge indication in 0xBBGGRR format.\n
edge_column buffer.edge_column [number]\nThe column number which text should be kept within.\n
edge_mode buffer.edge_mode [number]\nThe edge highlight mode.\n * `_SCINTILLA.constants.EDGE_NONE` (0): Long lines are not marked. This\n is the default state.\n * `_SCINTILLA.constants.EDGE_LINE` (1): A vertical line is drawn at the\n column number set by `buffer.edge_column`.\n * `_SCINTILLA.constants.EDGE_BACKGROUND` (2): The background color of\n characters after the column limit is changed to the color set by\n `buffer.edge_colour`.\n\n
-edit_toggle_overtype buffer.edit_toggle_overtype(buffer)\nSwitch from insert to overtype mode or the reverse.\n@param buffer The focused buffer.\n
+edit_toggle_overtype buffer.edit_toggle_overtype(buffer)\nSwitch from insert to overtype mode or the reverse.\n@param buffer The global buffer.\n
editing _m.textadept.editing [module]\nEditing commands for the textadept module.\n
embed_lexer lexer.embed_lexer(parent, child, start_rule, end_rule)\nEmbeds a child lexer language in a parent one.\n@param parent The parent lexer.\n@param child The child lexer.\n@param start_rule The token that signals the beginning of the embedded lexer.\n@param end_rule The token that signals the end of the embedded lexer.\n@usage embed_lexer(_M, css, css_start_rule, css_end_rule)\n@usage embed_lexer(html, _M, php_start_rule, php_end_rule)\n@usage embed_lexer(html, ruby, ruby_start_rule, rule_end_rule)\n
emit events.emit(event, ...)\nCalls all handlers for the given event in sequence (effectively "generating"\nthe event). If true or false is explicitly returned by any handler, the\nevent is not propagated any further; iteration ceases.\n@param event The string event name.\n@param ... Arguments passed to the handler.\n@return true or false if any handler explicitly returned such; nil otherwise.\n
-empty_undo_buffer buffer.empty_undo_buffer(buffer)\nDelete the undo history. It also sets the save point to the start of the\nundo buffer, so the document will appear to be unmodified.\n@param buffer The focused buffer.\n
+empty_undo_buffer buffer.empty_undo_buffer(buffer)\nDelete the undo history. It also sets the save point to the start of the\nundo buffer, so the document will appear to be unmodified.\n@param buffer The global buffer.\n
enclose _m.textadept.editing.enclose(left, right)\nEncloses text within a given pair of strings. If text is selected, it is\nenclosed. Otherwise, the previous word is enclosed.\n@param left The left part of the enclosure.\n@param right The right part of the enclosure.\n
-encoded_from_utf8 buffer.encoded_from_utf8(buffer, string)\nTranslates a UTF8 string into the document encoding. Return the length of\nthe result in bytes. On error return 0.\n@param buffer The focused buffer.\n@param string The string.\n@return number\n
+encoded_from_utf8 buffer.encoded_from_utf8(buffer, string)\nTranslates a UTF8 string into the document encoding. Return the length of\nthe result in bytes. On error return 0.\n@param buffer The global buffer.\n@param string The string.\n@return number\n
encoding buffer.encoding [string or nil]\nThe encoding of the file on the hard disk. It will be nil if the file is a\nbinary file.\n
encoding_bom buffer.encoding_bom [string]\nThe byte-order mark of the file encoding (if any).\n
end_at_last_line buffer.end_at_last_line [bool]\nWhether the maximum scroll position has the last line at the bottom of the\nview. If `false`, allows scrolling one page below the last line. The default\nvalue is `true`.\n
end_styled buffer.end_styled [number]\nThe position of the last correctly styled character. (Read-only)\n
-end_undo_action buffer.end_undo_action(buffer)\nEnd a sequence of actions that is undone and redone as a unit.\n@param buffer The focused buffer.\n
-ensure_visible buffer.ensure_visible(buffer, line)\nEnsure a particular line is visible by expanding any header line hiding it.\n@param buffer The focused buffer.\n@param line The line number.\n
-ensure_visible_enforce_policy buffer.ensure_visible_enforce_policy(buffer, line)\nEnsure a particular line is visible by expanding any header line hiding it. Use\nthe currently set visibility policy to determine which range to display.\n@param buffer The focused buffer.\n@param line The line number.\n
+end_undo_action buffer.end_undo_action(buffer)\nEnd a sequence of actions that is undone and redone as a unit.\n@param buffer The global buffer.\n
+ensure_visible buffer.ensure_visible(buffer, line)\nEnsure a particular line is visible by expanding any header line hiding it.\n@param buffer The global buffer.\n@param line The line number.\n
+ensure_visible_enforce_policy buffer.ensure_visible_enforce_policy(buffer, line)\nEnsure a particular line is visible by expanding any header line hiding it. Use\nthe currently set visibility policy to determine which range to display.\n@param buffer The global buffer.\n@param line The line number.\n
entry_text gui.command_entry.entry_text [string]\nThe text in the entry.\n
eol_mode buffer.eol_mode [number]\nThe current end of line mode.\n * `_SCINTILLA.constants.SC_EOL_CRLF` (0): `CRLF`.\n * `_SCINTILLA.constants.SC_EOL_CR` (1): `CR`.\n * `_SCINTILLA.constants.SC_EOL_LF` (2): `LF`.\n\n
error _G.error(message [, level])\nTerminates the last protected function called and returns `message` as the\nerror message. Function `error` never returns. Usually, `error` adds some\ninformation about the error position at the beginning of the message. The\n`level` argument specifies how to get the error position. With level 1 (the\ndefault), the error position is where the `error` function was called. Level\n2 points the error to where the function that called `error` was called; and\nso on. Passing a level 0 avoids the addition of error position information\nto the message.\n
@@ -956,7 +952,7 @@ filter_through _m.textadept.filter_through.filter_through()\nPrompts for a Linux
filteredlist gui.filteredlist(title, columns, items, int_return, ...)\nShortcut function for gui.dialog('filtered_list', ...) with 'Ok' and 'Cancel'\nbuttons.\n@param title The title for the filteredlist dialog.\n@param columns A column name or list of column names.\n@param items An item or list of items.\n@param int_return If true, returns the integer index of the selected item\nin the filteredlist. Defaults to false, which returns the string item. Not\ncompatible with a '--select-multiple' filteredlist.\n@param ... Additional parameters to pass to gui.dialog().\n@usage gui.filteredlist('Title', 'Foo', { 'Bar', 'Baz' })\n@usage gui.filteredlist('Title', { 'Foo', 'Bar' }, { 'a', 'b', 'c', 'd' },\nfalse, '--output-column', '2')\n@return Either a string or integer on success; nil otherwise.\n
find gui.find [module]\nTextadept's integrated find/replace dialog.\n
find string.find(s, pattern [, init [, plain]])\nLooks for the first match of `pattern` in the string `s`. If it finds a\nmatch, then `find` returns the indices of `s` where this occurrence starts\nand ends; otherwise, it returns nil. A third, optional numerical argument\n`init` specifies where to start the search; its default value is 1 and can\nbe negative. A value of true as a fourth, optional argument `plain` turns off\nthe pattern matching facilities, so the function does a plain "find substring"\noperation, with no characters in `pattern` being considered "magic". Note that\nif `plain` is given, then `init` must be given as well. If the pattern has\ncaptures, then in a successful match the captured values are also returned,\nafter the two indices.\n
-find_column buffer.find_column(buffer, line, column)\nFind the position of a column on a line taking into account tabs and multi-byte\ncharacters. If beyond end of line, return line end position.\n@param buffer The focused buffer.\n@param line The line number.\n@param column The column number.\n
+find_column buffer.find_column(buffer, line, column)\nFind the position of a column on a line taking into account tabs and multi-byte\ncharacters. If beyond end of line, return line end position.\n@param buffer The global buffer.\n@param line The line number.\n@param column The column number.\n
find_entry_text gui.find.find_entry_text [string]\nThe text in the find entry.\n
find_in_files gui.find.find_in_files(utf8_dir)\nPerforms a find in files with the given directory. Use the gui.find fields\nto set the text to find and find options.\n@param utf8_dir UTF-8 encoded directory name. If none is provided, the user\nis prompted for one.\n
find_incremental gui.find.find_incremental()\nBegins an incremental find using the Lua command entry. Lua command\nfunctionality will be unavailable until the search is finished (pressing\n'Escape' by default).\n
@@ -974,42 +970,40 @@ fmod math.fmod(x, y)\nReturns the remainder of the division of `x` by `y` that r
focus buffer.focus [bool]\nThe internal focus flag.\n
focus gui.command_entry.focus()\nFocuses the command entry.\n
focus gui.find.focus()\nDisplays and focuses the find/replace dialog.\n
-focus view:focus()\nFocuses the indexed view if it hasn't been already.\n
-focused_doc_pointer gui.focused_doc_pointer [number]\nThe pointer to the document associated with the buffer of the currently\nfocused view. (Read-only)\n
fold lexer.fold(text, start_pos, start_line, start_level)\nFolds the given text. Called by LexLPeg.cxx; do not call from Lua. If the\ncurrent lexer has no _fold function, folding by indentation is performed if\nthe 'fold.by.indentation' property is set.\n@param text The document text to fold.\n@param start_pos The position in the document text starts at.\n@param start_line The line number text starts on.\n@param start_level The fold level text starts on.\n@return Table of fold levels.\n
fold_expanded buffer.fold_expanded [bool]\nExpanded state of a header line.\n
fold_level buffer.fold_level [table]\nTable of fold levels for lines starting from zero. Fold levels encodes an\ninteger level along witth flags indicating whether the line is a header and\nwhether it is effectively white space.\n * `_SCINTILLA.constants.SC_FOLDLEVELBASE` (0x400): Initial fold level.\n * `_SCINTILLA.constants.SC_FOLDLEVELWHITEFLAG` (0x1000): Indicates that\n the line is blank.\n * `_SCINTILLA.constants.SC_FOLDLEVELHEADERFLAG` (0x2000): Indicates\n that the line is a header (fold point).\n\n
fold_line_comments lexer.fold_line_comments(prefix)\nReturns a fold function that folds consecutive line comments. This function\nshould be used inside the lexer's `_foldsymbols` table.\n@param prefix The prefix string defining a line comment.\n@usage [l.COMMENT] = { ['--'] = l.fold_line_comments('--') }\n@usage [l.COMMENT] = { ['//'] = l.fold_line_comments('//') }\n
fold_parent buffer.fold_parent [table]\nTable of parent line numbers for child lines starting from zero. -1 means\nno line was found. (Read-only)\n
font_quality buffer.font_quality [number]\nThe quality level for text. (Windows only)\n * `_SCINTILLA.constants.SC_EFF_QUALITY_DEFAULt` (0).\n * `_SCINTILLA.constants.SC_EFF_QUALITY_NON_ANTIALIASED` (1).\n * `_SCINTILLA.constants.SC_EFF_QUALITY_ANTIALIASED` (2).\n * `_SCINTILLA.constants.SC_EFF_QUALITY_LCD_OPTIMIZED` (3).\n\n
-form_feed buffer.form_feed(buffer)\nInsert a Form Feed character.\n@param buffer The focused buffer.\n
+form_feed buffer.form_feed(buffer)\nInsert a Form Feed character.\n@param buffer The global buffer.\n
format string.format(formatstring, ···)\nReturns a formatted version of its variable number of arguments following\nthe description given in its first argument (which must be a string). The\nformat string follows the same rules as the `printf` family of standard C\nfunctions. The only differences are that the options/modifiers `*`, `l`,\n`L`, `n`, `p`, and `h` are not supported and that there is an extra option,\n`q`. The `q` option formats a string in a form suitable to be safely read back\nby the Lua interpreter: the string is written between double quotes, and all\ndouble quotes, newlines, embedded zeros, and backslashes in the string are\ncorrectly escaped when written. For instance, the call string.format('%q',\n'a string with "quotes" and \\n new line') will produce the string: "a string\nwith \"quotes\" and \ new line" The options `c`, `d`, `E`, `e`, `f`, `g`,\n`G`, `i`, `o`, `u`, `X`, and `x` all expect a number as argument, whereas\n`q` and `s` expect a string. This function does not accept string values\ncontaining embedded zeros, except as arguments to the `q` option.\n
frexp math.frexp(x)\nReturns `m` and `e` such that *x = m2^e*, `e` is an integer and the absolute\nvalue of `m` is in the range *[0.5, 1)* (or zero when `x` is zero).\n
functions _SCINTILLA.functions [table]\nScintilla functions.\n
get_apidoc _m.textadept.adeptsense.get_apidoc(sense, symbol)\nReturns a list of apidocs for the given symbol. If there are multiple apidocs,\nthe index of one to display is the value of the 'pos' key in the returned list.\n@param sense The adeptsense returned by adeptsense.new().\n@param symbol The symbol to get apidocs for.\n@return apidoc_list or nil\n
get_class _m.textadept.adeptsense.get_class(sense, symbol)\nReturns the class name for a given symbol. If the symbol is sense.syntax.self\nand a class definition using the sense.syntax.class_definition keyword\nis found, that class is returned. Otherwise the buffer is searched\nbackwards for a type declaration of the symbol according to the patterns\nin sense.syntax.type_declarations.\n@param sense The adeptsense returned by adeptsense.new().\n@param symbol The symbol to get the class of.\n@return class or nil\n@see syntax\n
get_completions _m.textadept.adeptsense.get_completions(sense, symbol, only_fields,\nonly_functions)\nReturns a list of completions for the given symbol.\n@param sense The adeptsense returned by adeptsense.new().\n@param symbol The symbol to get completions for.\n@param only_fields If true, returns list of only fields; defaults to false.\n@param only_functions If true, returns list of only functions; defaults\nto false.\n@return completion_list or nil\n
-get_cur_line buffer.get_cur_line(buffer)\nRetrieve the text of the line containing the caret. Also returns the index\nof the caret on the line.\n@param buffer The focused buffer.\n@return string, number\n
+get_cur_line buffer.get_cur_line(buffer)\nRetrieve the text of the line containing the caret. Also returns the index\nof the caret on the line.\n@param buffer The global buffer.\n@return string, number\n
get_fold_level lexer.get_fold_level(line, line_number)\nReturns the fold level for a given line. This level already has\n`SC_FOLDLEVELBASE` added to it, so you do not need to add it yourself.\n@param line_number The line number to get the fold level of.\n
-get_hotspot_active_back buffer.get_hotspot_active_back(buffer)\nGet the back color for active hotspots in 0xBBGGRR format.\n@param buffer The focused buffer.\n@return number\n
-get_hotspot_active_fore buffer.get_hotspot_active_fore(buffer)\nGet the fore color for active hotspots.\n@param buffer The focused buffer.\n@return number\n
+get_hotspot_active_back buffer.get_hotspot_active_back(buffer)\nGet the back color for active hotspots in 0xBBGGRR format.\n@param buffer The global buffer.\n@return number\n
+get_hotspot_active_fore buffer.get_hotspot_active_fore(buffer)\nGet the fore color for active hotspots.\n@param buffer The global buffer.\n@return number\n
get_indent_amount lexer.get_indent_amount(line)\nReturns the indent amount of text for a given line.\n@param line The line number to get the indent amount of.\n
-get_last_child buffer.get_last_child(buffer, header_line, level)\nFind the last child line of a header line.\n@param buffer The focused buffer.\n@param header_line The line number of a header line.\n@param level The level or -1 for the level of header_line.\n
-get_lexer buffer.get_lexer(buffer)\nReplacement for buffer.get_lexer_language(buffer).\n@param buffer The focused buffer.\n
-get_lexer_language buffer.get_lexer_language(buffer)\nRetrieve the name of the lexer.\n@param buffer The focused buffer.\n
-get_line buffer.get_line(buffer, line)\nRetrieve the contents of a line. Also returns the length of the line.\n@param buffer The focused buffer.\n@param line The line number.\n@return string, number\n
-get_line_sel_end_position buffer.get_line_sel_end_position(buffer, line)\nRetrieve the position of the end of the selection at the given line (-1 if\nno selection on this line).\n@param buffer The focused buffer.\n@param line The line number.\n
-get_line_sel_start_position buffer.get_line_sel_start_position(buffer, line)\nRetrieve the position of the start of the selection at the given line (-1\nif no selection on this line).\n@param buffer The focused buffer.\n@param line The line number.\n
-get_property buffer.get_property(buffer, key)\nRetrieve a "property" value previously set with `buffer.property`.\n@param buffer The focused buffer.\n@param key Keyword.\n@return string\n
+get_last_child buffer.get_last_child(buffer, header_line, level)\nFind the last child line of a header line.\n@param buffer The global buffer.\n@param header_line The line number of a header line.\n@param level The level or -1 for the level of header_line.\n
+get_lexer buffer.get_lexer(buffer)\nReplacement for buffer.get_lexer_language(buffer).\n@param buffer The global buffer.\n
+get_lexer_language buffer.get_lexer_language(buffer)\nRetrieve the name of the lexer.\n@param buffer The global buffer.\n
+get_line buffer.get_line(buffer, line)\nRetrieve the contents of a line. Also returns the length of the line.\n@param buffer The global buffer.\n@param line The line number.\n@return string, number\n
+get_line_sel_end_position buffer.get_line_sel_end_position(buffer, line)\nRetrieve the position of the end of the selection at the given line (-1 if\nno selection on this line).\n@param buffer The global buffer.\n@param line The line number.\n
+get_line_sel_start_position buffer.get_line_sel_start_position(buffer, line)\nRetrieve the position of the start of the selection at the given line (-1\nif no selection on this line).\n@param buffer The global buffer.\n@param line The line number.\n
+get_property buffer.get_property(buffer, key)\nRetrieve a "property" value previously set with `buffer.property`.\n@param buffer The global buffer.\n@param key Keyword.\n@return string\n
get_property lexer.get_property(key, default)\nReturns an integer property value for a given key.\n@param key The property key.\n@param default Optional integer value to return if key is not set.\n
-get_property_expanded buffer.get_property_expanded(buffer, key)\nRetrieve a "property" value previously set with `buffer.property`, with\n"$()" variable replacement on returned buffer.\n@param buffer The focused buffer.\n@param key Keyword.\n@return string\n
-get_sel_text buffer.get_sel_text(buffer)\nRetrieve the selected text. Also returns the length of the text.\n@param buffer The focused buffer.\n@return string, number\n
+get_property_expanded buffer.get_property_expanded(buffer, key)\nRetrieve a "property" value previously set with `buffer.property`, with\n"$()" variable replacement on returned buffer.\n@param buffer The global buffer.\n@param key Keyword.\n@return string\n
+get_sel_text buffer.get_sel_text(buffer)\nRetrieve the selected text. Also returns the length of the text.\n@param buffer The global buffer.\n@return string, number\n
get_split_table gui.get_split_table()\nGets the current split view structure.\n@return table of split views. Each split view entry is a table with 4 fields:\n1, 2, vertical, and size. 1 and 2 have values of either split view entries\nor the index of the buffer shown in each view. vertical is a flag indicating\nif the split is vertical or not, and size is the integer position of the\nsplit resizer.\n
get_style_at lexer.get_style_at(pos)\nReturns the string style name and style number at a given position.\n@param pos The position to get the style for.\n
-get_style_name buffer.get_style_name(buffer, style_num)\nReturns the name of the style associated with a style number.\n@param buffer The focused buffer.\n@param style_num A style number in the range 0 <= style_num < 256.\n@see buffer.style_at\n
+get_style_name buffer.get_style_name(buffer, style_num)\nReturns the name of the style associated with a style number.\n@param buffer The global buffer.\n@param style_num A style number in the range 0 <= style_num < 256.\n@see buffer.style_at\n
get_symbol _m.textadept.adeptsense.get_symbol(sense)\nReturns a full symbol (if any) and current symbol part (if any) behind the\ncaret. For example: buffer.cur would return 'buffer' and 'cur'.\n@param sense The adeptsense returned by adeptsense.new().\n@return symbol or '', part or ''.\n
-get_tag buffer.get_tag(buffer, tag_num)\nRetrieve the value of a tag from a regular expression search.\n@param buffer The focused buffer.\n@param tag_num The tag number.\n@return string\n
-get_text buffer.get_text(buffer)\nRetrieve all the text in the document. Also returns number of characters\nretrieved.\n@param buffer The focused buffer.\n
+get_tag buffer.get_tag(buffer, tag_num)\nRetrieve the value of a tag from a regular expression search.\n@param buffer The global buffer.\n@param tag_num The tag number.\n@return string\n
+get_text buffer.get_text(buffer)\nRetrieve all the text in the document. Also returns number of characters\nretrieved.\n@param buffer The global buffer.\n
getenv os.getenv(varname)\nReturns the value of the process environment variable `varname`, or nil if\nthe variable is not defined.\n
getfenv _G.getfenv([f])\nReturns the current environment in use by the function. `f` can be a Lua\nfunction or a number that specifies the function at that stack level:\nLevel 1 is the function calling `getfenv`. If the given function is not a\nLua function, or if `f` is 0, `getfenv` returns the global environment. The\ndefault for `f` is 1.\n
getfenv debug.getfenv(o)\nReturns the environment of object `o`.\n
@@ -1022,48 +1016,44 @@ getregistry debug.getregistry()\nReturns the registry table (see §3.5).\n
getupvalue debug.getupvalue(func, up)\nThis function returns the name and the value of the upvalue with index `up`\nof the function `func`. The function returns nil if there is no upvalue with\nthe given index.\n
gmatch string.gmatch(s, pattern)\nReturns an iterator function that, each time it is called, returns the\nnext captures from `pattern` over string `s`. If `pattern` specifies no\ncaptures, then the whole match is produced in each call. As an example,\nthe following loop s = "hello world from Lua" for w in string.gmatch(s,\n"%a+") do print(w) end will iterate over all the words from string `s`,\nprinting one per line. The next example collects all pairs `key=value`\nfrom the given string into a table: t = {} s = "from=world, to=Lua" for k,\nv in string.gmatch(s, "(%w+)=(%w+)") do t[k] = v end For this function, a\n'`^`' at the start of a pattern does not work as an anchor, as this would\nprevent the iteration.\n
goto _m.textadept.bookmarks.goto()\nGoes to selected bookmark from a filtered list.\n
-goto_buffer view:goto_buffer(n, absolute)\nGoes to the specified buffer in the indexed view. Activates the\n'buffer_*_switch' signals.\n@param n A relative or absolute buffer index.\n@param absolute Flag indicating if n is an absolute index or not.\n
+goto_buffer view:goto_buffer(n, relative)\nGoes to the specified buffer in the indexed view. Activates the\n'buffer_*_switch' signals.\n@param n A relative or absolute buffer index. An absolute index of -1 goes\nto the last buffer.\n@param relative Flag indicating if n is a relative index or not. Defaults\nto false.\n
goto_ctag _m.textadept.adeptsense.goto_ctag(sense, k, title)\nDisplays a filteredlist of all known symbols of the given kind (classes,\nfunctions, fields, etc.) and jumps to the source of the selected one.\n@param sense The adeptsense returned by adeptsense.new().\n@param k The ctag character kind (e.g. 'f' for a Lua function).\n@param title The title for the filteredlist dialog.\n
goto_error _m.textadept.run.goto_error(pos, line_num)\nWhen the user double-clicks an error message, go to the line in the file\nthe error occured at and display a calltip with the error message.\n@param pos The position of the caret.\n@param line_num The line double-clicked.\n@see error_detail\n
goto_file_in_list gui.find.goto_file_in_list(next)\nGoes to the next or previous file found relative to the file on the current\nline.\n@param next Flag indicating whether or not to go to the next file.\n
goto_line _m.textadept.editing.goto_line(line)\nGoes to the requested line.\n@param line Optional line number to go to.\n
-goto_line buffer.goto_line(buffer, line)\nSet caret to start of a line and ensure it is visible.\n@param buffer The focused buffer.\n@param line The line number.\n
+goto_line buffer.goto_line(buffer, line)\nSet caret to start of a line and ensure it is visible.\n@param buffer The global buffer.\n@param line The line number.\n
goto_next _m.textadept.bookmarks.goto_next()\nGoes to the next bookmark in the current buffer.\n
-goto_pos buffer.goto_pos(buffer, pos)\nSet caret to a position and ensure it is visible. The anchor position is\nset the same as the current position.\n@param buffer The focused buffer.\n@param pos The position.\n
+goto_pos buffer.goto_pos(buffer, pos)\nSet caret to a position and ensure it is visible. The anchor position is\nset the same as the current position.\n@param buffer The global buffer.\n@param pos The position.\n
goto_prev _m.textadept.bookmarks.goto_prev()\nGoes to the previous bookmark in the current buffer.\n
goto_required _m.lua.goto_required()\nDetermines the Lua file being 'require'd, searches through package.path for\nthat file, and opens it in Textadept.\n
-goto_required _m.php.goto_required()\nDetermines the PHP file being 'require'd or 'include'd, and opens it in\nTextadept.\n
-goto_required _m.ruby.goto_required()\nDetermine the Ruby file being 'require'd, and search through the RUBYPATH\nfor that file and open it in Textadept.\n
-goto_view gui.goto_view(n, absolute)\nGoes to the specified view. Activates the 'view_*_switch' signal.\n@param n A relative or absolute view index.\n@param absolute Flag indicating if n is an absolute index or not.\n
-grab_focus buffer.grab_focus(buffer)\nSet the focus to this view.\n@param buffer The focused buffer.\n
+goto_view gui.goto_view(n, relative)\nGoes to the specified view. Activates the 'view_*_switch' signal.\n@param n A relative or absolute view index.\n@param relative Flag indicating if n is a relative index or not. Defaults\nto false.\n
+grab_focus buffer.grab_focus(buffer)\nSet the focus to this view.\n@param buffer The global buffer.\n
graph lexer.graph\nMatches any graphical character (`!` to `~`).\n
green lexer.colors.green\nGreen.\n
grey lexer.colors.grey\nGrey.\n
grow_selection _m.textadept.editing.grow_selection(amount)\nGrows the selection by a character amount on either end.\n@param amount The amount to grow the selection on either end.\n
gsub string.gsub(s, pattern, repl [, n])\nReturns a copy of `s` in which all (or the first `n`, if given) occurrences\nof the `pattern` have been replaced by a replacement string specified by\n`repl`, which can be a string, a table, or a function. `gsub` also returns,\nas its second value, the total number of matches that occurred. If `repl`\nis a string, then its value is used for replacement. The character `%`\nworks as an escape character: any sequence in `repl` of the form `%n`, with\n*n* between 1 and 9, stands for the value of the *n*-th captured substring\n(see below). The sequence `%0` stands for the whole match. The sequence `%%`\nstands for a single `%`. If `repl` is a table, then the table is queried for\nevery match, using the first capture as the key; if the pattern specifies no\ncaptures, then the whole match is used as the key. If `repl` is a function,\nthen this function is called every time a match occurs, with all captured\nsubstrings passed as arguments, in order; if the pattern specifies no\ncaptures, then the whole match is passed as a sole argument. If the value\nreturned by the table query or by the function call is a string or a number,\nthen it is used as the replacement string; otherwise, if it is false or nil,\nthen there is no replacement (that is, the original match is kept in the\nstring). Here are some examples: x = string.gsub("hello world", "(%w+)",\n"%1 %1") --> x="hello hello world world" x = string.gsub("hello world", "%w+",\n"%0 %0", 1) --> x="hello hello world" x = string.gsub("hello world from Lua",\n"(%w+)%s*(%w+)", "%2 %1") --> x="world hello Lua from" x = string.gsub("home =\n$HOME, user = $USER", "%$(%w+)", os.getenv) --> x="home = /home/roberto, user =\nroberto" x = string.gsub("4+5 = $return 4+5$", "%$(.-)%$", function (s) return\nloadstring(s)() end) --> x="4+5 = 9" local t = {name="lua", version="5.1"}\nx = string.gsub("$name-$version.tar.gz", "%$(%w+)", t) --> x="lua-5.1.tar.gz"\n
-gtkmenu gui.gtkmenu(menu_table)\nCreates a GTK menu, returning the userdata.\n@param menu_table A table defining the menu. It is an ordered list of\ntables with a string menu item and integer menu ID. The string menu item is\nhandled as follows: 'gtk-*' - a stock menu item is created based on the GTK\nstock-id. 'separator' - a menu separator item is created. Otherwise a regular\nmenu item with a mnemonic is created. Submenus are just nested menu-structure\ntables. Their title text is defined with a 'title' key.\n
+gtkmenu gui.gtkmenu(menu_table)\nCreates a GTK menu, returning the userdata.\n@param menu_table A table defining the menu. It is an ordered list of tables\nwith a string menu item, integer menu ID, and optional keycode and modifier\nmask. The latter two are used to display key shortcuts in the menu. The string\nmenu item is handled as follows: 'gtk-*' - a stock menu item is created based\non the GTK stock-id. 'separator' - a menu separator item is created. Otherwise\na regular menu item with a mnemonic is created. Submenus are just nested\nmenu-structure tables. Their title text is defined with a 'title' key.\n@see keys.get_gdk_key\n
gui _G.gui [module]\nThe core gui table.\n
h_scroll_bar buffer.h_scroll_bar [bool]\nWhether the horizontal scroll bar is visible. Set to `false` to never see it\nand `true` to enable it again. The default state is to display it when needed.\n
handle_clear _m.textadept.adeptsense.handle_clear(sense)\nCalled when clearing an adeptsense. This function should be replaced with\nyour own if you have any persistant objects that need to be deleted.\n@param sense The adeptsense returned by adeptsense.new().\n
handle_ctag _m.textadept.adeptsense.handle_ctag(sense, tag_name, file_name, ex_cmd,\next_fields)\nCalled by load_ctags when a ctag kind is not recognized. This method should\nbe replaced with your own that is specific to the language.\n@param sense The adeptsense returned by adeptsense.new().\n@param tag_name The tag name.\n@param file_name The name of the file the tag belongs to.\n@param ex_cmd The ex_cmd returned by ctags.\n@param ext_fields The ext_fields returned by ctags.\n
handlers events.handlers [table]\nA table of event names and a table of functions connected to them.\n
hex_num lexer.hex_num\nMatches a hexadecimal number.\n
-hide_lines buffer.hide_lines(buffer, start_line, end_line)\nMake a range of lines invisible. This has no effect on fold levels or fold\nflags. start_line can not be hidden.\n@param buffer The focused buffer.\n@param start_line The start line.\n@param end_line The end line.\n
-hide_selection buffer.hide_selection(buffer, normal)\nDraw the selection in normal style or with selection highlighted.\n@param buffer The focused buffer.\n@param normal Draw normal selection.\n
+hide_lines buffer.hide_lines(buffer, start_line, end_line)\nMake a range of lines invisible. This has no effect on fold levels or fold\nflags. start_line can not be hidden.\n@param buffer The global buffer.\n@param start_line The start line.\n@param end_line The end line.\n
+hide_selection buffer.hide_selection(buffer, normal)\nDraw the selection in normal style or with selection highlighted.\n@param buffer The global buffer.\n@param normal Draw normal selection.\n
highlight_guide buffer.highlight_guide [number]\nThe highlighted indentation guide column. Set to 0 to cancel this highlight.\n
highlight_word _m.textadept.editing.highlight_word()\nHighlights all occurances of the word under the caret and adds markers to\nthe lines they are on.\n
-home buffer.home(buffer)\nMove caret to first position on line.\n@param buffer The focused buffer.\n
-home_display buffer.home_display(buffer)\nMove caret to first position on display line.\n@param buffer The focused buffer.\n
-home_display_extend buffer.home_display_extend(buffer)\nMove caret to first position on display line extending selection to new\ncaret position.\n@param buffer The focused buffer.\n
-home_extend buffer.home_extend(buffer)\nMove caret to first position on line extending selection to new caret position.\n@param buffer The focused buffer.\n
-home_rect_extend buffer.home_rect_extend(buffer)\nMove caret to first position on line, extending rectangular selection to\nnew caret position.\n@param buffer The focused buffer.\n
-home_wrap buffer.home_wrap(buffer)\nMove caret to the start of the display line when word-wrap is enabled. If\nalready there, go to the start of the document line.\n@param buffer The focused buffer.\n
-home_wrap_extend buffer.home_wrap_extend(buffer)\nLike `buffer:home_wrap()` but extending selection to new caret position.\n@param buffer The focused buffer.\n
+home buffer.home(buffer)\nMove caret to first position on line.\n@param buffer The global buffer.\n
+home_display buffer.home_display(buffer)\nMove caret to first position on display line.\n@param buffer The global buffer.\n
+home_display_extend buffer.home_display_extend(buffer)\nMove caret to first position on display line extending selection to new\ncaret position.\n@param buffer The global buffer.\n
+home_extend buffer.home_extend(buffer)\nMove caret to first position on line extending selection to new caret position.\n@param buffer The global buffer.\n
+home_rect_extend buffer.home_rect_extend(buffer)\nMove caret to first position on line, extending rectangular selection to\nnew caret position.\n@param buffer The global buffer.\n
+home_wrap buffer.home_wrap(buffer)\nMove caret to the start of the display line when word-wrap is enabled. If\nalready there, go to the start of the document line.\n@param buffer The global buffer.\n
+home_wrap_extend buffer.home_wrap_extend(buffer)\nLike `buffer:home_wrap()` but extending selection to new caret position.\n@param buffer The global buffer.\n
hotspot_active_underline buffer.hotspot_active_underline [bool]\nWhether active hotspots are underlined.\n
hotspot_single_line buffer.hotspot_single_line [bool]\nWhether hotspots are limited to single line so hotspots on two lines don't\nmerge.\n
-hypertext _G.keys.hypertext [table]\nContainer for HTML-specific key commands.\n
-hypertext _G.snippets.hypertext [table]\nContainer for HTML-specific snippets.\n
-hypertext _m.hypertext [module]\nThe hypertext module. It provides utilities for editing HTML code. User tags\nare loaded from _USERHOME/modules/hypertext/tags and user apis are loaded\nfrom _USERHOME/modules/hypertext/api.\n
+huge math.huge\nThe value `HUGE_VAL`, a value larger than or equal to any other numerical\nvalue.\n
iconv string.iconv(text, to, from)\nConverts a string from one character set to another using iconv(). Valid\ncharacter sets are ones GLib's g_convert() accepts, typically GNU iconv's\ncharacter sets.\n@param text The text to convert.\n@param to The character set to convert to.\n@param from The character set to convert from.\n
in_files gui.find.in_files [bool]\nSearch for the text in a list of files.\n
in_files_label_text gui.find.in_files_label_text [string]\nThe text of the 'In files' label. This is primarily used for\nlocalization. (Write-only)\n
@@ -1074,24 +1064,21 @@ indic_fore buffer.indic_fore [table]\nTable of foreground colors in 0xBBGGRR for
indic_outline_alpha buffer.indic_outline_alpha [table]\nTable of alpha transparency values ranging from 0 (transparent) to 255\n(opaque) or 256 (no alpha) for indicators from 0 to 31. Used for drawing\nthe outline color of the `INDIC_ROUNDBOX` and `INDIC_STRAIGHTBOX` rectangle.\n
indic_style buffer.indic_style [table]\nTable of styles for indicators from zero to 31.\n * `_SCINTILLA.constants.INDIC_PLAIN` (0): Underlined with a single,\n straight line.\n * `_SCINTILLA.constants.INDIC_SQUIGGLE` (1): A squiggly underline.\n Requires 3 pixels of descender space.\n * `_SCINTILLA.constants.INDIC_TT` (2): A line of small T shapes.\n * `_SCINTILLA.constants.INDIC_DIAGONAL` (3): Diagonal hatching.\n * `_SCINTILLA.constants.INDIC_STRIKE` (4): Strike out.\n * `_SCINTILLA.constants.INDIC_HIDDEN` (5): An indicator with no visual\n effect.\n * `_SCINTILLA.constants.INDIC_BOX` (6): A rectangle around the text.\n * `_SCINTILLA.constants.INDIC_ROUNDBOX` (7): A rectangle with rounded\n corners around the text using translucent drawing with the interior\n usually more transparent than the border. Use `buffer.indic_alpha`\n and `buffer.indic_outline_alpha` to control the alpha transparency\n values. The default alpha values are 30 for fill color and 50 for\n outline color.\n * `_SCINTILLA.constants.INDIC_STRAIGHTBOX` (8): A rectangle around the\n text using translucent drawing with the interior usually more\n transparent than the border. You can use `buffer.indic_alpha` and\n `buffer.indic_outline_alpha` to control the alpha transparency\n values. The default alpha values are 30 for fill color and 50 for\n outline color.\n * `_SCINTILLA.constants.INDIC_DASH` (9): A dashed underline.\n * `_SCINTILLA.constants.INDIC_DOTS` (10): A dotted underline.\n * `_SCINTILLA.constants.INDIC_SQUIGGLELOW` (11): Similar to\n `INDIC_SQUIGGLE` but only using 2 vertical pixels so will fit under\n small fonts.\n * `_SCINTILLA.constants.INDIC_DOTBOX` (12): A dotted rectangle around\n the text using translucent drawing. Translucency alternates between\n the alpha and outline alpha settings with the top-left pixel using\n the alpha setting. `buffer.indic_alpha` and\n `buffer.indic_outline_alpha` control the alpha transparency values.\n The default values are 30 for alpha and 50 for outline alpha. To\n avoid excessive memory allocation the maximum width of a dotted box\n is 4000 pixels.\n * Use `_SCINTILLA.next_indic_number()` for custom indicators.\n\n
indic_under buffer.indic_under [table]\nTable of booleans for drawing under text or over (default) for indicators\nfrom zero to 31.\n
-indicator_all_on_for buffer.indicator_all_on_for(buffer, pos)\nRetrieve a bitmap value representing which indicators are non-zero at a\nposition. Bit 0 is set if indicator 0 is present, bit 1 for indicator 1 and\nso on.\n@param buffer The focused buffer.\n@param pos The position.\n@return number\n
-indicator_clear_range buffer.indicator_clear_range(buffer, pos, clear_length)\nTurn a indicator off over a range.\n@param buffer The focused buffer.\n@param pos The start position.\n@param clear_length The length.\n
+indicator_all_on_for buffer.indicator_all_on_for(buffer, pos)\nRetrieve a bitmap value representing which indicators are non-zero at a\nposition. Bit 0 is set if indicator 0 is present, bit 1 for indicator 1 and\nso on.\n@param buffer The global buffer.\n@param pos The position.\n@return number\n
+indicator_clear_range buffer.indicator_clear_range(buffer, pos, clear_length)\nTurn a indicator off over a range.\n@param buffer The global buffer.\n@param pos The start position.\n@param clear_length The length.\n
indicator_current buffer.indicator_current [number]\nThe indicator in the range of 0 to 31 used for `buffer:indicator_fill_range()`\nand `buffer:indicator_clear_range()`.\n
-indicator_end buffer.indicator_end(buffer, indicator, pos)\nFind the position where a particular indicator ends.\n@param buffer The focused buffer.\n@param indicator An indicator number in the range of 0 to 31.\n@param pos The position of the indicator.\n
-indicator_fill_range buffer.indicator_fill_range(buffer, pos, fill_length)\nTurn a indicator on over a range. This function fills with the current\nindicator value.\n@param buffer The focused buffer.\n@param pos the start position.\n@param fill_length The length.\n
-indicator_start buffer.indicator_start(buffer, indicator, pos)\nFind the position where a particular indicator starts.\n@param buffer The focused buffer.\n@param indicator An indicator number in the range of 0 to 31.\n@param pos The position of the indicator.\n
+indicator_end buffer.indicator_end(buffer, indicator, pos)\nFind the position where a particular indicator ends.\n@param buffer The global buffer.\n@param indicator An indicator number in the range of 0 to 31.\n@param pos The position of the indicator.\n
+indicator_fill_range buffer.indicator_fill_range(buffer, pos, fill_length)\nTurn a indicator on over a range. This function fills with the current\nindicator value.\n@param buffer The global buffer.\n@param pos the start position.\n@param fill_length The length.\n
+indicator_start buffer.indicator_start(buffer, indicator, pos)\nFind the position where a particular indicator starts.\n@param buffer The global buffer.\n@param indicator An indicator number in the range of 0 to 31.\n@param pos The position of the indicator.\n
indicator_value buffer.indicator_value [number]\nThe indicator value used for `buffer:indicator_fill_range()`. Currently all\nvalues are drawn the same.\n
-indicator_value_at buffer.indicator_value_at(buffer, indicator, pos)\nRetrieve the value of a particular indicator at a position. Currently all\nvalues are drawn the same.\n@param buffer The focused buffer.\n@param indicator The indicator number in the range of 0 to 31.\n@param pos The position.\n@return number\n
+indicator_value_at buffer.indicator_value_at(buffer, indicator, pos)\nRetrieve the value of a particular indicator at a position. Currently all\nvalues are drawn the same.\n@param buffer The global buffer.\n@param indicator The indicator number in the range of 0 to 31.\n@param pos The position.\n@return number\n
inherited_classes _m.textadept.adeptsense.inherited_classes [table]\nContains a map of classes and a list of their inherited classes.\n
input io.input([file])\nWhen called with a file name, it opens the named file (in text mode), and\nsets its handle as the default input file. When called with a file handle,\nit simply sets this file handle as the default input file. When called\nwithout parameters, it returns the current default input file. In case of\nerrors this function raises the error, instead of returning an error code.\n
insert table.insert(table, [pos, ] value)\nInserts element `value` at position `pos` in `table`, shifting up other\nelements to open space, if necessary. The default value for `pos` is\n`n+1`, where `n` is the length of the table (see §2.5.5), so that a call\n`table.insert(t,x)` inserts `x` at the end of table `t`.\n
-insert_text buffer.insert_text(buffer, pos, text)\nInsert string at a position. If the current position is after the insertion\npoint then it is moved along with its surrounding text but no scrolling\nis performed.\n@param buffer The focused buffer.\n@param pos The position to insert text at or -1 for the current position.\n@param text The text to insert.\n
+insert_text buffer.insert_text(buffer, pos, text)\nInsert string at a position. If the current position is after the insertion\npoint then it is moved along with its surrounding text but no scrolling\nis performed.\n@param buffer The global buffer.\n@param pos The position to insert text at or -1 for the current position.\n@param text The text to insert.\n
integer lexer.integer\nMatches a decimal, hexadecimal, or octal number.\n
io _G.io [module]\nLua io module.\n
ipairs _G.ipairs(t)\nReturns three values: an iterator function, the table `t`, and 0, so that\nthe construction for i,v in ipairs(t) do *body* end will iterate over the\npairs (`1,t[1]`), (`2,t[2]`), ···, up to the first integer key absent\nfrom the table.\n
-java _G.keys.java [table]\nContainer for Java-specific key commands.\n
-java _G.snippets.java [table]\nContainer for Java-specific snippets.\n
-java _m.java [module]\nThe java module. It provides utilities for editing Java code. User tags\nare loaded from _USERHOME/modules/java/tags and user apis are loaded from\n_USERHOME/modules/java/api.\n
join_lines _m.textadept.editing.join_lines()\nJoins the current line with the line below.\n
keys _G.keys [module]\nManages key commands in Textadept.\n
keys _m.textadept.keys [module]\nDefines key commands for Textadept. This set of key commands is pretty\nstandard among other text editors. This module, should be 'require'ed last,\nbut before _m.textadept.menu.\n
@@ -1105,45 +1092,44 @@ lexer _G.lexer [module]\nPerforms lexing of Scintilla documents.\n
lexer buffer.lexer [number]\nThe lexing language of the document.\n
lexers _m.textadept.mime_types.lexers [table]\nList of detected lexers. Lexers are read from `lexers/` and\n`~/.textadept/lexers/`.\n
lfs _G.lfs [module]\nLua lfs module.\n
-line_copy buffer.line_copy(buffer)\nCopy the line containing the caret.\n@param buffer The focused buffer.\n
+line_copy buffer.line_copy(buffer)\nCopy the line containing the caret.\n@param buffer The global buffer.\n
line_count buffer.line_count [number]\nThe number of lines in the document. There is always at least one. (Read-only)\n
-line_cut buffer.line_cut(buffer)\nCut the line containing the caret.\n@param buffer The focused buffer.\n
-line_delete buffer.line_delete(buffer)\nDelete the line containing the caret.\n@param buffer The focused buffer.\n
-line_down buffer.line_down(buffer)\nMove caret down one line.\n@param buffer The focused buffer.\n
-line_down_extend buffer.line_down_extend(buffer)\nMove caret down one line extending selection to new caret position.\n@param buffer The focused buffer.\n
-line_down_rect_extend buffer.line_down_rect_extend(buffer)\nMove caret down one line, extending rectangular selection to new caret\nposition.\n@param buffer The focused buffer.\n
-line_duplicate buffer.line_duplicate(buffer)\nDuplicate the current line.\n@param buffer The focused buffer.\n
-line_end buffer.line_end(buffer)\nMove caret to last position on line.\n@param buffer The focused buffer.\n
-line_end_display buffer.line_end_display(buffer)\nMove caret to last position on display line.\n@param buffer The focused buffer.\n
-line_end_display_extend buffer.line_end_display_extend(buffer)\nMove caret to last position on display line extending selection to new\ncaret position.\n@param buffer The focused buffer.\n
-line_end_extend buffer.line_end_extend(buffer)\nMove caret to last position on line extending selection to new caret position.\n@param buffer The focused buffer.\n
+line_cut buffer.line_cut(buffer)\nCut the line containing the caret.\n@param buffer The global buffer.\n
+line_delete buffer.line_delete(buffer)\nDelete the line containing the caret.\n@param buffer The global buffer.\n
+line_down buffer.line_down(buffer)\nMove caret down one line.\n@param buffer The global buffer.\n
+line_down_extend buffer.line_down_extend(buffer)\nMove caret down one line extending selection to new caret position.\n@param buffer The global buffer.\n
+line_down_rect_extend buffer.line_down_rect_extend(buffer)\nMove caret down one line, extending rectangular selection to new caret\nposition.\n@param buffer The global buffer.\n
+line_duplicate buffer.line_duplicate(buffer)\nDuplicate the current line.\n@param buffer The global buffer.\n
+line_end buffer.line_end(buffer)\nMove caret to last position on line.\n@param buffer The global buffer.\n
+line_end_display buffer.line_end_display(buffer)\nMove caret to last position on display line.\n@param buffer The global buffer.\n
+line_end_display_extend buffer.line_end_display_extend(buffer)\nMove caret to last position on display line extending selection to new\ncaret position.\n@param buffer The global buffer.\n
+line_end_extend buffer.line_end_extend(buffer)\nMove caret to last position on line extending selection to new caret position.\n@param buffer The global buffer.\n
line_end_position buffer.line_end_position [table]\nTable of positions after the last visible characters on a line for lines\nstarting from zero. (Read-only)\n
-line_end_rect_extend buffer.line_end_rect_extend(buffer)\nMove caret to last position on line, extending rectangular selection to new\ncaret position.\n@param buffer The focused buffer.\n
-line_end_wrap buffer.line_end_wrap(buffer)\nMove caret to the end of the display line when word-wrap is enabled. If\nalready there, go to the end of the document line.\n@param buffer The focused buffer.\n
-line_end_wrap_extend buffer.line_end_wrap_extend(buffer)\nLike `buffer:line_end_wrap()` but extending selection to new caret position.\n@param buffer The focused buffer.\n
-line_from_position buffer.line_from_position(buffer, pos)\nRetrieve the line containing a position.\n@param buffer The focused buffer.\n@param pos The position.\n@return number\n
+line_end_rect_extend buffer.line_end_rect_extend(buffer)\nMove caret to last position on line, extending rectangular selection to new\ncaret position.\n@param buffer The global buffer.\n
+line_end_wrap buffer.line_end_wrap(buffer)\nMove caret to the end of the display line when word-wrap is enabled. If\nalready there, go to the end of the document line.\n@param buffer The global buffer.\n
+line_end_wrap_extend buffer.line_end_wrap_extend(buffer)\nLike `buffer:line_end_wrap()` but extending selection to new caret position.\n@param buffer The global buffer.\n
+line_from_position buffer.line_from_position(buffer, pos)\nRetrieve the line containing a position.\n@param buffer The global buffer.\n@param pos The position.\n@return number\n
line_indent_position buffer.line_indent_position [table]\nTable of positions before the first non indentation character on a line for\nlines starting from zero. (Read-only)\n
line_indentation buffer.line_indentation [table]\nTable of line indentation amounts for lines starting from zero. The indentation\nis measured in character columns, which correspond to the width of space\ncharacters.\n
-line_length buffer.line_length(buffer, line)\nReturns how many characters are on a line, including end of line characters. To\nget the length of the line not including any end of line characters, use\n`buffer.line_end_position[line] - buffer:position_from_line(line)`.\n@param buffer The focused buffer.\n@param line The line number.\n@return number\n
-line_scroll buffer.line_scroll(buffer, columns, lines)\nScroll horizontally and vertically.\n@param buffer The focused buffer.\n@param columns The number of columns to scroll horizontally.\n@param lines The number of lines to scroll vertically.\n
-line_scroll_down buffer.line_scroll_down(buffer)\nScroll the document down, keeping the caret visible.\n@param buffer The focused buffer.\n
-line_scroll_up buffer.line_scroll_up(buffer)\nScroll the document up, keeping the caret visible.\n@param buffer The focused buffer.\n
+line_length buffer.line_length(buffer, line)\nReturns how many characters are on a line, including end of line characters. To\nget the length of the line not including any end of line characters, use\n`buffer.line_end_position[line] - buffer:position_from_line(line)`.\n@param buffer The global buffer.\n@param line The line number.\n@return number\n
+line_scroll buffer.line_scroll(buffer, columns, lines)\nScroll horizontally and vertically.\n@param buffer The global buffer.\n@param columns The number of columns to scroll horizontally.\n@param lines The number of lines to scroll vertically.\n
+line_scroll_down buffer.line_scroll_down(buffer)\nScroll the document down, keeping the caret visible.\n@param buffer The global buffer.\n
+line_scroll_up buffer.line_scroll_up(buffer)\nScroll the document up, keeping the caret visible.\n@param buffer The global buffer.\n
line_state buffer.line_state [table]\nTable of extra styling information for lines starting from zero. As well\nas the 8 bits of lexical state stored for each character there is also an\ninteger stored for each line. This can be used for longer lived parse states.\n
-line_transpose buffer.line_transpose(buffer)\nSwitch the current line with the previous.\n@param buffer The focused buffer.\n
-line_up buffer.line_up(buffer)\nMove caret up one line.\n@param buffer The focused buffer.\n
-line_up_extend buffer.line_up_extend(buffer)\nMove caret up one line extending selection to new caret position.\n@param buffer The focused buffer.\n
-line_up_rect_extend buffer.line_up_rect_extend(buffer)\nMove caret up one line, extending rectangular selection to new caret position.\n@param buffer The focused buffer.\n
+line_transpose buffer.line_transpose(buffer)\nSwitch the current line with the previous.\n@param buffer The global buffer.\n
+line_up buffer.line_up(buffer)\nMove caret up one line.\n@param buffer The global buffer.\n
+line_up_extend buffer.line_up_extend(buffer)\nMove caret up one line extending selection to new caret position.\n@param buffer The global buffer.\n
+line_up_rect_extend buffer.line_up_rect_extend(buffer)\nMove caret up one line, extending rectangular selection to new caret position.\n@param buffer The global buffer.\n
line_visible buffer.line_visible [bool]\nIs a line visible? (Read-only)\n
lines file:lines()\nReturns an iterator function that, each time it is called, returns a new\nline from the file. Therefore, the construction for line in file:lines()\ndo *body* end will iterate over all lines of the file. (Unlike `io.lines`,\nthis function does not close the file when the loop ends.)\n
lines io.lines([filename])\nOpens the given file name in read mode and returns an iterator function that,\neach time it is called, returns a new line from the file. Therefore, the\nconstruction for line in io.lines(filename) do *body* end will iterate over\nall lines of the file. When the iterator function detects the end of file,\nit returns nil (to finish the loop) and automatically closes the file. The\ncall `io.lines()` (with no file name) is equivalent to `io.input():lines()`;\nthat is, it iterates over the lines of the default input file. In this case\nit does not close the file when the loop ends.\n
-lines_join buffer.lines_join(buffer)\nJoin the lines in the target. Where this would lead to no space between words,\nan extra space is inserted.\n@param buffer The focused buffer.\n
+lines_join buffer.lines_join(buffer)\nJoin the lines in the target. Where this would lead to no space between words,\nan extra space is inserted.\n@param buffer The global buffer.\n
lines_on_screen buffer.lines_on_screen [number]\nThe number of lines completely visible. (Read-only)\n
-lines_split buffer.lines_split(buffer, pixel_width)\nSplit the lines in the target into lines that are less wide than pixel_width\nwhere possible.\n@param buffer The focused buffer.\n@param pixel_width The pixel width. When 0, the width of the view is used.\n
+lines_split buffer.lines_split(buffer, pixel_width)\nSplit the lines in the target into lines that are less wide than pixel_width\nwhere possible.\n@param buffer The global buffer.\n@param pixel_width The pixel width. When 0, the width of the view is used.\n
load _G.load(func [, chunkname])\nLoads a chunk using function `func` to get its pieces. Each call to `func`\nmust return a string that concatenates with previous results. A return of\nan empty string, nil, or no value signals the end of the chunk. If there\nare no errors, returns the compiled chunk as a function; otherwise, returns\nnil plus the error message. The environment of the returned function is the\nglobal environment. `chunkname` is used as the chunk name for error messages\nand debug information. When absent, it defaults to "`=(load)`".\n
load _m.textadept.session.load(filename)\nLoads a Textadept session file. Textadept restores split views, opened buffers,\ncursor information, and project manager details.\n@param filename The absolute path to the session file to load. Defaults to\nDEFAULT_SESSION if not specified.\n@usage _m.textadept.session.load(filename)\n@return true if the session file was opened and read; false otherwise.\n
load lexer.load(lexer_name)\nInitializes the specified lexer.\n@param lexer_name The name of the lexing language.\n
load_ctags _m.textadept.adeptsense.load_ctags(sense, tag_file, nolocations)\nLoads the given ctags file for autocompletion. It is recommended to pass '-n'\nto ctags in order to use line numbers instead of text patterns to locate\ntags. This will greatly reduce memory usage for a large number of symbols\nif nolocations is not true.\n@param sense The adeptsense returned by adeptsense.new().\n@param tag_file The path of the ctags file to load.\n@param nolocations If true, does not store the locations of the tags for\nuse by goto_ctag(). Defaults to false.\n
-load_project _m.rails.load_project(utf8_dir)\nSets keys.al.o to snapopen a Rails project. If not directory is provided,\nthe user is prompted for one.\n@param utf8_dir The UTF-8 Rails project directory.\n
loaded package.loaded\nA table used by `require` to control which modules are already loaded. When\nyou require a module `modname` and `package.loaded[modname]` is not false,\n`require` simply returns the value stored there.\n
loaders package.loaders\nA table used by `require` to control how to load modules. Each entry in\nthis table is a *searcher function*. When looking for a module, `require`\ncalls each of these searchers in ascending order, with the module name\n(the argument given to `require`) as its sole parameter. The function can\nreturn another function (the module *loader*) or a string explaining why it\ndid not find that module (or nil if it has nothing to say). Lua initializes\nthis table with four functions. The first searcher simply looks for a loader\nin the `package.preload` table. The second searcher looks for a loader as a\nLua library, using the path stored at `package.path`. A path is a sequence\nof *templates* separated by semicolons. For each template, the searcher will\nchange each interrogation mark in the template by `filename`, which is the\nmodule name with each dot replaced by a "directory separator" (such as "`/`"\nin Unix); then it will try to open the resulting file name. So, for instance,\nif the Lua path is the string\n "./?.lua;./?.lc;/usr/local/?/init.lua"\nthe search for a Lua file for module `foo` will try to open the files\n`./foo.lua`, `./foo.lc`, and `/usr/local/foo/init.lua`, in that order. The\nthird searcher looks for a loader as a C library, using the path given by\nthe variable `package.cpath`. For instance, if the C path is the string\n "./?.so;./?.dll;/usr/local/?/init.so"\nthe searcher for module `foo` will try to open the files `./foo.so`,\n`./foo.dll`, and `/usr/local/foo/init.so`, in that order. Once it finds\na C library, this searcher first uses a dynamic link facility to link the\napplication with the library. Then it tries to find a C function inside the\nlibrary to be used as the loader. The name of this C function is the string\n"`luaopen_`" concatenated with a copy of the module name where each dot is\nreplaced by an underscore. Moreover, if the module name has a hyphen, its\nprefix up to (and including) the first hyphen is removed. For instance, if the\nmodule name is `a.v1-b.c`, the function name will be `luaopen_b_c`. The fourth\nsearcher tries an *all-in-one loader*. It searches the C path for a library\nfor the root name of the given module. For instance, when requiring `a.b.c`,\nit will search for a C library for `a`. If found, it looks into it for an open\nfunction for the submodule; in our example, that would be `luaopen_a_b_c`. With\nthis facility, a package can pack several C submodules into one single library,\nwith each submodule keeping its original open function.\n
loadfile _G.loadfile([filename])\nSimilar to `load`, but gets the chunk from file `filename` or from the\nstandard input, if no file name is given.\n
@@ -1159,7 +1145,7 @@ log math.log(x)\nReturns the natural logarithm of `x`.\n
log10 math.log10(x)\nReturns the base-10 logarithm of `x`.\n
lower lexer.lower\nMatches any lowercase character (`a-z`).\n
lower string.lower(s)\nReceives a string and returns a copy of this string with all uppercase\nletters changed to lowercase. All other characters are left unchanged. The\ndefinition of what an uppercase letter is depends on the current locale.\n
-lower_case buffer.lower_case(buffer)\nTransform the selection to lower case.\n@param buffer The focused buffer.\n
+lower_case buffer.lower_case(buffer)\nTransform the selection to lower case.\n@param buffer The global buffer.\n
lpeg _G.lpeg [module]\nLua lpeg module.\n
lua _G.keys.lua [table]\nContainer for Lua-specific key commands.\n
lua _G.snippets.lua [table]\nContainer for Lua-specific snippets.\n
@@ -1168,36 +1154,36 @@ lua gui.find.lua [bool]\nThe search text is interpreted as a Lua pattern.\n
lua_pattern_label_text gui.find.lua_pattern_label_text [string]\nThe text of the 'Lua pattern' label. This is primarily used for\nlocalization. (Write-only)\n
main_selection buffer.main_selection [number]\nThe main selection. The main selection may be displayed in different colors\nor with a differently styled caret. Only an already existing selection can\nbe made main.\n
margin_cursor_n buffer.margin_cursor_n [table]\nTable of cursors shown for margins from zero to four. A reversed arrow cursor\nis normally shown over all margins.\n * `_SCINTILLA.constants.SC_CURSORARROW`: Normal arrow.\n * `_SCINTILLA.constants.SC_CURSORREVERSEARROW`: Reversed arrow.\n\n
-margin_get_text buffer.margin_get_text(buffer, line)\nGet the text in the text margin for a line.\n@param buffer The focused buffer.\n@param line The line number.\n@return string\n
+margin_get_text buffer.margin_get_text(buffer, line)\nGet the text in the text margin for a line.\n@param buffer The global buffer.\n@param line The line number.\n@return string\n
margin_left buffer.margin_left [number]\nThe size in pixels of the left margin. The default is to one pixel.\n
margin_mask_n buffer.margin_mask_n [table]\nTable of marker masks for margins from zero to four. A mask determines which\nmarkers are displayed in a margin.\n
margin_options buffer.margin_options [number]\nA bit mask of margin options.\n * `_SCINTILLA.constants.SC_MARGINOPTION_NONE` (0): None (default).\n * `_SCINTILLA.constants.SC_MARGINOPTION_SUBLINESELECT` (1): Controls\n how wrapped lines are selected when clicking on margin in front of\n them. If set, only sub line of wrapped line is selected, otherwise\n whole wrapped line is selected.\n\n
margin_right buffer.margin_right [number]\nThe size in pixels of the right margin. The default is to one pixel.\n
margin_sensitive_n buffer.margin_sensitive_n [table]\nTable of mouse click sensitivity booleans for margins from zero to four. A\nclick in a sensitive margin emits a `margin_click` event. By default, all\nmargins are insensitive.\n
-margin_set_text buffer.margin_set_text(buffer, line, text)\nSet the text in the text margin for a line.\n@param buffer The focused buffer.\n@param line The line number.\n@param text The text.\n
+margin_set_text buffer.margin_set_text(buffer, line, text)\nSet the text in the text margin for a line.\n@param buffer The global buffer.\n@param line The line number.\n@param text The text.\n
margin_style buffer.margin_style [table]\nTable of style numbers for text margin lines starting from zero.\n
margin_style_offset buffer.margin_style_offset [number]\nThe start of the range of style numbers used for margin text. Margin styles\nmay be completely separated from standard text styles by setting a style\noffset. For example, setting this to 256 would allow the margin styles to be\nnumbered from 256 upto 511 so they do not overlap styles set by lexers. Each\nstyle number set with `buffer.margin_style` has the offset added before\nlooking up the style.\n
-margin_text_clear_all buffer.margin_text_clear_all(buffer)\nClear the margin text on all lines.\n@param buffer The focused buffer.\n
+margin_text_clear_all buffer.margin_text_clear_all(buffer)\nClear the margin text on all lines.\n@param buffer The global buffer.\n
margin_type_n buffer.margin_type_n [table]\nTable of margin types for margins from zero to four.\n * `_SCINTILLA.constants.SC_MARGIN_SYMBOL` (0): A symbol margin.\n * `_SCINTILLA.constants.SC_MARGIN_NUMBER` (1): A line number margin.\n * `_SCINTILLA.constants.SC_MARGIN_BACK` (2): A symbol margin that sets\n its background color to match the default text background color.\n * `_SCINTILLA.constants.SC_MARGIN_FORE` (3): A symbol margin that sets\n its background color to match the default text foreground color.\n * `_SCINTILLA.constants.SC_MARGIN_TEXT` (4): A text margin.\n * `_SCINTILLA.constants.SC_MARGIN_RTEXT` (5): A right justified text\n margin.\n\n
margin_width_n buffer.margin_width_n [table]\nTable of margin widths expressed in pixes for margins from zero to four.\n
-marker_add buffer.marker_add(buffer, line, marker_num)\nAdd a marker to a line, returning an ID which can be used to find or delete\nthe marker. Returns -1 if this fails (illegal line number, out of memory).\n@param buffer The focused buffer.\n@param line The line number.\n@param marker_num A marker number in the range of 0 to 31.\n@return number\n
-marker_add_set buffer.marker_add_set(buffer, line, marker_mask)\nAdd a set of markers to a line.\n@param buffer The focused buffer.\n@param line The line number.\n@param marker_mask A mask of markers to set. Set bit 0 to set marker 0,\nbit 1 for marker 1 and so on.\n
-marker_define buffer.marker_define(buffer, marker_num, marker_symbol)\nSet the symbol used for a particular marker number.\n@param buffer The focused buffer.\n@param marker_num A marker number in the range of 0 to 31.\n@param marker_symbol A marker symbol: _SCINTILLA.constants.SC_MARK_*.\n@see _SCINTILLA.next_marker_number\n
-marker_define_pixmap buffer.marker_define_pixmap(buffer, marker_num, pixmap)\nDefine a marker from a pixmap.\n@param buffer The focused buffer.\n@param marker_num A marker number in the range of 0 to 31.\n@param pixmap Null-terminated pixmap data.\n
-marker_define_rgba_image buffer.marker_define_rgba_image(buffer, marker_num, pixels)\nDefine a marker from RGBA data. It has the width and height from\n`buffer.rgba_image_width` and `buffer.rgba_image_height`.\n@param buffer The focused buffer.\n@param marker_num A marker number in the range of 0 to 31.\n@param pixels A sequence of 4 byte pixel values starting with the pixels\nfor the top line, with the leftmost pixel first, then continuing with the\npixels for subsequent lines. There is no gap between lines for alignment\nreasons. Each pixel consists of, in order, a red byte, a green byte, a blue\nbyte and an alpha byte. The colour bytes are not premultiplied by the alpha\nvalue. That is, a fully red pixel that is 25% opaque will be [FF, 00, 00, 3F].\n
-marker_delete buffer.marker_delete(buffer, line, marker_num)\nDelete a marker from a line.\n@param buffer The focused buffer.\n@param line The line number.\n@param marker_num A marker number in the range of 0 to 31 or -1 to delete\nall markers from the line.\n
-marker_delete_all buffer.marker_delete_all(buffer, marker_num)\nDelete all markers with a particular number from all lines.\n@param buffer The focused buffer.\n@param marker_num A marker number in the range of 0 to 31 or -1 to delete\nall markers from all lines.\n
-marker_delete_handle buffer.marker_delete_handle(buffer, handle)\nDelete a marker.\n@param buffer The focused buffer.\n@param handle The identifier of a marker returned by buffer:marker_add().\n
-marker_enable_highlight buffer.marker_enable_highlight(buffer, enabled)\nEnable/disable highlight for current folding block (smallest one that contains\nthe caret)\n@param buffer The focused buffer.\n
-marker_get buffer.marker_get(buffer, line)\nGet a bit mask of all the markers set on a line. Bit 0 is set if marker 0\nis present, bit 1 for marker 1 and so on.\n@param buffer The focused buffer.\n@param line The line number.\n@return number.\n
-marker_line_from_handle buffer.marker_line_from_handle(buffer, handle)\nRetrieve the line number at which a particular marker is located. Returns\n-1 if it not found.\n@param buffer The focused buffer.\n@param handle The identifier of a marker returned by buffer:marker_add().\n@return number\n
-marker_next buffer.marker_next(buffer, start_line, marker_mask)\nFind the next line at or after start_line that includes a marker in\nmask. Return -1 when no more lines.\n@param buffer The focused buffer.\n@param start_line The start line.\n@param marker_mask A mask of markers to find. Set bit 0 to find marker 0,\nbit 1 for marker 1 and so on.\n@return number\n
-marker_previous buffer.marker_previous(buffer, start_line, marker_mask)\nFind the previous line before lineStart that includes a marker in mask.\n@param buffer The focused buffer.\n@param start_line The start line.\n@param marker_mask A mask of markers to find. Set bit 0 to find marker 0,\nbit 1 for marker 1 and so on.\n@return number\n
-marker_set_alpha buffer.marker_set_alpha(buffer, marker_num, alpha)\nSet the alpha used for a marker that is drawn in the text area, not the margin.\n@param buffer The focused buffer.\n@param marker_num A marker number in the range of 0 to 31.\n@param alpha An alpha value between 0 (transparent) and 255 (opaque), or\n256 for no alpha.\n
-marker_set_back buffer.marker_set_back(buffer, marker_num, color)\nSet the background color used for a particular marker number.\n@param buffer The focused buffer.\n@param marker_num A marker number in the range of 0 to 31.\n@param color A color in 0xBBGGRR format.\n
-marker_set_back_selected buffer.marker_set_back_selected(buffer, marker_num, color)\nSet the background color used for a particular marker number when its folding\nblock is selected.\n@param buffer The focused buffer.\n@param marker_num A marker number in the range of 0 to 31.\n@param color A color in 0xBBGGRR format. The default color is #FF0000.\n
-marker_set_fore buffer.marker_set_fore(buffer, marker_num, color)\nSet the foreground color used for a particular marker number.\n@param buffer The focused buffer.\n@param marker_num A marker number in the range of 0 to 31.\n@param color A color in 0xBBGGRR format.\n
-marker_symbol_defined buffer.marker_symbol_defined(buffer, marker_num)\nReturn the symbol defined for marker_num with `buffer:marker_define()`.\n@param buffer The focused buffer.\n@param marker_num A marker number in the range of 0 to 31.\n@return number\n
+marker_add buffer.marker_add(buffer, line, marker_num)\nAdd a marker to a line, returning an ID which can be used to find or delete\nthe marker. Returns -1 if this fails (illegal line number, out of memory).\n@param buffer The global buffer.\n@param line The line number.\n@param marker_num A marker number in the range of 0 to 31.\n@return number\n
+marker_add_set buffer.marker_add_set(buffer, line, marker_mask)\nAdd a set of markers to a line.\n@param buffer The global buffer.\n@param line The line number.\n@param marker_mask A mask of markers to set. Set bit 0 to set marker 0,\nbit 1 for marker 1 and so on.\n
+marker_define buffer.marker_define(buffer, marker_num, marker_symbol)\nSet the symbol used for a particular marker number.\n@param buffer The global buffer.\n@param marker_num A marker number in the range of 0 to 31.\n@param marker_symbol A marker symbol: _SCINTILLA.constants.SC_MARK_*.\n@see _SCINTILLA.next_marker_number\n
+marker_define_pixmap buffer.marker_define_pixmap(buffer, marker_num, pixmap)\nDefine a marker from a pixmap.\n@param buffer The global buffer.\n@param marker_num A marker number in the range of 0 to 31.\n@param pixmap Null-terminated pixmap data.\n
+marker_define_rgba_image buffer.marker_define_rgba_image(buffer, marker_num, pixels)\nDefine a marker from RGBA data. It has the width and height from\n`buffer.rgba_image_width` and `buffer.rgba_image_height`.\n@param buffer The global buffer.\n@param marker_num A marker number in the range of 0 to 31.\n@param pixels A sequence of 4 byte pixel values starting with the pixels\nfor the top line, with the leftmost pixel first, then continuing with the\npixels for subsequent lines. There is no gap between lines for alignment\nreasons. Each pixel consists of, in order, a red byte, a green byte, a blue\nbyte and an alpha byte. The colour bytes are not premultiplied by the alpha\nvalue. That is, a fully red pixel that is 25% opaque will be [FF, 00, 00, 3F].\n
+marker_delete buffer.marker_delete(buffer, line, marker_num)\nDelete a marker from a line.\n@param buffer The global buffer.\n@param line The line number.\n@param marker_num A marker number in the range of 0 to 31 or -1 to delete\nall markers from the line.\n
+marker_delete_all buffer.marker_delete_all(buffer, marker_num)\nDelete all markers with a particular number from all lines.\n@param buffer The global buffer.\n@param marker_num A marker number in the range of 0 to 31 or -1 to delete\nall markers from all lines.\n
+marker_delete_handle buffer.marker_delete_handle(buffer, handle)\nDelete a marker.\n@param buffer The global buffer.\n@param handle The identifier of a marker returned by buffer:marker_add().\n
+marker_enable_highlight buffer.marker_enable_highlight(buffer, enabled)\nEnable/disable highlight for current folding block (smallest one that contains\nthe caret)\n@param buffer The global buffer.\n
+marker_get buffer.marker_get(buffer, line)\nGet a bit mask of all the markers set on a line. Bit 0 is set if marker 0\nis present, bit 1 for marker 1 and so on.\n@param buffer The global buffer.\n@param line The line number.\n@return number.\n
+marker_line_from_handle buffer.marker_line_from_handle(buffer, handle)\nRetrieve the line number at which a particular marker is located. Returns\n-1 if it not found.\n@param buffer The global buffer.\n@param handle The identifier of a marker returned by buffer:marker_add().\n@return number\n
+marker_next buffer.marker_next(buffer, start_line, marker_mask)\nFind the next line at or after start_line that includes a marker in\nmask. Return -1 when no more lines.\n@param buffer The global buffer.\n@param start_line The start line.\n@param marker_mask A mask of markers to find. Set bit 0 to find marker 0,\nbit 1 for marker 1 and so on.\n@return number\n
+marker_previous buffer.marker_previous(buffer, start_line, marker_mask)\nFind the previous line before lineStart that includes a marker in mask.\n@param buffer The global buffer.\n@param start_line The start line.\n@param marker_mask A mask of markers to find. Set bit 0 to find marker 0,\nbit 1 for marker 1 and so on.\n@return number\n
+marker_set_alpha buffer.marker_set_alpha(buffer, marker_num, alpha)\nSet the alpha used for a marker that is drawn in the text area, not the margin.\n@param buffer The global buffer.\n@param marker_num A marker number in the range of 0 to 31.\n@param alpha An alpha value between 0 (transparent) and 255 (opaque), or\n256 for no alpha.\n
+marker_set_back buffer.marker_set_back(buffer, marker_num, color)\nSet the background color used for a particular marker number.\n@param buffer The global buffer.\n@param marker_num A marker number in the range of 0 to 31.\n@param color A color in 0xBBGGRR format.\n
+marker_set_back_selected buffer.marker_set_back_selected(buffer, marker_num, color)\nSet the background color used for a particular marker number when its folding\nblock is selected.\n@param buffer The global buffer.\n@param marker_num A marker number in the range of 0 to 31.\n@param color A color in 0xBBGGRR format. The default color is #FF0000.\n
+marker_set_fore buffer.marker_set_fore(buffer, marker_num, color)\nSet the foreground color used for a particular marker number.\n@param buffer The global buffer.\n@param marker_num A marker number in the range of 0 to 31.\n@param color A color in 0xBBGGRR format.\n
+marker_symbol_defined buffer.marker_symbol_defined(buffer, marker_num)\nReturn the symbol defined for marker_num with `buffer:marker_define()`.\n@param buffer The global buffer.\n@param marker_num A marker number in the range of 0 to 31.\n@return number\n
match lpeg.match(pattern, subject [, init])\nThe matching function. It attempts to match the given pattern against the\nsubject string. If the match succeeds, returns the index in the subject of\nthe first character after the match, or the captured values (if the pattern\ncaptured any value). An optional numeric argument init makes the match starts\nat that position in the subject string. As usual in Lua libraries, a negative\nvalue counts from the end. Unlike typical pattern-matching functions, match\nworks only in anchored mode; that is, it tries to match the pattern with a\nprefix of the given subject string (at position init), not with an arbitrary\nsubstring of the subject. So, if we want to find a pattern anywhere in a\nstring, we must either write a loop in Lua or write a pattern that matches\nanywhere. This second approach is easy and quite efficient; see examples.\n
match string.match(s, pattern [, init])\nLooks for the first *match* of `pattern` in the string `s`. If it finds one,\nthen `match` returns the captures from the pattern; otherwise it returns\nnil. If `pattern` specifies no captures, then the whole match is returned. A\nthird, optional numerical argument `init` specifies where to start the search;\nits default value is 1 and can be negative.\n
match_brace _m.textadept.editing.match_brace(select)\nGoes to a matching brace position, selecting the text inside if specified.\n@param select If true, selects the text between matching braces.\n
@@ -1218,15 +1204,15 @@ modify buffer.modify [bool]\nWhether the document is different from when it was
module _G.module(name [, ···])\nCreates a module. If there is a table in `package.loaded[name]`, this table is\nthe module. Otherwise, if there is a global table `t` with the given name, this\ntable is the module. Otherwise creates a new table `t` and sets it as the value\nof the global `name` and the value of `package.loaded[name]`. This function\nalso initializes `t._NAME` with the given name, `t._M` with the module (`t`\nitself), and `t._PACKAGE` with the package name (the full module name minus\nlast component; see below). Finally, `module` sets `t` as the new environment\nof the current function and the new value of `package.loaded[name]`, so\nthat `require` returns `t`. If `name` is a compound name (that is, one\nwith components separated by dots), `module` creates (or reuses, if they\nalready exist) tables for each component. For instance, if `name` is `a.b.c`,\nthen `module` stores the module table in field `c` of field `b` of global\n`a`. This function can receive optional *options* after the module name,\nwhere each option is a function to be applied over the module.\n
mouse_down_captures buffer.mouse_down_captures [bool]\nWhether the mouse is captured when its button is pressed.\n
mouse_dwell_time buffer.mouse_dwell_time [number]\nThe time the mouse must sit still to generate a mouse dwell event. If set\nto `_SCINTILLA.constants.SC_TIME_FOREVER`, the default, no dwell events\nare generated.\n
-move_caret_inside_view buffer.move_caret_inside_view(buffer)\nMove the caret inside current view if it's not there already. Any selection\nis lost.\n@param buffer The focused buffer.\n
-move_selected_lines_down buffer.move_selected_lines_down(buffer)\nMove the selected lines down one line, shifting the line below before the\nselection. The selection will be automatically extended to the beginning\nof the selection's first line and the end of the seletion's last line. If\nnothing was selected, the line the cursor is currently at will be selected.\n@param buffer The focused buffer.\n
-move_selected_lines_up buffer.move_selected_lines_up(buffer)\nMove the selected lines up one line, shifting the line above after the\nselection. The selection will be automatically extended to the beginning\nof the selection's first line and the end of the seletion's last line. If\nnothing was selected, the line the cursor is currently at will be selected.\n@param buffer The focused buffer.\n
+move_caret_inside_view buffer.move_caret_inside_view(buffer)\nMove the caret inside current view if it's not there already. Any selection\nis lost.\n@param buffer The global buffer.\n
+move_selected_lines_down buffer.move_selected_lines_down(buffer)\nMove the selected lines down one line, shifting the line below before the\nselection. The selection will be automatically extended to the beginning\nof the selection's first line and the end of the seletion's last line. If\nnothing was selected, the line the cursor is currently at will be selected.\n@param buffer The global buffer.\n
+move_selected_lines_up buffer.move_selected_lines_up(buffer)\nMove the selected lines up one line, shifting the line above after the\nselection. The selection will be automatically extended to the beginning\nof the selection's first line and the end of the seletion's last line. If\nnothing was selected, the line the cursor is currently at will be selected.\n@param buffer The global buffer.\n
multi_paste buffer.multi_paste [bool]\nThe effect of pasting when there are multiple selections.\n * `_SCINTILLA.constants.SC_MULTIPASTE_ONCE` (0): Pasted text can go\n into just the main selection (default).\n * `_SCINTILLA.constants.SC_MULTIPASTE_EACH` (1): Pasted text can go\n into each selection.\n\n
multiple_selection buffer.multiple_selection [bool]\nWhether multiple selections can be made. When multiple selection is disabled,\nit is not possible to select multiple ranges by holding down the Ctrl key\nwhile dragging with the mouse.\n
nested_pair lexer.nested_pair(start_chars, end_chars, end_optional)\nSimilar to `delimited_range()`, but allows for multi-character\ndelimitters. This is useful for lexers with tokens such as nested block\ncomments. With single-character delimiters, this function is identical to\n`delimited_range(start_chars..end_chars, nil, end_optional, true)`.\n@param start_chars The string starting a nested sequence.\n@param end_chars The string ending a nested sequence.\n@param end_optional Optional flag indicating whether or not an ending delimiter\nis optional or not. If true, the range begun by the start delimiter matches\nuntil an end delimiter or the end of the input is reached.\n@usage local nested_comment = l.nested_pair('/*', '*/', true)\n
new _m.textadept.adeptsense.new(lang)\nCreates a new adeptsense for the given lexer language. Only one sense can\nexist per language.\n@param lang The lexer language to create an adeptsense for.\n@usage local lua_sense = _m.textadept.adeptsense.new('lua')\n@return adeptsense.\n
new_buffer _G.new_buffer()\nCreates a new buffer. Activates the 'buffer_new' signal.\n@return the new buffer.\n
-new_line buffer.new_line(buffer)\nInsert a new line, may use a CRLF, CR or LF depending on EOL mode.\n@param buffer The focused buffer.\n
+new_line buffer.new_line(buffer)\nInsert a new line, may use a CRLF, CR or LF depending on EOL mode.\n@param buffer The global buffer.\n
newline lexer.newline\nMatches any newline characters.\n
next _G.next(table [, index])\nAllows a program to traverse all fields of a table. Its first argument is\na table and its second argument is an index in this table. `next` returns\nthe next index of the table and its associated value. When called with nil\nas its second argument, `next` returns an initial index and its associated\nvalue. When called with the last index, or with nil in an empty table,\n`next` returns nil. If the second argument is absent, then it is interpreted\nas nil. In particular, you can use `next(t)` to check whether a table is\nempty. The order in which the indices are enumerated is not specified, *even\nfor numeric indices*. (To traverse a table in numeric order, use a numerical\nfor or the `ipairs` function.) The behavior of `next` is *undefined* if,\nduring the traversal, you assign any value to a non-existent field in the\ntable. You may however modify existing fields. In particular, you may clear\nexisting fields.\n
next_indic_number _SCINTILLA.next_indic_number()\nReturns a unique indicator number. Use this function for custom indicators\nin order to prevent clashes with identifiers of other custom indicators.\n@usage local indic_num = _SCINTILLA.next_indic_number()\n@see buffer.indic_style\n
@@ -1234,7 +1220,6 @@ next_marker_number _SCINTILLA.next_marker_number()\nReturns a unique marker numb
next_user_list_type _SCINTILLA.next_user_list_type()\nReturns a unique user list type. Use this function for custom user lists in\norder to prevent clashes with type identifiers of other custom user lists.\n@usage local list_type = _SCINTILLA.next_user_list_type()\n@see buffer.user_list_show\n
nonnewline lexer.nonnewline\nMatches any non-newline character.\n
nonnewline_esc lexer.nonnewline_esc\nMatches any non-newline character excluding newlines escaped with `\\`.\n
-notification events.notification(n)\nHandles Scintilla notifications.\n@param n The Scintilla notification structure as a Lua table.\n@return true or false if any handler explicitly returned such; nil otherwise.\n
oct_num lexer.oct_num\nMatches an octal number.\n
open _m.textadept.snapopen.open(utf8_paths, filter, exclusive, depth)\nQuickly open a file in set of directories.\n@param utf8_paths A UTF-8 string directory path or table of UTF-8 directory\npaths to search.\n@param filter A filter for files and folders to exclude. The filter may be\na string or table. Each filter is a Lua pattern. Any files matching a filter\nare excluded. Prefix a pattern with '!' to exclude any files that do not match\nthe filter. Directories can be excluded by adding filters to a table assigned\nto a 'folders' key in the filter table. All strings should be UTF-8 encoded.\n@param exclusive Flag indicating whether or not to exclude PATHS in the\nsearch. Defaults to false.\n@param depth Number of directories to recurse into for finding files. Defaults\nto DEFAULT_DEPTH.\n@usage _m.textadept.snapopen.open()\n@usage _m.textadept.snapopen.open(buffer.filename:match('^.+/'), nil, true)\n@usage _m.textadept.snapopen.open(nil, '!%.lua$')\n@usage _m.textadept.snapopen.open(nil, { folders = { '%.hg' } })\n
open io.open(filename [, mode])\nThis function opens a file, in the mode specified in the string `mode`. It\nreturns a new file handle, or, in case of errors, nil plus an error\nmessage. The `mode` string can be any of the following: "r": read mode (the\ndefault); "w": write mode; "a": append mode; "r+": update mode, all previous\ndata is preserved; "w+": update mode, all previous data is erased; "a+":\nappend update mode, previous data is preserved, writing is only allowed at\nthe end of file. The `mode` string can also have a '`b`' at the end, which\nis needed in some systems to open the file in binary mode. This string is\nexactly what is used in the standard C function `fopen`.\n
@@ -1245,34 +1230,31 @@ os _G.os [module]\nLua os module.\n
output io.output([file])\nSimilar to `io.input`, but operates over the default output file.\n
overtype buffer.overtype [bool]\nOvertype mode.\n
package _G.package [module]\nLua package module.\n
-page_down buffer.page_down(buffer)\nMove caret one page down.\n@param buffer The focused buffer.\n
-page_down_extend buffer.page_down_extend(buffer)\nMove caret one page down extending selection to new caret position.\n@param buffer The focused buffer.\n
-page_down_rect_extend buffer.page_down_rect_extend(buffer)\nMove caret one page down, extending rectangular selection to new caret\nposition.\n@param buffer The focused buffer.\n
-page_up buffer.page_up(buffer)\nMove caret one page up.\n@param buffer The focused buffer.\n
-page_up_extend buffer.page_up_extend(buffer)\nMove caret one page up extending selection to new caret position.\n@param buffer The focused buffer.\n
-page_up_rect_extend buffer.page_up_rect_extend(buffer)\nMove caret one page up, extending rectangular selection to new caret position.\n@param buffer The focused buffer.\n
+page_down buffer.page_down(buffer)\nMove caret one page down.\n@param buffer The global buffer.\n
+page_down_extend buffer.page_down_extend(buffer)\nMove caret one page down extending selection to new caret position.\n@param buffer The global buffer.\n
+page_down_rect_extend buffer.page_down_rect_extend(buffer)\nMove caret one page down, extending rectangular selection to new caret\nposition.\n@param buffer The global buffer.\n
+page_up buffer.page_up(buffer)\nMove caret one page up.\n@param buffer The global buffer.\n
+page_up_extend buffer.page_up_extend(buffer)\nMove caret one page up extending selection to new caret position.\n@param buffer The global buffer.\n
+page_up_rect_extend buffer.page_up_rect_extend(buffer)\nMove caret one page up, extending rectangular selection to new caret position.\n@param buffer The global buffer.\n
pairs _G.pairs(t)\nReturns three values: the `next` function, the table `t`, and nil, so that\nthe construction for k,v in pairs(t) do *body* end will iterate over all\nkey–value pairs of table `t`. See function `next` for the caveats of\nmodifying the table during its traversal.\n
-para_down buffer.para_down(buffer)\nMove caret one paragraph down (delimited by empty lines).\n@param buffer The focused buffer.\n
-para_down_extend buffer.para_down_extend(buffer)\nMove caret one paragraph down (delimited by empty lines) extending selection\nto new caret position.\n@param buffer The focused buffer.\n
-para_up buffer.para_up(buffer)\nMove caret one paragraph up (delimited by empty lines).\n@param buffer The focused buffer.\n
-para_up_extend buffer.para_up_extend(buffer)\nMove caret one paragraph up (delimited by empty lines) extending selection\nto new caret position.\n@param buffer The focused buffer.\n
-paste buffer.paste(buffer)\nPaste the contents of the clipboard into the document replacing the selection.\n@param buffer The focused buffer.\n
+para_down buffer.para_down(buffer)\nMove caret one paragraph down (delimited by empty lines).\n@param buffer The global buffer.\n
+para_down_extend buffer.para_down_extend(buffer)\nMove caret one paragraph down (delimited by empty lines) extending selection\nto new caret position.\n@param buffer The global buffer.\n
+para_up buffer.para_up(buffer)\nMove caret one paragraph up (delimited by empty lines).\n@param buffer The global buffer.\n
+para_up_extend buffer.para_up_extend(buffer)\nMove caret one paragraph up (delimited by empty lines) extending selection\nto new caret position.\n@param buffer The global buffer.\n
+paste buffer.paste(buffer)\nPaste the contents of the clipboard into the document replacing the selection.\n@param buffer The global buffer.\n
path package.path\nThe path used by `require` to search for a Lua loader. At start-up,\nLua initializes this variable with the value of the environment variable\n`LUA_PATH` or with a default path defined in `luaconf.h`, if the environment\nvariable is not defined. Any "`;;`" in the value of the environment variable\nis replaced by the default path.\n
patterns _m.textadept.mime_types.patterns [table]\nFirst-line patterns and their associated lexers.\n
pcall _G.pcall(f, arg1, ···)\nCalls function `f` with the given arguments in *protected mode*. This means\nthat any error inside `f` is not propagated; instead, `pcall` catches the\nerror and returns a status code. Its first result is the status code (a\nboolean), which is true if the call succeeds without errors. In such case,\n`pcall` also returns all results from the call, after this first result. In\ncase of any error, `pcall` returns false plus the error message.\n
-php _G.keys.php [table]\nContainer for PHP-specific key commands.\n
-php _G.snippets.php [table]\nContainer for PHP-specific snippets.\n
-php _m.php [module]\nThe php module. It provides utilities for editing PHP code. User tags\nare loaded from _USERHOME/modules/php/tags and user apis are loaded from\n_USERHOME/modules/php/api.\n
pi math.pi\nThe value of *pi*.\n
-point_x_from_position buffer.point_x_from_position(buffer, pos)\nRetrieve the x value of the point in the window where a position is displayed.\n@param buffer The focused buffer.\n@param pos The position.\n@return number\n
-point_y_from_position buffer.point_y_from_position(buffer, pos)\nRetrieve the y value of the point in the window where a position is displayed.\n@param buffer The focused buffer.\n@param pos The position.\n@return number\n
+point_x_from_position buffer.point_x_from_position(buffer, pos)\nRetrieve the x value of the point in the window where a position is displayed.\n@param buffer The global buffer.\n@param pos The position.\n@return number\n
+point_y_from_position buffer.point_y_from_position(buffer, pos)\nRetrieve the y value of the point in the window where a position is displayed.\n@param buffer The global buffer.\n@param pos The position.\n@return number\n
popen io.popen(prog [, mode])\nStarts program `prog` in a separated process and returns a file handle that\nyou can use to read data from this program (if `mode` is `"r"`, the default)\nor to write data to this program (if `mode` is `"w"`). This function is\nsystem dependent and is not available on all platforms.\n
-position_after buffer.position_after(buffer, pos)\nGiven a valid document position, return the next position taking code page\ninto account. Maximum value returned is the last position in the document.\n@param buffer The focused buffer.\n@param pos The position.\n
-position_before buffer.position_before(buffer, pos)\nGiven a valid document position, return the previous position taking code\npage into account. Returns 0 if passed 0.\n@param buffer The focused buffer.\n@param pos The position.\n@return number\n
+position_after buffer.position_after(buffer, pos)\nGiven a valid document position, return the next position taking code page\ninto account. Maximum value returned is the last position in the document.\n@param buffer The global buffer.\n@param pos The position.\n
+position_before buffer.position_before(buffer, pos)\nGiven a valid document position, return the previous position taking code\npage into account. Returns 0 if passed 0.\n@param buffer The global buffer.\n@param pos The position.\n@return number\n
position_cache buffer.position_cache [number]\nThe number of entries in the position cache. The position cache stores\nposition information for short runs of text so that their layout can be\ndetermined more quickly if the run recurs.\n
-position_from_line buffer.position_from_line(buffer, line)\nRetrieve the position at the start of a line. If line is greater than the\nlines in the document, returns -1.\n@param buffer The focused buffer.\n@param line The line.\n@return number\n
-position_from_point buffer.position_from_point(buffer, x, y)\nFind the position from a point within the window.\n@param buffer The focused buffer.\n@return number\n
-position_from_point_close buffer.position_from_point_close(buffer, x, y)\nReturns the position from a point within the window, but return -1 if not\nclose to text.\n@param buffer The focused buffer.\n@return number\n
+position_from_line buffer.position_from_line(buffer, line)\nRetrieve the position at the start of a line. If line is greater than the\nlines in the document, returns -1.\n@param buffer The global buffer.\n@param line The line.\n@return number\n
+position_from_point buffer.position_from_point(buffer, x, y)\nFind the position from a point within the window.\n@param buffer The global buffer.\n@return number\n
+position_from_point_close buffer.position_from_point_close(buffer, x, y)\nReturns the position from a point within the window, but return -1 if not\nclose to text.\n@param buffer The global buffer.\n@return number\n
pow math.pow(x, y)\nReturns *x^y*. (You can also use the expression `x^y` to compute this value.)\n
preload package.preload\nA table to store loaders for specific modules (see `require`).\n
prepare_for_save _m.textadept.editing.prepare_for_save()\nPrepares the buffer for saving to a file. Strips trailing whitespace off of\nevery line, ensures an ending newline, and converts non-consistent EOLs.\n
@@ -1282,7 +1264,7 @@ print lexer.print\nMatches any printable character (space to `~`).\n
print_colour_mode buffer.print_colour_mode [number]\nThe print color mode.\n * `_SCINTILLA.constants.SC_PRINT_NORMAL` (0): Print using the current\n screen colors. This is the default.\n * `_SCINTILLA.constants.SC_PRINT_INVERTLIGHT` (1): If you use a dark\n screen background this saves ink by inverting the light value of all\n colors and printing on a white background.\n * `_SCINTILLA.constants.SC_PRINT_BLACKONWHITE` (2): Print all text as\n black on a white background.\n * `_SCINTILLA.constants.SC_PRINT_COLOURONWHITE` (3): Everything prints\n in its own color on a white background.\n * `_SCINTILLA.constants.SC_PRINT_COLOURONWHITEDEFAULTBG` (4):\n Everything prints in its own color on a white background except that\n line numbers use their own background color.\n\n
print_magnification buffer.print_magnification [number]\nThe print magnification added to the point size of each style for printing.\n
print_wrap_mode buffer.print_wrap_mode [number]\nPrinting line wrap mode.\n * `_SCINTILLA.constants.SC_WRAP_NONE` (0): Each line of text generates\n one line of output and the line is truncated if it is too long to fit\n into the print area.\n * `_SCINTILLA.constants.SC_WRAP_WORD` (1): Wraps printed output so that\n all characters fit into the print rectangle. Tries to wrap only\n between words as indicated by white space or style changes although\n if a word is longer than a line, it will be wrapped before the line\n end. This is the default.\n * `_SCINTILLA.constants.SC_WRAP_CHAR` (2).\n\n
-private_lexer_call buffer.private_lexer_call(buffer, operation, data)\nFor private communication between an application and a known lexer.\n@param buffer The focused buffer.\n@param operation An operation number.\n@param data Number data.\n
+private_lexer_call buffer.private_lexer_call(buffer, operation, data)\nFor private communication between an application and a known lexer.\n@param buffer The global buffer.\n@param operation An operation number.\n@param data Number data.\n
process args.process()\nProcesses command line arguments. Add command line switches with\nargs.register(). Any unrecognized arguments are treated as filepaths and\nopened. Generates an 'arg_none' event when no args are present.\n@see register\n
prompt_load _m.textadept.session.prompt_load()\nPrompts the user for a Textadept session to load.\n
prompt_save _m.textadept.session.prompt_save()\nPrompts the user to save the current Textadept session to a file.\n
@@ -1293,9 +1275,6 @@ punct lexer.punct\nMatches any punctuation character not alphanumeric (`!` to `/
purple lexer.colors.purple\nPurple.\n
quit _G.quit()\nQuits Textadept.\n
rad math.rad(x)\nReturns the angle `x` (given in degrees) in radians.\n
-rails _G.keys.rails [table]\nContainer for Rails-specific key commands.\n
-rails _G.snippets.rails [table]\nContainer for Rails-specific snippets.\n
-rails _m.rails [module]\nThe rails module. It provides utilities for editing Ruby on Rails code. User\ntags are loaded from _USERHOME/modules/rails/tags and user apis are loaded\nfrom _USERHOME/modules/rails/api.\n
random math.random([m [, n]])\nThis function is an interface to the simple pseudo-random generator function\n`rand` provided by ANSI C. (No guarantees can be given for its statistical\nproperties.) When called without arguments, returns a uniform pseudo-random\nreal number in the range *[0,1)*. When called with an integer number `m`,\n`math.random` returns a uniform pseudo-random integer in the range *[1,\nm]*. When called with two integer numbers `m` and `n`, `math.random` returns\na uniform pseudo-random integer in the range *[m, n]*.\n
randomseed math.randomseed(x)\nSets `x` as the "seed" for the pseudo-random generator: equal seeds produce\nequal sequences of numbers.\n
rawequal _G.rawequal(v1, v2)\nChecks whether `v1` is equal to `v2`, without invoking any metamethod. Returns\na boolean.\n
@@ -1312,11 +1291,11 @@ rectangular_selection_caret buffer.rectangular_selection_caret [number]\nThe pos
rectangular_selection_caret_virtual_space buffer.rectangular_selection_caret_virtual_space [number]\nThe amount of virtual space for the caret of the rectangular selection.\n
rectangular_selection_modifier buffer.rectangular_selection_modifier [number]\nThe modifier key used to indicate that a rectangular selection should be\ncreated when combined with a mouse drag.\n * `_SCINTILLA.constants.SCMOD_CTRL` (2): Control key (default).\n * `_SCINTILLA.constants.SCMOD_ALT` (4): Alt key.\n * `_SCINTILLA.constants.SCMOD_SUPER` (8): Left Windows key on a Windows\n keyboard or the Command key on a Mac.\n\n
red lexer.colors.red\nRed.\n
-redo buffer.redo(buffer)\nRedoes the next action on the undo history.\n@param buffer The focused buffer.\n
+redo buffer.redo(buffer)\nRedoes the next action on the undo history.\n@param buffer The global buffer.\n
register args.register(switch1, switch2, narg, f, description)\nRegisters a command line switch.\n@param switch1 String switch (short version).\n@param switch2 String switch (long version).\n@param narg The number of expected parameters for the switch.\n@param f The Lua function to run when the switch is tripped.\n@param description Description of the switch.\n
-register_image buffer.register_image(buffer, type, xpm_data)\nRegister an XPM image for use in autocompletion lists.\n@param buffer The focused buffer.\n@param type Integer type to register the image with.\n@param xpm_data XPM data as is described for buffer:marker_define_pixmap().\n
-register_rgba_image buffer.register_rgba_image(buffer, type, pixels)\nRegister an RGBA image for use in autocompletion lists. It has the width\nand height from `buffer.rgba_image_width` and `buffer.rgba_image_height`.\n@param buffer The focused buffer.\n@param type Integer type to register the image with.\n@param pixels RGBA data as is described for buffer:marker_define_rgba_image().\n
-reload buffer.reload(buffer)\nReloads the file in a given buffer.\n@param buffer The focused buffer.\n
+register_image buffer.register_image(buffer, type, xpm_data)\nRegister an XPM image for use in autocompletion lists.\n@param buffer The global buffer.\n@param type Integer type to register the image with.\n@param xpm_data XPM data as is described for buffer:marker_define_pixmap().\n
+register_rgba_image buffer.register_rgba_image(buffer, type, pixels)\nRegister an RGBA image for use in autocompletion lists. It has the width\nand height from `buffer.rgba_image_width` and `buffer.rgba_image_height`.\n@param buffer The global buffer.\n@param type Integer type to register the image with.\n@param pixels RGBA data as is described for buffer:marker_define_rgba_image().\n
+reload buffer.reload(buffer)\nReloads the file in a given buffer.\n@param buffer The global buffer.\n
remove _m.textadept.bookmarks.remove()\nClears the bookmark at the current line.\n
remove os.remove(filename)\nDeletes the file or directory with the given name. Directories must be\nempty to be removed. If this function fails, it returns nil, plus a string\ndescribing the error.\n
remove table.remove(table [, pos])\nRemoves from `table` the element at position `pos`, shifting down other\nelements to close the space, if necessary. Returns the value of the removed\nelement. The default value for `pos` is `n`, where `n` is the length of the\ntable, so that a call `table.remove(t)` removes the last element of table `t`.\n
@@ -1328,47 +1307,41 @@ replace_all_button_text gui.find.replace_all_button_text [string]\nThe text of t
replace_button_text gui.find.replace_button_text [string]\nThe text of the 'Replace' button. This is primarily used for\nlocalization. (Write-only)\n
replace_entry_text gui.find.replace_entry_text [string]\nThe text in the replace entry.\n
replace_label_text gui.find.replace_label_text [string]\nThe text of the 'Replace' label. This is primarily used for\nlocalization. (Write-only)\n
-replace_sel buffer.replace_sel(buffer, text)\nReplace the selected text with the argument text. The caret is positioned\nafter the inserted text and the caret is scrolled into view.\n@param buffer The focused buffer.\n@param text The text.\n
-replace_target buffer.replace_target(buffer, text)\nReplace the target text with the argument text. After replacement, the\ntarget range refers to the replacement text. Returns the length of the\nreplacement text.\n@param buffer The focused buffer.\n@param text The text (can contain NULs).\n@return number\n
-replace_target_re buffer.replace_target_re(buffer, text)\nReplace the target text with the argument text after \d processing. Looks for\n\d where d is between 1 and 9 and replaces these with the strings matched in\nthe last search operation which were surrounded by \( and \). Returns the\nlength of the replacement text including any change caused by processing\nthe \d patterns.\n@param buffer The focused buffer.\n@param text The text (can contain NULs).\n@return number\n
+replace_sel buffer.replace_sel(buffer, text)\nReplace the selected text with the argument text. The caret is positioned\nafter the inserted text and the caret is scrolled into view.\n@param buffer The global buffer.\n@param text The text.\n
+replace_target buffer.replace_target(buffer, text)\nReplace the target text with the argument text. After replacement, the\ntarget range refers to the replacement text. Returns the length of the\nreplacement text.\n@param buffer The global buffer.\n@param text The text (can contain NULs).\n@return number\n
+replace_target_re buffer.replace_target_re(buffer, text)\nReplace the target text with the argument text after \d processing. Looks for\n\d where d is between 1 and 9 and replaces these with the strings matched in\nthe last search operation which were surrounded by \( and \). Returns the\nlength of the replacement text including any change caused by processing\nthe \d patterns.\n@param buffer The global buffer.\n@param text The text (can contain NULs).\n@return number\n
require _G.require(modname)\nLoads the given module. The function starts by looking into the\n`package.loaded` table to determine whether `modname` is already\nloaded. If it is, then `require` returns the value stored at\n`package.loaded[modname]`. Otherwise, it tries to find a *loader* for the\nmodule. To find a loader, `require` is guided by the `package.loaders`\narray. By changing this array, we can change how `require` looks for a\nmodule. The following explanation is based on the default configuration for\n`package.loaders`. First `require` queries `package.preload[modname]`. If it\nhas a value, this value (which should be a function) is the loader. Otherwise\n`require` searches for a Lua loader using the path stored in `package.path`. If\nthat also fails, it searches for a C loader using the path stored in\n`package.cpath`. If that also fails, it tries an *all-in-one* loader (see\n`package.loaders`). Once a loader is found, `require` calls the loader with\na single argument, `modname`. If the loader returns any value, `require`\nassigns the returned value to `package.loaded[modname]`. If the loader returns\nno value and has not assigned any value to `package.loaded[modname]`, then\n`require` assigns true to this entry. In any case, `require` returns the\nfinal value of `package.loaded[modname]`. If there is any error loading or\nrunning the module, or if it cannot find any loader for the module, then\n`require` signals an error.\n
reset _G.reset()\nResets the Lua state by reloading all init scripts. Language-specific modules\nfor opened files are NOT reloaded. Re-opening the files that use them will\nreload those modules. This function is useful for modifying init scripts\n(such as keys.lua) on the fly without having to restart Textadept. A global\nRESETTING variable is set to true when re-initing the Lua State. Any scripts\nthat need to differentiate between startup and reset can utilize this variable.\n
resume coroutine.resume(co [, val1, ···])\nStarts or continues the execution of coroutine `co`. The first time you resume\na coroutine, it starts running its body. The values `val1`, ··· are passed\nas the arguments to the body function. If the coroutine has yielded, `resume`\nrestarts it; the values `val1`, ··· are passed as the results from the\nyield. If the coroutine runs without any errors, `resume` returns true plus\nany values passed to `yield` (if the coroutine yields) or any values returned\nby the body function (if the coroutine terminates). If there is any error,\n`resume` returns false plus the error message.\n
reverse string.reverse(s)\nReturns a string that is the string `s` reversed.\n
rgba_image_height buffer.rgba_image_height [number]\nThe height for future RGBA image data.\n
rgba_image_width buffer.rgba_image_width [number]\nThe width for future RGBA image data.\n
-rhtml _G.keys.rhtml [table]\nContainer for RHTML-specific key commands.\n
-rhtml _G.snippets.rhtml [table]\nContainer for RHTML-specific snippets.\n
-rhtml _m.rhtml [module]\nThe RHTML module. It provides utilities for editing RHTML. User tags are\nloaded from _USERHOME/modules/rhtml/tags and user apis are loaded from\n_USERHOME/modules/rhtml/api.\n
rmdir lfs.rmdir(dirname)\nRemoves an existing directory. The argument is the name of the\ndirectory. Returns true if the operation was successful; in case of error,\nit returns nil plus an error string.\n
-rotate_selection buffer.rotate_selection(buffer)\nSet the main selection to the next selection.\n@param buffer The focused buffer.\n
-ruby _G.keys.ruby [table]\nContainer for Ruby-specific key commands.\n
-ruby _G.snippets.ruby [table]\nContainer for Ruby-specific snippets.\n
-ruby _m.ruby [module]\nThe ruby module. It provides utilities for editing Ruby code. User tags\nare loaded from _USERHOME/modules/ruby/tags and user apis are loaded from\n_USERHOME/modules/ruby/api.\n
+rotate_selection buffer.rotate_selection(buffer)\nSet the main selection to the next selection.\n@param buffer The global buffer.\n
run _m.textadept.run [module]\nModule for running/executing source files. Typically, language-specific\nmodules populate the 'compile_command', 'run_command', and 'error_detail'\ntables for a particular language's file extension.\n
run _m.textadept.run.run()\nRuns/executes the file as specified by its extension in the run_command table.\n@see run_command\n
run_command _m.textadept.run.run_command [table]\nFile extensions and their associated 'go' actions. Each key is a file extension\nwhose value is either a command line string to execute or a function returning\none. This table is typically populated by language-specific modules.\n
running coroutine.running()\nReturns the running coroutine, or nil when called by the main thread.\n
save _m.textadept.session.save(filename)\nSaves a Textadept session to a file. Saves split views, opened buffers,\ncursor information, and project manager details.\n@param filename The absolute path to the session file to save. Defaults to\neither the current session file or DEFAULT_SESSION if not specified.\n@usage _m.textadept.session.save(filename)\n
-save buffer.save(buffer)\nSaves the current buffer to a file.\n@param buffer The focused buffer.\n
+save buffer.save(buffer)\nSaves the current buffer to a file.\n@param buffer The global buffer.\n
save_all io.save_all()\nSaves all dirty buffers to their respective files.\n@usage io.save_all()\n
-save_as buffer.save_as(buffer, utf8_filename)\nSaves the current buffer to a file different than its filename property.\n@param buffer The focused buffer.\n@param utf8_filename The new filepath to save the buffer to. Must be UTF-8\nencoded.\n
-scroll_caret buffer.scroll_caret(buffer)\nEnsure the caret is visible.\n@param buffer The focused buffer.\n
-scroll_to_end buffer.scroll_to_end(buffer)\nScroll to end of document.\n@param buffer The focused buffer.\n
-scroll_to_start buffer.scroll_to_start(buffer)\nScroll to start of document.\n@param buffer The focused buffer.\n
+save_as buffer.save_as(buffer, utf8_filename)\nSaves the current buffer to a file different than its filename property.\n@param buffer The global buffer.\n@param utf8_filename The new filepath to save the buffer to. Must be UTF-8\nencoded.\n
+scroll_caret buffer.scroll_caret(buffer)\nEnsure the caret is visible.\n@param buffer The global buffer.\n
+scroll_to_end buffer.scroll_to_end(buffer)\nScroll to end of document.\n@param buffer The global buffer.\n
+scroll_to_start buffer.scroll_to_start(buffer)\nScroll to start of document.\n@param buffer The global buffer.\n
scroll_width buffer.scroll_width [number]\nThe document width assumed for scrolling. For performance, the view does not\nmeasure the display width of the document to determine the properties of the\nhorizontal scroll bar. Instead, an assumed width is used. The default value\nis 2000. To ensure the width of the currently visible lines can be scrolled\nuse `buffer.scroll_width_tracking`.\n
scroll_width_tracking buffer.scroll_width_tracking [bool]\nWhether the maximum width line displayed is used to set scroll width.\n
-search_anchor buffer.search_anchor(buffer)\nSets the current caret position to be the search anchor. Always call this\nbefore calling either of `buffer:search_next()` or `buffer:search_prev()`.\n@param buffer The focused buffer.\n
+search_anchor buffer.search_anchor(buffer)\nSets the current caret position to be the search anchor. Always call this\nbefore calling either of `buffer:search_next()` or `buffer:search_prev()`.\n@param buffer The global buffer.\n
search_flags buffer.search_flags [number]\nThe search flags used by `buffer:search_in_target()`.\n * `_SCINTILLA.constants.SCFIND_WHOLEWORD` (2): A match only occurs with\n text that matches the case of the search string.\n * `_SCINTILLA.constants.SCFIND_MATCHCASE` (4): A match only occurs if\n the characters before and after are not word characters.\n * `_SCINTILLA.constants.SCFIND_WORDSTART` (0x00100000): A match only\n occurs if the character before is not a word character.\n * `_SCINTILLA.constants.SCFIND_REGEXP` (0x00200000): The search string\n should be interpreted as a regular expression.\n * `_SCINTILLA.constants.SCFIND_POSIX` (0x00400000): Treat regular\n expression in a more POSIX compatible manner by interpreting bare `(`\n and `)` for tagged sections rather than `\(` and `\)`.\n\n
-search_in_target buffer.search_in_target(buffer, text)\nSearch for a counted string in the target and set the target to the found\nrange. Returns length of range or -1 for failure in which case target is\nnot moved.\n@param buffer The focused buffer.\n@param text The text (can contain NULs).\n@return number\n
-search_next buffer.search_next(buffer, flags, text)\nFind some text starting at the search anchor. The return value is -1 if\nnothing is found, otherwise the return value is the start position of the\nmatching text. The selection is updated to show the matched text, but is\nnot scrolled into view.\n@param buffer The focused buffer.\n@param flags Search flags. See `buffer.search_flags`.\n@param text The text.\n@return number\n
-search_prev buffer.search_prev(buffer, flags, text)\nFind some text starting at the search anchor and moving backwards. The\nreturn value is -1 if nothing is found, otherwise the return value is the\nstart position of the matching text. The selection is updated to show the\nmatched text, but is not scrolled into view.\n@param buffer The focused buffer.\n@param flags Search flags. See `buffer.search_flags`.\n@param text The text.\n@return number\n
+search_in_target buffer.search_in_target(buffer, text)\nSearch for a counted string in the target and set the target to the found\nrange. Returns length of range or -1 for failure in which case target is\nnot moved.\n@param buffer The global buffer.\n@param text The text (can contain NULs).\n@return number\n
+search_next buffer.search_next(buffer, flags, text)\nFind some text starting at the search anchor. The return value is -1 if\nnothing is found, otherwise the return value is the start position of the\nmatching text. The selection is updated to show the matched text, but is\nnot scrolled into view.\n@param buffer The global buffer.\n@param flags Search flags. See `buffer.search_flags`.\n@param text The text.\n@return number\n
+search_prev buffer.search_prev(buffer, flags, text)\nFind some text starting at the search anchor and moving backwards. The\nreturn value is -1 if nothing is found, otherwise the return value is the\nstart position of the matching text. The selection is updated to show the\nmatched text, but is not scrolled into view.\n@param buffer The global buffer.\n@param flags Search flags. See `buffer.search_flags`.\n@param text The text.\n@return number\n
seeall package.seeall(module)\nSets a metatable for `module` with its `__index` field referring to the\nglobal environment, so that this module inherits values from the global\nenvironment. To be used as an option to function `module`.\n
seek file:seek([whence] [, offset])\nSets and gets the file position, measured from the beginning of the file,\nto the position given by `offset` plus a base specified by the string\n`whence`, as follows: "set": base is position 0 (beginning of the file);\n"cur": base is current position; "end": base is end of file; In case of\nsuccess, function `seek` returns the final file position, measured in bytes\nfrom the beginning of the file. If this function fails, it returns nil, plus\na string describing the error. The default value for `whence` is `"cur"`, and\nfor `offset` is 0. Therefore, the call `file:seek()` returns the current file\nposition, without changing it; the call `file:seek("set")` sets the position\nto the beginning of the file (and returns 0); and the call `file:seek("end")`\nsets the position to the end of the file, and returns its size.\n
sel_alpha buffer.sel_alpha [number]\nThe alpha of the selection, between 0 (transparent) and 255 (opaque), or\n256 for no alpha.\n
sel_eol_filled buffer.sel_eol_filled [bool]\nThe selection end of line fill. The selection can be drawn up to the right\nhand border by setting this property.\n
select _G.select(index, ···)\nIf `index` is a number, returns all arguments after argument number\n`index`. Otherwise, `index` must be the string `"#"`, and `select` returns\nthe total number of extra arguments it received.\n
-select_all buffer.select_all(buffer)\nSelect all the text in the document. The current position is not scrolled\ninto view.\n@param buffer The focused buffer.\n
+select_all buffer.select_all(buffer)\nSelect all the text in the document. The current position is not scrolled\ninto view.\n@param buffer The global buffer.\n
select_command _m.textadept.menu.select_command()\nPrompts the user with a filteredlist to run menu commands.\n
select_enclosed _m.textadept.editing.select_enclosed(left, right)\nSelects text between a given pair of strings.\n@param left The left part of the enclosure.\n@param right The right part of the enclosure.\n
select_indented_block _m.textadept.editing.select_indented_block()\nSelects indented blocks intelligently. If no block of text is selected, all\ntext with the current level of indentation is selected. If a block of text is\nselected and the lines to the top and bottom of it are one indentation level\nlower, they are added to the selection. In all other cases, the behavior is\nthe same as if no text is selected.\n
@@ -1376,7 +1349,7 @@ select_lexer _m.textadept.mime_types.select_lexer()\nPrompts the user to select
select_line _m.textadept.editing.select_line()\nSelects the current line.\n
select_paragraph _m.textadept.editing.select_paragraph()\nSelects the current paragraph. Paragraphs are delimited by two or more\nconsecutive newlines.\n
select_style _m.textadept.editing.select_style()\nSelects all text with the same style as under the caret.\n
-selection_duplicate buffer.selection_duplicate(buffer)\nDuplicate the selection. If selection empty duplicate the line containing\nthe caret.\n@param buffer The focused buffer.\n
+selection_duplicate buffer.selection_duplicate(buffer)\nDuplicate the selection. If selection empty duplicate the line containing\nthe caret.\n@param buffer The global buffer.\n
selection_end buffer.selection_end [number]\nThe position that ends the selection - this becomes the current position. This\ndoes not make the caret visible.\n
selection_is_rectangle buffer.selection_is_rectangle [bool]\nIs the selection rectangular? The alternative is the more common stream\nselection. (Read-only)\n
selection_mode buffer.selection_mode [number]\nThe mode of the current selection.\n * `_SCINTILLA.constants.SC_SEL_STREAM` (0): Stream.\n * `_SCINTILLA.constants.SC_SEL_RECTANGLE` (1): Rectangle.\n * `_SCINTILLA.constants.SC_SEL_LINES` (2): Lines.\n * `_SCINTILLA.constants.SC_SEL_THIN` (3): Thin rectangular.\n\n
@@ -1390,47 +1363,35 @@ selection_start buffer.selection_start [number]\nThe position that starts the se
selections buffer.selections [number]\nThe number of selections currently active. (Read-only)\n
self _m.textadept.adeptsense.syntax.self\nThe language's syntax-equivalent of 'self'. Default is 'self'.\n
sense _m.cpp.sense\nThe C/C++ Adeptsense.\n
-sense _m.css.sense\nThe CSS Adeptsense.\n
-sense _m.hypertext.sense\nThe HTML Adeptsense.\n
-sense _m.java.sense\nThe Java Adeptsense.\n
sense _m.lua.sense\nThe Lua Adeptsense.\n
-sense _m.php.sense\nThe PHP Adeptsense.\n
-sense _m.rails.sense\nThe Rails Adeptsense.\n
-sense _m.rhtml.sense\nThe RHTML Adeptsense.\n
-sense _m.ruby.sense\nThe Ruby Adeptsense.\n
session _m.textadept.session [module]\nSession support for the textadept module.\n
set_buffer_properties _m.cpp.set_buffer_properties()\nSets default buffer properties for C/C++ files.\n
-set_buffer_properties _m.css.set_buffer_properties()\nSets default buffer properties for CSS files.\n
-set_buffer_properties _m.hypertext.set_buffer_properties()\nSets default buffer properties for HTML files.\n
-set_buffer_properties _m.java.set_buffer_properties()\nSets default buffer properties for Java files.\n
set_buffer_properties _m.lua.set_buffer_properties()\nSets default buffer properties for Lua files.\n
-set_buffer_properties _m.php.set_buffer_properties()\nSets default buffer properties for PHP files.\n
-set_buffer_properties _m.ruby.set_buffer_properties()\nSets default buffer properties for Ruby files.\n
-set_chars_default buffer.set_chars_default(buffer)\nReset the set of characters for whitespace and word characters to the\ndefaults. This sets whitespace to space, tab and other characters with codes\nless than 0x20, with word characters set to alphanumeric and '_'.\n@param buffer The focused buffer.\n
+set_chars_default buffer.set_chars_default(buffer)\nReset the set of characters for whitespace and word characters to the\ndefaults. This sets whitespace to space, tab and other characters with codes\nless than 0x20, with word characters set to alphanumeric and '_'.\n@param buffer The global buffer.\n
set_contextmenu _m.textadept.menu.set_contextmenu(menu_table)\nSets gui.context_menu from the given menu table.\n@param menu_table The menu table to create the context menu from. Each table\nentry is either a submenu or menu text and a function or action table.\n@see set_menubar\n
set_empty_selection buffer.set_empty_selection(buffer, pos)\nSet caret to a position, while removing any existing selection. The caret\nis not scrolled into view.\n@param buffer The buffer\n@param pos The position to move to.\n
-set_encoding buffer.set_encoding(buffer, encoding)\nSets the encoding for the buffer, converting its contents in the process.\n@param buffer The focused buffer.\n@param encoding The encoding to set. Valid encodings are ones that GTK's\ng_convert() function accepts (typically GNU iconv's encodings).\n@usage buffer.set_encoding(buffer, 'ASCII')\n
-set_fold_flags buffer.set_fold_flags(buffer, flags)\nSet some style options for folding.\n@param buffer The focused buffer.\n@param flags Mask of fold flags. Flags available are\n`_SCINTILLA.constants.SC_FOLDFLAG_LINEBEFORE_EXPANDED` (2): Draw above if\nexpanded; `_SCINTILLA.constants.SC_FOLDFLAG_LINEBEFORE_CONTRACTED`\n(4): Draw above if not expanded;\n`_SCINTILLA.constants.SC_FOLDFLAG_LINEAFTER_EXPANDED` (8): Draw below if\nexpanded; `_SCINTILLA.constants.SC_FOLDFLAG_LINEAFTER_CONTRACTED` (16):\nDraw below if not expanded\n
-set_fold_margin_colour buffer.set_fold_margin_colour(buffer, use_setting, color)\nSet the colors used as a chequerboard pattern in the fold margin.\n@param buffer The focused buffer.\n@param use_setting Enable color change.\n@param color A color in 0xBBGGRR format.\n
-set_fold_margin_hi_colour buffer.set_fold_margin_hi_colour(buffer, use_setting, color)\nSet the colors used as a chequerboard pattern in the fold margin.\n@param buffer The focused buffer.\n@param use_setting Enable color change.\n@param color A color in 0xBBGGRR format.\n
-set_hotspot_active_back buffer.set_hotspot_active_back(buffer, use_setting, color)\nSet a back color for active hotspots.\n@param buffer The focused buffer.\n@param use_setting Enable the color change.\n@param color A color in 0xBBGGRR format.\n
-set_hotspot_active_fore buffer.set_hotspot_active_fore(buffer, use_setting, color)\nSet a fore color for active hotspots.\n@param buffer The focused buffer.\n@param use_setting Enable the color change.\n@param color A color in 0xBBGGRR format.\n
-set_length_for_encode buffer.set_length_for_encode(buffer, bytes)\nSet the length of the utf8 argument for calling `buffer:encoded_from_utf8()`.\n@param buffer The focused buffer.\n@param bytes Bytes or -1 for measuring to first nul.\n
-set_lexer buffer.set_lexer(buffer, lang)\nReplacement for buffer.set_lexer_language(buffer). Sets a buffer._lexer field\nso it can be restored without querying the mime-types tables. Also if the user\nmanually sets the lexer, it should be restored. Loads the language-specific\nmodule if it exists.\n@param buffer The focused buffer.\n@param lang The string language to set.\n@usage buffer.set_lexer(buffer, 'language_name')\n
-set_lexer_language buffer.set_lexer_language(buffer, language_name)\nSet the lexing language of the document based on string name.\n@param buffer The focused buffer.\n@param language_name The language name.\n
+set_encoding buffer.set_encoding(buffer, encoding)\nSets the encoding for the buffer, converting its contents in the process.\n@param buffer The global buffer.\n@param encoding The encoding to set. Valid encodings are ones that GTK's\ng_convert() function accepts (typically GNU iconv's encodings).\n@usage buffer.set_encoding(buffer, 'ASCII')\n
+set_fold_flags buffer.set_fold_flags(buffer, flags)\nSet some style options for folding.\n@param buffer The global buffer.\n@param flags Mask of fold flags. Flags available are\n`_SCINTILLA.constants.SC_FOLDFLAG_LINEBEFORE_EXPANDED` (2): Draw above if\nexpanded; `_SCINTILLA.constants.SC_FOLDFLAG_LINEBEFORE_CONTRACTED`\n(4): Draw above if not expanded;\n`_SCINTILLA.constants.SC_FOLDFLAG_LINEAFTER_EXPANDED` (8): Draw below if\nexpanded; `_SCINTILLA.constants.SC_FOLDFLAG_LINEAFTER_CONTRACTED` (16):\nDraw below if not expanded\n
+set_fold_margin_colour buffer.set_fold_margin_colour(buffer, use_setting, color)\nSet the colors used as a chequerboard pattern in the fold margin.\n@param buffer The global buffer.\n@param use_setting Enable color change.\n@param color A color in 0xBBGGRR format.\n
+set_fold_margin_hi_colour buffer.set_fold_margin_hi_colour(buffer, use_setting, color)\nSet the colors used as a chequerboard pattern in the fold margin.\n@param buffer The global buffer.\n@param use_setting Enable color change.\n@param color A color in 0xBBGGRR format.\n
+set_hotspot_active_back buffer.set_hotspot_active_back(buffer, use_setting, color)\nSet a back color for active hotspots.\n@param buffer The global buffer.\n@param use_setting Enable the color change.\n@param color A color in 0xBBGGRR format.\n
+set_hotspot_active_fore buffer.set_hotspot_active_fore(buffer, use_setting, color)\nSet a fore color for active hotspots.\n@param buffer The global buffer.\n@param use_setting Enable the color change.\n@param color A color in 0xBBGGRR format.\n
+set_length_for_encode buffer.set_length_for_encode(buffer, bytes)\nSet the length of the utf8 argument for calling `buffer:encoded_from_utf8()`.\n@param buffer The global buffer.\n@param bytes Bytes or -1 for measuring to first nul.\n
+set_lexer buffer.set_lexer(buffer, lang)\nReplacement for buffer.set_lexer_language(buffer). Sets a buffer._lexer field\nso it can be restored without querying the mime-types tables. Also if the user\nmanually sets the lexer, it should be restored. Loads the language-specific\nmodule if it exists.\n@param buffer The global buffer.\n@param lang The string language to set.\n@usage buffer.set_lexer(buffer, 'language_name')\n
+set_lexer_language buffer.set_lexer_language(buffer, language_name)\nSet the lexing language of the document based on string name.\n@param buffer The global buffer.\n@param language_name The language name.\n
set_menubar _m.textadept.menu.set_menubar(menubar)\nSets gui.menubar from the given table of menus.\n@param menubar The table of menus to create the menubar from. Each table\nentry is another table that corresponds to a particular menu. A menu can\nhave a 'title' key with string value. Each menu item is either a submenu\n(another menu table) or a table consisting of two items: string menu text\nand a function or action table just like in `keys`. The table can optionally\ncontain 2 more number values: a GDK keycode and modifier mask for setting\na menu accelerator. If the menu text is 'separator', a menu separator is\ncreated and no action table is required.\n@see keys.get_gdk_key\n
-set_save_point buffer.set_save_point(buffer)\nRemember the current position in the undo history as the position at which\nthe document was saved.\n@param buffer The focused buffer.\n
-set_sel buffer.set_sel(buffer, start_pos, end_pos)\nSelect a range of text. The caret is scrolled into view after this operation.\n@param buffer The focused buffer.\n@param start_pos Start position. If negative, it means the end of the document.\n@param end_pos End position. If negative, it means remove any selection\n(i.e. set the anchor to the same position as current_pos).\n
-set_sel_back buffer.set_sel_back(buffer, use_setting, color)\nSet the background color of the main and additional selections and whether\nto use this setting.\n@param buffer The focused buffer.\n@param use_setting Enable color change.\n@param color A color in 0xBBGGRR format.\n
-set_sel_fore buffer.set_sel_fore(buffer, use_setting, color)\nSet the foreground color of the main and additional selections and whether\nto use this setting.\n@param buffer The focused buffer.\n@param use_setting Enable color change.\n@param color A color in 0xBBGGRR format.\n
-set_selection buffer.set_selection(buffer, caret, anchor)\nSet a simple selection from anchor to caret.\n@param buffer The focused buffer.\n@param caret The caret.\n@param anchor The anchor.\n
-set_styling buffer.set_styling(buffer, length, style)\nChange style from current styling position for length characters to a style\nand move the current styling position to after this newly styled segment.\n@param buffer The focused buffer.\n@param length The length to style.\n@param style The style number to set.\n
-set_text buffer.set_text(buffer, text)\nReplace the contents of the document with the argument text.\n@param buffer The focused buffer.\n@param text The text.\n
-set_visible_policy buffer.set_visible_policy(buffer, visible_policy, visible_slop)\nSet the way the display area is determined when a particular line is to\nbe moved to by `buffer:goto_line()`, etc. It is similar in operation to\n`buffer:set_y_caret_policy()`.\n@param buffer The focused buffer.\n@param visible_policy A combination of `_SCINTILLA.constants.VISIBLE_SLOP`,\n(0x01) and `_SCINTILLA.constants.VISIBLE_STRICT` (0x04).\n@param visible_slop The slop value.\n
-set_whitespace_back buffer.set_whitespace_back(buffer, use_setting, color)\nSet the background color of all whitespace and whether to use this setting.\n@param buffer The focused buffer.\n@param use_setting Enable color change.\n@param color A color in 0xBBGGRR format.\n
-set_whitespace_fore buffer.set_whitespace_fore(buffer, use_setting, color)\nSet the foreground color of all whitespace and whether to use this setting.\n@param buffer The focused buffer.\n@param use_setting Enable color change.\n@param color A color in 0xBBGGRR format.\n
-set_x_caret_policy buffer.set_x_caret_policy(buffer, caret_policy, caret_slop)\nSet the way the caret is kept visible when going sideway. The exclusion zone\nis given in pixels.\n@param buffer The focused buffer.\n@param caret_policy A combination of `_SCINTILLA.constants.CARET_SLOP` (0x01),\n`_SCINTILLA.constants.CARET_STRICT` (0x04), `_SCINTILLA.constants.CARET_JUMPS`\n(0x10), and `_SCINTILLA.constants.CARET_EVEN` (0x08).\n@param caret_slop A slop value.\n
-set_y_caret_policy buffer.set_y_caret_policy(buffer, caret_policy, caret_slop)\nSet the way the line the caret is on is kept visible.\n@param buffer The focused buffer.\n@param caret_policy A combination of `_SCINTILLA.constants.CARET_SLOP` (0x01),\n`_SCINTILLA.constants.CARET_STRICT` (0x04), `_SCINTILLA.constants.CARET_JUMPS`\n(0x10), and `_SCINTILLA.constants.CARET_EVEN` (0x08).\n@param caret_slop A slop value.\n
+set_save_point buffer.set_save_point(buffer)\nRemember the current position in the undo history as the position at which\nthe document was saved.\n@param buffer The global buffer.\n
+set_sel buffer.set_sel(buffer, start_pos, end_pos)\nSelect a range of text. The caret is scrolled into view after this operation.\n@param buffer The global buffer.\n@param start_pos Start position. If negative, it means the end of the document.\n@param end_pos End position. If negative, it means remove any selection\n(i.e. set the anchor to the same position as current_pos).\n
+set_sel_back buffer.set_sel_back(buffer, use_setting, color)\nSet the background color of the main and additional selections and whether\nto use this setting.\n@param buffer The global buffer.\n@param use_setting Enable color change.\n@param color A color in 0xBBGGRR format.\n
+set_sel_fore buffer.set_sel_fore(buffer, use_setting, color)\nSet the foreground color of the main and additional selections and whether\nto use this setting.\n@param buffer The global buffer.\n@param use_setting Enable color change.\n@param color A color in 0xBBGGRR format.\n
+set_selection buffer.set_selection(buffer, caret, anchor)\nSet a simple selection from anchor to caret.\n@param buffer The global buffer.\n@param caret The caret.\n@param anchor The anchor.\n
+set_styling buffer.set_styling(buffer, length, style)\nChange style from current styling position for length characters to a style\nand move the current styling position to after this newly styled segment.\n@param buffer The global buffer.\n@param length The length to style.\n@param style The style number to set.\n
+set_text buffer.set_text(buffer, text)\nReplace the contents of the document with the argument text.\n@param buffer The global buffer.\n@param text The text.\n
+set_visible_policy buffer.set_visible_policy(buffer, visible_policy, visible_slop)\nSet the way the display area is determined when a particular line is to\nbe moved to by `buffer:goto_line()`, etc. It is similar in operation to\n`buffer:set_y_caret_policy()`.\n@param buffer The global buffer.\n@param visible_policy A combination of `_SCINTILLA.constants.VISIBLE_SLOP`,\n(0x01) and `_SCINTILLA.constants.VISIBLE_STRICT` (0x04).\n@param visible_slop The slop value.\n
+set_whitespace_back buffer.set_whitespace_back(buffer, use_setting, color)\nSet the background color of all whitespace and whether to use this setting.\n@param buffer The global buffer.\n@param use_setting Enable color change.\n@param color A color in 0xBBGGRR format.\n
+set_whitespace_fore buffer.set_whitespace_fore(buffer, use_setting, color)\nSet the foreground color of all whitespace and whether to use this setting.\n@param buffer The global buffer.\n@param use_setting Enable color change.\n@param color A color in 0xBBGGRR format.\n
+set_x_caret_policy buffer.set_x_caret_policy(buffer, caret_policy, caret_slop)\nSet the way the caret is kept visible when going sideway. The exclusion zone\nis given in pixels.\n@param buffer The global buffer.\n@param caret_policy A combination of `_SCINTILLA.constants.CARET_SLOP` (0x01),\n`_SCINTILLA.constants.CARET_STRICT` (0x04), `_SCINTILLA.constants.CARET_JUMPS`\n(0x10), and `_SCINTILLA.constants.CARET_EVEN` (0x08).\n@param caret_slop A slop value.\n
+set_y_caret_policy buffer.set_y_caret_policy(buffer, caret_policy, caret_slop)\nSet the way the line the caret is on is kept visible.\n@param buffer The global buffer.\n@param caret_policy A combination of `_SCINTILLA.constants.CARET_SLOP` (0x01),\n`_SCINTILLA.constants.CARET_STRICT` (0x04), `_SCINTILLA.constants.CARET_JUMPS`\n(0x10), and `_SCINTILLA.constants.CARET_EVEN` (0x08).\n@param caret_slop A slop value.\n
setfenv _G.setfenv(f, table)\nSets the environment to be used by the given function. `f` can be a Lua\nfunction or a number that specifies the function at that stack level: Level 1\nis the function calling `setfenv`. `setfenv` returns the given function. As a\nspecial case, when `f` is 0 `setfenv` changes the environment of the running\nthread. In this case, `setfenv` returns no values.\n
setfenv debug.setfenv(object, table)\nSets the environment of the given `object` to the given `table`. Returns\n`object`.\n
sethook debug.sethook([thread, ] hook, mask [, count])\nSets the given function as a hook. The string `mask` and the number `count`\ndescribe when the hook will be called. The string mask may have the following\ncharacters, with the given meaning: `"c"`: the hook is called every time\nLua calls a function; `"r"`: the hook is called every time Lua returns from\na function; `"l"`: the hook is called every time Lua enters a new line of\ncode. With a `count` different from zero, the hook is called after every\n`count` instructions. When called without arguments, `debug.sethook` turns\noff the hook. When the hook is called, its first parameter is a string\ndescribing the event that has triggered its call: `"call"`, `"return"`\n(or `"tail return"`, when simulating a return from a tail call), `"line"`,\nand `"count"`. For line events, the hook also gets the new line number as\nits second parameter. Inside a hook, you can call `getinfo` with level 2 to\nget more information about the running function (level 0 is the `getinfo`\nfunction, and level 1 is the hook function), unless the event is `"tail\nreturn"`. In this case, Lua is only simulating the return, and a call to\n`getinfo` will return invalid data.\n
@@ -1445,9 +1406,8 @@ setvbuf file:setvbuf(mode [, size])\nSets the buffering mode for an output file.
shebangs _m.textadept.mime_types.shebangs [table]\nShebang words and their associated lexers.\n
show_apidoc _m.textadept.adeptsense.show_apidoc(sense)\nShows a calltip with API documentation for the symbol behind the caret.\n@param sense The adeptsense returned by adeptsense.new().\n@return true on success or false.\n@see get_symbol\n@see get_apidoc\n
show_documentation _m.textadept.adeptsense.show_documentation()\nShows API documentation for the symbol at the current position based on the\ncurrent lexer's Adeptsense. This should be called by key commands and menus\ninstead of `show_apidoc`.\n
-show_lines buffer.show_lines(buffer, start_line, end_line)\nMake a range of lines visible. This has no effect on fold levels or fold\nflags. start_line can not be hidden.\n@param buffer The focused buffer.\n@param start_line The start line.\n@param end_line The end line.\n
+show_lines buffer.show_lines(buffer, start_line, end_line)\nMake a range of lines visible. This has no effect on fold levels or fold\nflags. start_line can not be hidden.\n@param buffer The global buffer.\n@param start_line The start line.\n@param end_line The end line.\n
sin math.sin(x)\nReturns the sine of `x` (assumed to be in radians).\n
-singular _m.rails.singular\nA map of plural controller names to their singulars. Add key-value pairs to\nthis if singularize() is incorrectly converting your plural controller name\nto its singular model name.\n
sinh math.sinh(x)\nReturns the hyperbolic sine of `x`.\n
size gui.size [table]\nThe size of the Textadept window (`{ width, height }`).\n
size view.size [number]\nThe position of the split resizer (if this view is part of a split view).\n
@@ -1456,10 +1416,10 @@ snippets _G.snippets [table]\nProvides access to snippets from _G.\n
snippets _m.textadept.snippets [module]\nProvides Lua-style snippets for Textadept.\n
sort table.sort(table [, comp])\nSorts table elements in a given order, *in-place*, from `table[1]` to\n`table[n]`, where `n` is the length of the table. If `comp` is given, then it\nmust be a function that receives two table elements, and returns true when the\nfirst is less than the second (so that `not comp(a[i+1],a[i])` will be true\nafter the sort). If `comp` is not given, then the standard Lua operator `<`\nis used instead. The sort algorithm is not stable; that is, elements considered\nequal by the given order may have their relative positions changed by the sort.\n
space lexer.space\nMatches any whitespace character (`\t`, `\v`, `\f`, `\\n`, `\r`, space).\n
-split view:split(vertical)\nSplits the indexed view vertically or horizontally and focuses the new view.\n@param vertical Flag indicating a vertical split. False for horizontal.\n@return old view and new view tables.\n
+split view:split(vertical)\nSplits the indexed view vertically or horizontally and focuses the new view.\n@param vertical Flag indicating a vertical split. Defaults to false for\nhorizontal.\n@return old view and new view tables.\n
sqrt math.sqrt(x)\nReturns the square root of `x`. (You can also use the expression `x^0.5`\nto compute this value.)\n
-start_record buffer.start_record(buffer)\nStart notifying the container of all key presses and commands.\n@param buffer The focused buffer.\n
-start_styling buffer.start_styling(buffer, position, mask)\nSet the current styling position to pos and the styling mask to mask. The\nstyling mask can be used to protect some bits in each styling byte from\nmodification.\n@param buffer The focused buffer.\n@param position The styling position.\n@param mask The bit mask of the style bytes that can be set.\n
+start_record buffer.start_record(buffer)\nStart notifying the container of all key presses and commands.\n@param buffer The global buffer.\n
+start_styling buffer.start_styling(buffer, position, mask)\nSet the current styling position to pos and the styling mask to mask. The\nstyling mask can be used to protect some bits in each styling byte from\nmodification.\n@param buffer The global buffer.\n@param position The styling position.\n@param mask The bit mask of the style bytes that can be set.\n
starts_line lexer.starts_line(patt)\nCreates an LPeg pattern from a given pattern that matches the beginning of\na line and returns it.\n@param patt The LPeg pattern to match at the beginning of a line.\n@usage local preproc = token(l.PREPROCESSOR, #P('#') * l.starts_line('#'\n* l.nonnewline^0))\n
status buffer.status [number]\nThe error status.\n * `_SCINTILLA.constants.SC_STATUS_OK` (0): No failures.\n * `_SCINTILLA.constants.SC_STATUS_FAILURE` (1): Generic failure.\n * `_SCINTILLA.constants.SC_STATUS_BADALLOC` (2): Memory is exhausted.\n\n
status coroutine.status(co)\nReturns the status of coroutine `co`, as a string: `"running"`, if the\ncoroutine is running (that is, it called `status`); `"suspended"`, if the\ncoroutine is suspended in a call to `yield`, or if it has not started running\nyet; `"normal"` if the coroutine is active but not running (that is, it has\nresumed another coroutine); and `"dead"` if the coroutine has finished its\nbody function, or if it has stopped with an error.\n
@@ -1467,12 +1427,12 @@ statusbar_text gui.statusbar_text [string]\nThe text displayed by the statusbar.
stderr io.stderr\nStandard error.\n
stdin io.stdin\nStandard in.\n
stdout io.stdout\nStandard out.\n
-stop_record buffer.stop_record(buffer)\nStop notifying the container of all key presses and commands.\n@param buffer The focused buffer.\n
+stop_record buffer.stop_record(buffer)\nStop notifying the container of all key presses and commands.\n@param buffer The global buffer.\n
string _G.string [module]\nLua string module.\n
-stuttered_page_down buffer.stuttered_page_down(buffer)\nMove caret to bottom of page, or one page down if already at bottom of page.\n@param buffer The focused buffer.\n
-stuttered_page_down_extend buffer.stuttered_page_down_extend(buffer)\nMove caret to bottom of page, or one page down if already at bottom of page,\nextending selection to new caret position.\n@param buffer The focused buffer.\n
-stuttered_page_up buffer.stuttered_page_up(buffer)\nMove caret to top of page, or one page up if already at top of page.\n@param buffer The focused buffer.\n
-stuttered_page_up_extend buffer.stuttered_page_up_extend(buffer)\nMove caret to top of page, or one page up if already at top of page, extending\nselection to new caret position.\n@param buffer The focused buffer.\n
+stuttered_page_down buffer.stuttered_page_down(buffer)\nMove caret to bottom of page, or one page down if already at bottom of page.\n@param buffer The global buffer.\n
+stuttered_page_down_extend buffer.stuttered_page_down_extend(buffer)\nMove caret to bottom of page, or one page down if already at bottom of page,\nextending selection to new caret position.\n@param buffer The global buffer.\n
+stuttered_page_up buffer.stuttered_page_up(buffer)\nMove caret to top of page, or one page up if already at top of page.\n@param buffer The global buffer.\n
+stuttered_page_up_extend buffer.stuttered_page_up_extend(buffer)\nMove caret to top of page, or one page up if already at top of page, extending\nselection to new caret position.\n@param buffer The global buffer.\n
style lexer.style(style_table)\nCreates a Scintilla style from a table of style properties.\n@param style_table A table of style properties. Style properties available:\nfont = [string] size = [integer] bold = [boolean]\nitalic = [boolean] underline = [boolean] fore = [integer]*\nback = [integer]* eolfilled = [boolean] characterset = ? case\n= [integer] visible = [boolean] changeable = [boolean] hotspot =\n[boolean] * Use the value returned by `color()`.\n@usage local bold_italic = style { bold = true, italic = true }\n@see color\n
style_at buffer.style_at [table]\nTable of style bytes at positions in the document starting at zero. (Read-only)\n
style_back buffer.style_back [table]\nTable of background colors in 0xBBGGRR format for styles from zero to 255.\n
@@ -1484,7 +1444,7 @@ style_changeable buffer.style_changeable [table]\nTable of booleans for changeab
style_char lexer.style_char\nTypically used for character literals.\n
style_character_set buffer.style_character_set [table]\nTable of character sets for styles from zero to 255.\n
style_class lexer.style_class\nTypically used for class definitions.\n
-style_clear_all buffer.style_clear_all(buffer)\nClear all the styles and make equivalent to the global default style.\n@param buffer The focused buffer.\n
+style_clear_all buffer.style_clear_all(buffer)\nClear all the styles and make equivalent to the global default style.\n@param buffer The global buffer.\n
style_comment lexer.style_comment\nTypically used for code comments.\n
style_constant lexer.style_constant\nTypically used for constants.\n
style_definition lexer.style_definition\nTypically used for definitions.\n
@@ -1494,7 +1454,7 @@ style_error lexer.style_error\nTypically used for erroneous syntax.\n
style_font buffer.style_font [table]\nTable of font faces for styles from zero to 255.\n
style_fore buffer.style_fore [table]\nTable of foreground colors in 0xBBGGRR format for styles from zero to 255.\n
style_function lexer.style_function\nTypically used for function definitions.\n
-style_get_font buffer.style_get_font(buffer, style_num)\nReturns the font name of a given style.\n@param buffer The focused buffer.\n@param style_num The style number.\n@return string\n
+style_get_font buffer.style_get_font(buffer, style_num)\nReturns the font name of a given style.\n@param buffer The global buffer.\n@param style_num The style number.\n@return string\n
style_hot_spot buffer.style_hot_spot [table]\nTable of boolean hotspot styles from zero to 255.\n
style_identifier lexer.style_identifier\nTypically used for identifier words.\n
style_italic buffer.style_italic [table]\nTable of booleans for italic styles from zero to 255.\n
@@ -1503,7 +1463,7 @@ style_nothing lexer.style_nothing\nTypically used for whitespace.\n
style_number lexer.style_number\nTypically used for numbers.\n
style_operator lexer.style_operator\nTypically used for operators.\n
style_preproc lexer.style_preproc\nTypically used for preprocessor statements.\n
-style_reset_default buffer.style_reset_default(buffer)\nReset the default style to its state at startup.\n@param buffer The focused buffer.\n
+style_reset_default buffer.style_reset_default(buffer)\nReset the default style to its state at startup.\n@param buffer The global buffer.\n
style_size buffer.style_size [table]\nTable of font sizes for styles from zero to 255.\n
style_string lexer.style_string\nTypically used for strings.\n
style_tag lexer.style_tag\nTypically used for markup tags.\n
@@ -1512,26 +1472,26 @@ style_underline buffer.style_underline [table]\nTable of booleans for underlined
style_variable lexer.style_variable\nTypically used for variables.\n
style_visible buffer.style_visible [table]\nTable of booleans for visible styles from zero to 255.\n
sub string.sub(s, i [, j])\nReturns the substring of `s` that starts at `i` and continues until `j`;\n`i` and `j` can be negative. If `j` is absent, then it is assumed to\nbe equal to -1 (which is the same as the string length). In particular,\nthe call `string.sub(s,1,j)` returns a prefix of `s` with length `j`, and\n`string.sub(s, -i)` returns a suffix of `s` with length `i`.\n
-swap_main_anchor_caret buffer.swap_main_anchor_caret(buffer)\nSwap that caret and anchor of the main selection.\n@param buffer The focused buffer.\n
+swap_main_anchor_caret buffer.swap_main_anchor_caret(buffer)\nSwap that caret and anchor of the main selection.\n@param buffer The global buffer.\n
switch_buffer gui.switch_buffer()\nDisplays a dialog with a list of buffers to switch to and switches to the\nselected one, if any.\n
symbol_chars _m.textadept.adeptsense.syntax.symbol_chars\nA Lua pattern of characters allowed in a symbol, including member\noperators. The pattern should be a character set. Default is '[%w_%.]'.\n
symlinkattributes lfs.symlinkattributes(filepath [, aname])\nIdentical to lfs.attributes except that it obtains information about the link\nitself (not the file it refers to). This function is not available in Windows\nso you may want to make sure that lfs.symlinkattributes exists before using it.\n
syntax _m.textadept.adeptsense.syntax [table]\nContains syntax-specific values for the language.\n@see get_class\n
-tab buffer.tab(buffer)\nIf selection is empty or all on one line replace the selection with a tab\ncharacter, or if more than one line selected, indent the lines.\n@param buffer The focused buffer.\n
+tab buffer.tab(buffer)\nIf selection is empty or all on one line replace the selection with a tab\ncharacter, or if more than one line selected, indent the lines.\n@param buffer The global buffer.\n
tab_indents buffer.tab_indents [bool]\nWhether a tab pressed when caret is within indentation indents.\n
tab_width buffer.tab_width [number]\nThe visible size of a tab as a multiple of the width of a space character. The\ndefault tab width is 8 characters.\n
table _G.table [module]\nLua table module.\n
tan math.tan(x)\nReturns the tangent of `x` (assumed to be in radians).\n
tanh math.tanh(x)\nReturns the hyperbolic tangent of `x`.\n
-target_as_utf8 buffer.target_as_utf8(buffer)\nReturns the target converted to UTF8.\n@param buffer The focused buffer.\n
+target_as_utf8 buffer.target_as_utf8(buffer)\nReturns the target converted to UTF8.\n@param buffer The global buffer.\n
target_end buffer.target_end [number]\nThe position that ends the target which is used for updating the document\nwithout affecting the scroll position. The target is also set by a successful\n`buffer:search_in_target()`.\n
-target_from_selection buffer.target_from_selection(buffer)\nMake the target range start and end be the same as the selection range start\nand end.\n@param buffer The focused buffer.\n
+target_from_selection buffer.target_from_selection(buffer)\nMake the target range start and end be the same as the selection range start\nand end.\n@param buffer The global buffer.\n
target_start buffer.target_start [number]\nThe position that starts the target which is used for updating the document\nwithout affecting the scroll position. The target is also set by a successful\n`buffer:search_in_target()`.\n
teal lexer.colors.teal\nTeal.\n
-text_height buffer.text_height(buffer, line)\nRetrieve the height of a particular line of text in pixels.\n@param buffer The focused buffer.\n@param line The line number.\n@return number\n
+text_height buffer.text_height(buffer, line)\nRetrieve the height of a particular line of text in pixels.\n@param buffer The global buffer.\n@param line The line number.\n@return number\n
text_length buffer.text_length [number]\nThe number of characters in the document. (Read-only)\n
-text_range buffer.text_range(buffer, start_pos, end_pos)\nGets a range of text from the current buffer.\n@param buffer The currently focused buffer.\n@param start_pos The beginning position of the range of text to get.\n@param end_pos The end position of the range of text to get.\n
-text_width buffer.text_width(buffer, style_num, text)\nMeasure the pixel width of some text in a particular style. Does not handle\ntab or control characters.\n@param buffer The focused buffer.\n@param style_num The style number.\n@param text The text.\n@return number\n
+text_range buffer.text_range(buffer, start_pos, end_pos)\nGets a range of text from the current buffer.\n@param buffer The global buffer.\n@param start_pos The beginning position of the range of text to get.\n@param end_pos The end position of the range of text to get.\n
+text_width buffer.text_width(buffer, style_num, text)\nMeasure the pixel width of some text in a particular style. Does not handle\ntab or control characters.\n@param buffer The global buffer.\n@param style_num The style number.\n@param text The text.\n@return number\n
textadept _m.textadept [module]\nThe textadept module. It provides utilities for editing text in Textadept.\n
time os.time([table])\nReturns the current time when called without arguments, or a time representing\nthe date and time specified by the given table. This table must have fields\n`year`, `month`, and `day`, and may have fields `hour`, `min`, `sec`, and\n`isdst` (for a description of these fields, see the `os.date` function). The\nreturned value is a number, whose meaning depends on your system. In POSIX,\nWindows, and some other systems, this number counts the number of seconds\nsince some given start time (the "epoch"). In other systems, the meaning\nis not specified, and the number returned by `time` can be used only as an\nargument to `date` and `difftime`.\n
timeout _G.timeout(interval, f, ...)\nCalls a given function after an interval of time. To repeatedly call the\nfunction, return true inside the function. A nil or false return value\nstops repetition.\n@param interval The interval in seconds to call the function after.\n@param f The function to call.\n@param ... Additional arguments to pass to f.\n
@@ -1539,9 +1499,8 @@ title gui.title [string]\nThe title of the Textadept window.\n
tmpfile io.tmpfile()\nReturns a handle for a temporary file. This file is opened in update mode\nand it is automatically removed when the program ends.\n
tmpname os.tmpname()\nReturns a string with a file name that can be used for a temporary file. The\nfile must be explicitly opened before its use and explicitly removed when\nno longer needed. On some systems (POSIX), this function also creates a file\nwith that name, to avoid security risks. (Someone else might create the file\nwith wrong permissions in the time between getting the name and creating\nthe file.) You still have to open the file to use it and to remove it (even\nif you do not use it). When possible, you may prefer to use `io.tmpfile`,\nwhich automatically removes the file when the program ends.\n
toggle _m.textadept.bookmarks.toggle()\nToggles a bookmark on the current line.\n
-toggle_block _m.ruby.toggle_block()\nToggles between { ... } and do ... end Ruby blocks. If the caret is inside\na { ... } single-line block, that block is converted to a multiple-line do\n.. end block. If the caret is on a line that contains single-line do ... end\nblock, that block is converted to a single-line { ... } block. If the caret\nis inside a multiple-line do ... end block, that block is converted to a\nsingle-line { ... } block with all newlines replaced by a space. Indentation\nis important. The 'do' and 'end' keywords must be on lines with the same\nlevel of indentation to toggle correctly\n
-toggle_caret_sticky buffer.toggle_caret_sticky(buffer)\nSwitch between sticky and non-sticky: meant to be bound to a key. See\n`buffer.caret_sticky`.\n@param buffer The focused buffer.\n
-toggle_fold buffer.toggle_fold(buffer, line)\nSwitch a header line between expanded and contracted.\n@param buffer The focused buffer.\n@param line The line number.\n
+toggle_caret_sticky buffer.toggle_caret_sticky(buffer)\nSwitch between sticky and non-sticky: meant to be bound to a key. See\n`buffer.caret_sticky`.\n@param buffer The global buffer.\n
+toggle_fold buffer.toggle_fold(buffer, line)\nSwitch a header line between expanded and contracted.\n@param buffer The global buffer.\n@param line The line number.\n
token lexer.token(name, patt)\nCreates an LPeg capture table index with the name and position of the token.\n@param name The name of token. If this name is not in `l.tokens` then you\nwill have to specify a style for it in `lexer._tokenstyles`.\n@param patt The LPeg pattern associated with the token.\n@usage local ws = token(l.WHITESPACE, l.space^1)\n@usage php_start_rule = token('php_tag', '<?' * ('php' * l.space)^-1)\n
tonumber _G.tonumber(e [, base])\nTries to convert its argument to a number. If the argument is already a number\nor a string convertible to a number, then `tonumber` returns this number;\notherwise, it returns nil. An optional argument specifies the base to interpret\nthe numeral. The base may be any integer between 2 and 36, inclusive. In bases\nabove 10, the letter '`A`' (in either upper or lower case) represents 10,\n'`B`' represents 11, and so forth, with '`Z`' representing 35. In base 10\n(the default), the number can have a decimal part, as well as an optional\nexponent part (see §2.1). In other bases, only unsigned integers are accepted.\n
tostring _G.tostring(e)\nReceives an argument of any type and converts it to a string in a\nreasonable format. For complete control of how numbers are converted, use\n`string.format`. If the metatable of `e` has a `"__tostring"` field, then\n`tostring` calls the corresponding value with `e` as argument, and uses the\nresult of the call as its result.\n
@@ -1550,7 +1509,6 @@ traceback debug.traceback([thread, ] [message] [, level])\nReturns a string with
transpose_chars _m.textadept.editing.transpose_chars()\nTransposes characters intelligently. If the caret is at the end of a line,\nthe two characters before the caret are transposed. Otherwise, the characters\nto the left and right are.\n
try_encodings io.try_encodings [table]\nList of encodings to try to decode files as after UTF-8.\n
try_to_autocomplete_end _m.lua.try_to_autocomplete_end()\nTries to autocomplete Lua's 'end' keyword for control structures like 'if',\n'while', 'for', etc.\n@see control_structure_patterns\n
-try_to_autocomplete_end _m.ruby.try_to_autocomplete_end()\nTries to autocomplete Ruby's 'end' keyword for control structures like 'if',\n'while', 'for', etc.\n@see control_structure_patterns\n
two_phase_draw buffer.two_phase_draw [bool]\nTwo phase drawing mode. When `true`, drawing is performed in two phases, first\nthe background and then the foreground. This avoids chopping off characters\nthat overlap the next run. The default is for drawing to be two phase.\n
type _G.type(v)\nReturns the type of its only argument, coded as a string. The possible results\nof this function are " `nil`" (a string, not the value nil), "`number`",\n"`string`", "`boolean`", "`table`", "`function`", "`thread`", and "`userdata`".\n
type io.type(obj)\nChecks whether `obj` is a valid file handle. Returns the string `"file"`\nif `obj` is an open file handle, `"closed file"` if `obj` is a closed file\nhandle, or nil if `obj` is not a file handle.\n
@@ -1558,31 +1516,31 @@ type lpeg.type(value)\nIf the given value is a pattern, returns the string "patt
type_assignments _m.textadept.adeptsense.syntax.type_assignments\nA map of Lua patterns to class types for variable assignments. This\nis typically used for dynamically typed languages. For example,\n`sense.type_assignments['^"'] = 'string'` would recognize string assignments\nin Lua so the `foo` in `foo = "bar"` would be recognized as type `string`. The\nclass type value can contain pattern captures.\n
type_declarations _m.textadept.adeptsense.syntax.type_declarations\nA list of Lua patterns used for determining the class type of a symbol. The\nfirst capture returned must be the class name. Use '%_' to match the\nsymbol. Defaults to '(%u[%w_%.]+)%s+%_'.\n
type_declarations_exclude _m.textadept.adeptsense.syntax.type_declarations_exclude\nA table of types to exclude, even if they match a type_declaration\npattern. Each excluded type is a table key and has a true boolean value. For\nexample, { Foo = true } excludes any type whose name is 'Foo'. Defaults to\nbeing empty.\n
-undo buffer.undo(buffer)\nUndo one action in the undo history.\n@param buffer The focused buffer.\n
+undo buffer.undo(buffer)\nUndo one action in the undo history.\n@param buffer The global buffer.\n
undo_collection buffer.undo_collection [bool]\nWhether to collect undo information. When stopping collection, use\n`buffer:empty_undo_buffer()` to avoid the undo buffer being unsynchronized\nwith the data in the buffer.\n
unlock lfs.unlock(filehandle[, start[, length]])\nUnlocks a file or a part of it. This function works on open files; the file\nhandle should be specified as the first argument. The optional arguments\nstart and length can be used to specify a starting point and its length;\nboth should be numbers. Returns true if the operation was successful; in\ncase of error, it returns nil plus an error string.\n
unpack _G.unpack(list [, i [, j]])\nReturns the elements from the given table. This function is equivalent to\nreturn list[i], list[i+1], ···, list[j] except that the above code can\nbe written only for a fixed number of elements. By default, `i` is 1 and\n`j` is the length of the list, as defined by the length operator (see §2.5.5).\n
unsplit view:unsplit()\nUnsplits the indexed view if possible.\n@return boolean if the view was unsplit or not.\n
upper lexer.upper\nMatches any uppercase character (`A-Z`).\n
upper string.upper(s)\nReceives a string and returns a copy of this string with all lowercase\nletters changed to uppercase. All other characters are left unchanged. The\ndefinition of what a lowercase letter is depends on the current locale.\n
-upper_case buffer.upper_case(buffer)\nTransform the selection to upper case.\n@param buffer The focused buffer.\n
-use_pop_up buffer.use_pop_up(buffer, allow_popup)\nSets whether a pop up menu is displayed automatically when the user presses\nthe wrong mouse button.\n@param buffer The focused buffer.\n@param allow_popup Allow popup menu.\n
+upper_case buffer.upper_case(buffer)\nTransform the selection to upper case.\n@param buffer The global buffer.\n
+use_pop_up buffer.use_pop_up(buffer, allow_popup)\nSets whether a pop up menu is displayed automatically when the user presses\nthe wrong mouse button.\n@param buffer The global buffer.\n@param allow_popup Allow popup menu.\n
use_tabs buffer.use_tabs [bool]\nWhether tabs will be used in indentation. The default is `true`. `false`\nwill only use space characters.\n
user_dofile _G.user_dofile(filename)\nCalls 'dofile' on the given filename in the user's Textadept directory. This\nis typically used for loading user files like key commands or snippets. Errors\nare printed to the Textadept message buffer.\n@param filename The name of the file (not path).\n@return true if successful; false otherwise.\n
-user_list_show buffer.user_list_show(buffer, list_type, item_list)\nDisplay a list of strings and send notification when user chooses one.\n@param buffer The focused buffer.\n@param list_type A list identifier number greater than zero.\n@param item_list List of words separated by separator characters (initially\nspaces).\n@see _SCINTILLA.next_user_list_type\n
+user_list_show buffer.user_list_show(buffer, list_type, item_list)\nDisplay a list of strings and send notification when user chooses one.\n@param buffer The global buffer.\n@param list_type A list identifier number greater than zero.\n@param item_list List of words separated by separator characters (initially\nspaces).\n@see _SCINTILLA.next_user_list_type\n
v_scroll_bar buffer.v_scroll_bar [bool]\nWhether the vertical scroll bar is visible. Set to `false` to never see it and\n`true` to enable it again. The default state is to display it when required.\n
-vc_home buffer.vc_home(buffer)\nMove caret to before first visible character on line. If already there move\nto first character on line.\n@param buffer The focused buffer.\n
-vc_home_extend buffer.vc_home_extend(buffer)\nLike `buffer:vc_home()` but extending selection to new caret position.\n@param buffer The focused buffer.\n
-vc_home_rect_extend buffer.vc_home_rect_extend(buffer)\nMove caret to before first visible character on line. If already there move\nto first character on line. In either case, extend rectangular selection to\nnew caret position.\n@param buffer The focused buffer.\n
-vc_home_wrap buffer.vc_home_wrap(buffer)\nMove caret to before first visible character on display line when word-wrap\nis enabled. If already there, go to first character on display line.\n@param buffer The focused buffer.\n
-vc_home_wrap_extend buffer.vc_home_wrap_extend(buffer)\nLike `buffer:vc_home_wrap()` but extending selection to new caret position.\n@param buffer The focused buffer.\n
+vc_home buffer.vc_home(buffer)\nMove caret to before first visible character on line. If already there move\nto first character on line.\n@param buffer The global buffer.\n
+vc_home_extend buffer.vc_home_extend(buffer)\nLike `buffer:vc_home()` but extending selection to new caret position.\n@param buffer The global buffer.\n
+vc_home_rect_extend buffer.vc_home_rect_extend(buffer)\nMove caret to before first visible character on line. If already there move\nto first character on line. In either case, extend rectangular selection to\nnew caret position.\n@param buffer The global buffer.\n
+vc_home_wrap buffer.vc_home_wrap(buffer)\nMove caret to before first visible character on display line when word-wrap\nis enabled. If already there, go to first character on display line.\n@param buffer The global buffer.\n
+vc_home_wrap_extend buffer.vc_home_wrap_extend(buffer)\nLike `buffer:vc_home_wrap()` but extending selection to new caret position.\n@param buffer The global buffer.\n
version lpeg.version()\nReturns a string with the running version of LPeg.\n
-vertical_centre_caret buffer.vertical_centre_caret(buffer)\nCenter current line in window.\n@param buffer The focused buffer.\n
+vertical_centre_caret buffer.vertical_centre_caret(buffer)\nCenter current line in window.\n@param buffer The global buffer.\n
view _G.view [module]\nThe currently focused view. It also represents the structure of any view\ntable in 'views'.\n
view_eol buffer.view_eol [bool]\nWhether the end of line characters are visible. Normally, the end of line\ncharacters are hidden.\n
view_ws buffer.view_ws [number]\nThe visibility of white space characters.\n * `_SCINTILLA.constants.SCWS_INVISIBLE` (0): The normal display mode\n with white space displayed as an empty background color.\n * `_SCINTILLA.constants.SCWS_VISIBLEALWAYS` (1): White space characters\n are drawn as dots and arrows.\n * `_SCINTILLA.constants.SCWS_VISIBLEAFTERINDENT` (2): White space used\n for indentation is displayed normally but after the first visible\n character, it is shown as dots and arrows.\n\n
virtual_space_options buffer.virtual_space_options [number]\nVirtual space options.\n * `_SCINTILLA.constants.SCVS_NONE` (0): Disables all use of virtual\n space (default).\n * `_SCINTILLA.constants.SCVS_RECTANGULARSELECTION` (1): Enabled only\n for rectangular selections.\n * `_SCINTILLA.constants.SCVS_USERACCESSIBLE` (2): Enabled.\n\n
-visible_from_doc_line buffer.visible_from_doc_line(buffer, line)\nFind the display line of a document line taking hidden lines into account. If\nthere is folding and line is outside the range of lines in the document,\nthe return value is -1.\n@param buffer The focused buffer.\n@param line The line number.\n@return number\n
+visible_from_doc_line buffer.visible_from_doc_line(buffer, line)\nFind the display line of a document line taking hidden lines into account. If\nthere is folding and line is outside the range of lines in the document,\nthe return value is -1.\n@param buffer The global buffer.\n@param line The line number.\n@return number\n
white lexer.colors.white\nWhite.\n
whitespace_chars buffer.whitespace_chars [string]\nThe set of characters making up whitespace for when moving or selecting by\nword. Use after setting `buffer.word_chars`. (Write-only)\n
whitespace_size buffer.whitespace_size [number]\nThe size of the dots used to mark space characters.\n
@@ -1591,23 +1549,23 @@ whole_word_label_text gui.find.whole_word_label_text [string]\nThe text of the '
word lexer.word\nMatches a typical word starting with a letter or underscore and then any\nalphanumeric or underscore characters.\n
word_chars _m.textadept.adeptsense.syntax.word_chars\nA Lua pattern of characters allowed in a word. Default is '%w_'.\n
word_chars buffer.word_chars [string]\nThe set of characters making up words when moving or selecting by\nword. (Write-only)\n
-word_end_position buffer.word_end_position(buffer, pos, only_word_chars)\nGet position of end of word.\n@param buffer The focused buffer.\n@param pos The position.\n@param only_word_chars If `true`, stops searching at the first non-word\ncharacter in the search direction. Otherwise, the first character in the search\ndirection sets the type of the search as word or non-word and the search\nstops at the first non-matching character. Searches are also terminated by\nthe start or end of the document.\n
-word_left buffer.word_left(buffer)\nMove caret left one word.\n@param buffer The focused buffer.\n
-word_left_end buffer.word_left_end(buffer)\nMove caret left one word, position cursor at end of word.\n@param buffer The focused buffer.\n
-word_left_end_extend buffer.word_left_end_extend(buffer)\nMove caret left one word, position cursor at end of word, extending selection\nto new caret position.\n@param buffer The focused buffer.\n
-word_left_extend buffer.word_left_extend(buffer)\nMove caret left one word extending selection to new caret position.\n@param buffer The focused buffer.\n
+word_end_position buffer.word_end_position(buffer, pos, only_word_chars)\nGet position of end of word.\n@param buffer The global buffer.\n@param pos The position.\n@param only_word_chars If `true`, stops searching at the first non-word\ncharacter in the search direction. Otherwise, the first character in the search\ndirection sets the type of the search as word or non-word and the search\nstops at the first non-matching character. Searches are also terminated by\nthe start or end of the document.\n
+word_left buffer.word_left(buffer)\nMove caret left one word.\n@param buffer The global buffer.\n
+word_left_end buffer.word_left_end(buffer)\nMove caret left one word, position cursor at end of word.\n@param buffer The global buffer.\n
+word_left_end_extend buffer.word_left_end_extend(buffer)\nMove caret left one word, position cursor at end of word, extending selection\nto new caret position.\n@param buffer The global buffer.\n
+word_left_extend buffer.word_left_extend(buffer)\nMove caret left one word extending selection to new caret position.\n@param buffer The global buffer.\n
word_match lexer.word_match(words, word_chars, case_insensitive)\nCreates an LPeg pattern that matches a set of words.\n@param words A table of words.\n@param word_chars Optional string of additional characters considered to be\npart of a word (default is `%w_`).\n@param case_insensitive Optional boolean flag indicating whether the word\nmatch is case-insensitive.\n@usage local keyword = token(l.KEYWORD, word_match { 'foo', 'bar', 'baz' })\n@usage local keyword = token(l.KEYWORD, word_match({ 'foo-bar', 'foo-baz',\n'bar-foo', 'bar-baz', 'baz-foo', 'baz-bar' }, '-', true))\n
-word_part_left buffer.word_part_left(buffer)\nMove to the previous change in capitalisation or underscores.\n@param buffer The focused buffer.\n
-word_part_left_extend buffer.word_part_left_extend(buffer)\nMove to the previous change in capitalisation or underscores extending\nselection to new caret position.\n@param buffer The focused buffer.\n
-word_part_right buffer.word_part_right(buffer)\nMove to the next change in capitalisation or underscores.\n@param buffer The focused buffer.\n
-word_part_right_extend buffer.word_part_right_extend(buffer)\nMove to the next change in capitalisation or underscores extending selection\nto new caret position.\n@param buffer The focused buffer.\n
-word_right buffer.word_right(buffer)\nMove caret right one word.\n@param buffer The focused buffer.\n
-word_right_end buffer.word_right_end(buffer)\nMove caret right one word, position cursor at end of word.\n@param buffer The focused buffer.\n
-word_right_end_extend buffer.word_right_end_extend(buffer)\nMove caret right one word, position cursor at end of word, extending selection\nto new caret position.\n@param buffer The focused buffer.\n
-word_right_extend buffer.word_right_extend(buffer)\nMove caret right one word extending selection to new caret position.\n@param buffer The focused buffer.\n
-word_start_position buffer.word_start_position(buffer, pos, only_word_chars)\nGet position of start of word.\n@param buffer The focused buffer.\n@param pos The position.\n@param only_word_chars If `true`, stops searching at the first non-word\ncharacter in the search direction. Otherwise, the first character in the search\ndirection sets the type of the search as word or non-word and the search\nstops at the first non-matching character. Searches are also terminated by\nthe start or end of the document.\n
+word_part_left buffer.word_part_left(buffer)\nMove to the previous change in capitalisation or underscores.\n@param buffer The global buffer.\n
+word_part_left_extend buffer.word_part_left_extend(buffer)\nMove to the previous change in capitalisation or underscores extending\nselection to new caret position.\n@param buffer The global buffer.\n
+word_part_right buffer.word_part_right(buffer)\nMove to the next change in capitalisation or underscores.\n@param buffer The global buffer.\n
+word_part_right_extend buffer.word_part_right_extend(buffer)\nMove to the next change in capitalisation or underscores extending selection\nto new caret position.\n@param buffer The global buffer.\n
+word_right buffer.word_right(buffer)\nMove caret right one word.\n@param buffer The global buffer.\n
+word_right_end buffer.word_right_end(buffer)\nMove caret right one word, position cursor at end of word.\n@param buffer The global buffer.\n
+word_right_end_extend buffer.word_right_end_extend(buffer)\nMove caret right one word, position cursor at end of word, extending selection\nto new caret position.\n@param buffer The global buffer.\n
+word_right_extend buffer.word_right_extend(buffer)\nMove caret right one word extending selection to new caret position.\n@param buffer The global buffer.\n
+word_start_position buffer.word_start_position(buffer, pos, only_word_chars)\nGet position of start of word.\n@param buffer The global buffer.\n@param pos The position.\n@param only_word_chars If `true`, stops searching at the first non-word\ncharacter in the search direction. Otherwise, the first character in the search\ndirection sets the type of the search as word or non-word and the search\nstops at the first non-matching character. Searches are also terminated by\nthe start or end of the document.\n
wrap coroutine.wrap(f)\nCreates a new coroutine, with body `f`. `f` must be a Lua function. Returns\na function that resumes the coroutine each time it is called. Any arguments\npassed to the function behave as the extra arguments to `resume`. Returns\nthe same values returned by `resume`, except the first boolean. In case of\nerror, propagates the error.\n
-wrap_count buffer.wrap_count(buffer, line)\nReturns the number of display lines needed to wrap a document line.\n@param buffer The focused buffer.\n@param line The line number.\n@return number\n
+wrap_count buffer.wrap_count(buffer, line)\nReturns the number of display lines needed to wrap a document line.\n@param buffer The global buffer.\n@param line The line number.\n@return number\n
wrap_indent_mode buffer.wrap_indent_mode [number]\nHow wrapped sublines are placed. Default is fixed.\n * `_SCINTILLA.constants.SC_WRAP_INDENT_FIXED` (0): Wrapped sublines\n aligned to left of window plus amount set by\n `buffer.wrap_start_indent`.\n * `_SCINTILLA.constants.SC_WRAP_INDENT_SAME` (1): Wrapped sublines are\n aligned to first subline indent.\n * `_SCINTILLA.constants.SC_WRAP_INDENT_INDENT` (2): Wrapped sublines\n are aligned to first subline indent plus one more level of\n indentation.\n\n
wrap_mode buffer.wrap_mode [number]\nText word wrap mode.\n * `_SCINTILLA.constants.SC_WRAP_NONE` (0): Disable line wrapping.\n * `_SCINTILLA.constants.SC_WRAP_WORD` (1): Enable wrapping on word\n boundaries.\n * `_SCINTILLA.constants.SC_WRAP_CHAR` (2): Enable wrapping between any\n characters.\n\n
wrap_start_indent buffer.wrap_start_indent [number]\nThe start indent for wrapped lines.\n
@@ -1621,5 +1579,5 @@ xpcall _G.xpcall(f, err)\nThis function is similar to `pcall`, except that you c
yellow lexer.colors.yellow\nYellow.\n
yield coroutine.yield(···)\nSuspends the execution of the calling coroutine. The coroutine cannot be\nrunning a C function, a metamethod, or an iterator. Any arguments to `yield`\nare passed as extra results to `resume`.\n
zoom buffer.zoom [number]\nThe number of points added to the size of all fonts. It may be positive to\nmagnify or negative to reduce.\n
-zoom_in buffer.zoom_in(buffer)\nMagnify the displayed text by increasing the sizes by 1 point if the current\nzoom factor is less than 20 points.\n@param buffer The focused buffer.\n
-zoom_out buffer.zoom_out(buffer)\nMake the displayed text smaller by decreasing the sizes by 1 point if the\ncurrent zoom factor is greater than -10 points.\n@param buffer The focused buffer.\n \ No newline at end of file
+zoom_in buffer.zoom_in(buffer)\nMagnify the displayed text by increasing the sizes by 1 point if the current\nzoom factor is less than 20 points.\n@param buffer The global buffer.\n
+zoom_out buffer.zoom_out(buffer)\nMake the displayed text smaller by decreasing the sizes by 1 point if the\ncurrent zoom factor is greater than -10 points.\n@param buffer The global buffer.\n \ No newline at end of file
diff --git a/modules/lua/tags b/modules/lua/tags
index 4ba58f3f..cbd464bd 100644
--- a/modules/lua/tags
+++ b/modules/lua/tags
@@ -41,6 +41,8 @@ DEFAULT _ 0;" F class:lexer
DEFAULT_DEPTH _ 0;" F class:_m.textadept.snapopen
DEFAULT_SESSION _ 0;" F class:_m.textadept.session
DOUBLE_CLICK _ 0;" F class:events
+DWELL_END _ 0;" F class:events
+DWELL_START _ 0;" F class:events
EDGE_BACKGROUND _ 0;" F class:_SCINTILLA.constants
EDGE_LINE _ 0;" F class:_SCINTILLA.constants
EDGE_NONE _ 0;" F class:_SCINTILLA.constants
@@ -58,7 +60,6 @@ HIGHLIGHT_BRACES _ 0;" F class:_m.textadept.editing
HOTSPOT_CLICK _ 0;" F class:events
HOTSPOT_DOUBLE_CLICK _ 0;" F class:events
HOTSPOT_RELEASE_CLICK _ 0;" F class:events
-HUGE_VAL _ 0;" F class:math
IDENTIFIER _ 0;" F class:lexer
INDIC0_MASK _ 0;" F class:_SCINTILLA.constants
INDIC1_MASK _ 0;" F class:_SCINTILLA.constants
@@ -716,14 +717,7 @@ _insert _ 0;" f class:_m.textadept.snippets
_m _ 0;" m
_m _ 0;" t
_m.cpp _ 0;" m
-_m.css _ 0;" m
-_m.hypertext _ 0;" m
-_m.java _ 0;" m
_m.lua _ 0;" m
-_m.php _ 0;" m
-_m.rails _ 0;" m
-_m.rhtml _ 0;" m
-_m.ruby _ 0;" m
_m.textadept _ 0;" m
_m.textadept.adeptsense _ 0;" m
_m.textadept.bookmarks _ 0;" m
@@ -811,6 +805,7 @@ brace_highlight _ 0;" f class:buffer
brace_highlight_indicator _ 0;" f class:buffer
brace_match _ 0;" f class:buffer
braces _ 0;" t class:_m.textadept.editing
+buffer _ 0;" F class:view
buffer _ 0;" m
buffer _ 0;" t
buffered_draw _ 0;" F class:buffer
@@ -850,7 +845,7 @@ char_right _ 0;" f class:buffer
char_right_extend _ 0;" f class:buffer
char_right_rect_extend _ 0;" f class:buffer
chdir _ 0;" f class:lfs
-check_focused_buffer _ 0;" f class:gui
+check_global _ 0;" f class:buffer
choose_caret_x _ 0;" f class:buffer
class_definition _ 0;" F class:_m.textadept.adeptsense.syntax
clear _ 0;" f class:_m.textadept.adeptsense
@@ -889,7 +884,6 @@ context_menu _ 0;" t class:_m.textadept.menu
contracted_fold_next _ 0;" f class:buffer
control_char_symbol _ 0;" F class:buffer
control_structure_patterns _ 0;" t class:_m.lua
-control_structure_patterns _ 0;" t class:_m.ruby
convert_eo_ls _ 0;" f class:buffer
convert_indentation _ 0;" f class:_m.textadept.editing
copy _ 0;" f class:buffer
@@ -905,9 +899,6 @@ cpp _ 0;" t class:_m
cpp _ 0;" t class:keys
cpp _ 0;" t class:snippets
create _ 0;" f class:coroutine
-css _ 0;" t class:_m
-css _ 0;" t class:keys
-css _ 0;" t class:snippets
ctags_kinds _ 0;" t class:_m.textadept.adeptsense
current_pos _ 0;" F class:buffer
current_word _ 0;" f class:_m.textadept.editing
@@ -938,8 +929,6 @@ direct_pointer _ 0;" F class:buffer
dirty _ 0;" F class:buffer
disconnect _ 0;" f class:events
doc_line_from_visible _ 0;" f class:buffer
-doc_pointer _ 0;" F class:buffer
-doc_pointer _ 0;" F class:view
docstatusbar_text _ 0;" F class:gui
document_end _ 0;" f class:buffer
document_end_extend _ 0;" f class:buffer
@@ -1002,8 +991,6 @@ fmod _ 0;" f class:math
focus _ 0;" F class:buffer
focus _ 0;" f class:gui.command_entry
focus _ 0;" f class:gui.find
-focus _ 0;" f class:view
-focused_doc_pointer _ 0;" F class:gui
fold _ 0;" f class:lexer
fold_expanded _ 0;" F class:buffer
fold_level _ 0;" F class:buffer
@@ -1060,8 +1047,6 @@ goto_next _ 0;" f class:_m.textadept.bookmarks
goto_pos _ 0;" f class:buffer
goto_prev _ 0;" f class:_m.textadept.bookmarks
goto_required _ 0;" f class:_m.lua
-goto_required _ 0;" f class:_m.php
-goto_required _ 0;" f class:_m.ruby
goto_view _ 0;" f class:gui
grab_focus _ 0;" f class:buffer
graph _ 0;" F class:lexer
@@ -1092,9 +1077,7 @@ home_wrap _ 0;" f class:buffer
home_wrap_extend _ 0;" f class:buffer
hotspot_active_underline _ 0;" F class:buffer
hotspot_single_line _ 0;" F class:buffer
-hypertext _ 0;" t class:_m
-hypertext _ 0;" t class:keys
-hypertext _ 0;" t class:snippets
+huge _ 0;" F class:math
iconv _ 0;" f class:string
in_files _ 0;" F class:gui.find
in_files_label_text _ 0;" F class:gui.find
@@ -1121,9 +1104,6 @@ integer _ 0;" F class:lexer
io _ 0;" m
io _ 0;" t
ipairs _ 0;" f
-java _ 0;" t class:_m
-java _ 0;" t class:keys
-java _ 0;" t class:snippets
join_lines _ 0;" f class:_m.textadept.editing
keys _ 0;" m
keys _ 0;" t
@@ -1178,7 +1158,6 @@ load _ 0;" f
load _ 0;" f class:_m.textadept.session
load _ 0;" f class:lexer
load_ctags _ 0;" f class:_m.textadept.adeptsense
-load_project _ 0;" f class:_m.rails
loaded _ 0;" F class:package
loaders _ 0;" F class:package
loadfile _ 0;" f
@@ -1272,7 +1251,6 @@ next_marker_number _ 0;" f class:_SCINTILLA
next_user_list_type _ 0;" f class:_SCINTILLA
nonnewline _ 0;" F class:lexer
nonnewline_esc _ 0;" F class:lexer
-notification _ 0;" f class:events
oct_num _ 0;" F class:lexer
open _ 0;" f class:_m.textadept.snapopen
open _ 0;" f class:io
@@ -1300,9 +1278,6 @@ paste _ 0;" f class:buffer
path _ 0;" F class:package
patterns _ 0;" t class:_m.textadept.mime_types
pcall _ 0;" f
-php _ 0;" t class:_m
-php _ 0;" t class:keys
-php _ 0;" t class:snippets
pi _ 0;" F class:math
point_x_from_position _ 0;" f class:buffer
point_y_from_position _ 0;" f class:buffer
@@ -1333,9 +1308,6 @@ punct _ 0;" F class:lexer
purple _ 0;" F class:lexer.colors
quit _ 0;" f
rad _ 0;" f class:math
-rails _ 0;" t class:_m
-rails _ 0;" t class:keys
-rails _ 0;" t class:snippets
random _ 0;" f class:math
randomseed _ 0;" f class:math
rawequal _ 0;" f
@@ -1377,14 +1349,8 @@ resume _ 0;" f class:coroutine
reverse _ 0;" f class:string
rgba_image_height _ 0;" F class:buffer
rgba_image_width _ 0;" F class:buffer
-rhtml _ 0;" t class:_m
-rhtml _ 0;" t class:keys
-rhtml _ 0;" t class:snippets
rmdir _ 0;" f class:lfs
rotate_selection _ 0;" f class:buffer
-ruby _ 0;" t class:_m
-ruby _ 0;" t class:keys
-ruby _ 0;" t class:snippets
run _ 0;" f class:_m.textadept.run
run _ 0;" t class:_m.textadept
run_command _ 0;" t class:_m.textadept.run
@@ -1430,22 +1396,10 @@ selection_start _ 0;" F class:buffer
selections _ 0;" F class:buffer
self _ 0;" F class:_m.textadept.adeptsense.syntax
sense _ 0;" F class:_m.cpp
-sense _ 0;" F class:_m.css
-sense _ 0;" F class:_m.hypertext
-sense _ 0;" F class:_m.java
sense _ 0;" F class:_m.lua
-sense _ 0;" F class:_m.php
-sense _ 0;" F class:_m.rails
-sense _ 0;" F class:_m.rhtml
-sense _ 0;" F class:_m.ruby
session _ 0;" t class:_m.textadept
set_buffer_properties _ 0;" f class:_m.cpp
-set_buffer_properties _ 0;" f class:_m.css
-set_buffer_properties _ 0;" f class:_m.hypertext
-set_buffer_properties _ 0;" f class:_m.java
set_buffer_properties _ 0;" f class:_m.lua
-set_buffer_properties _ 0;" f class:_m.php
-set_buffer_properties _ 0;" f class:_m.ruby
set_chars_default _ 0;" f class:buffer
set_contextmenu _ 0;" f class:_m.textadept.menu
set_empty_selection _ 0;" f class:buffer
@@ -1487,7 +1441,6 @@ show_apidoc _ 0;" f class:_m.textadept.adeptsense
show_documentation _ 0;" f class:_m.textadept.adeptsense
show_lines _ 0;" f class:buffer
sin _ 0;" f class:math
-singular _ 0;" F class:_m.rails
sinh _ 0;" f class:math
size _ 0;" F class:gui
size _ 0;" F class:view
@@ -1581,7 +1534,6 @@ title _ 0;" F class:gui
tmpfile _ 0;" f class:io
tmpname _ 0;" f class:os
toggle _ 0;" f class:_m.textadept.bookmarks
-toggle_block _ 0;" f class:_m.ruby
toggle_caret_sticky _ 0;" f class:buffer
toggle_fold _ 0;" f class:buffer
token _ 0;" f class:lexer
@@ -1592,7 +1544,6 @@ traceback _ 0;" f class:debug
transpose_chars _ 0;" f class:_m.textadept.editing
try_encodings _ 0;" t class:io
try_to_autocomplete_end _ 0;" f class:_m.lua
-try_to_autocomplete_end _ 0;" f class:_m.ruby
two_phase_draw _ 0;" F class:buffer
type _ 0;" f
type _ 0;" f class:io
diff --git a/modules/textadept/find.lua b/modules/textadept/find.lua
index a0f6e299..409ffe4c 100644
--- a/modules/textadept/find.lua
+++ b/modules/textadept/find.lua
@@ -18,7 +18,7 @@ find.in_files_label_text = L('In files')
local MARK_FIND = _SCINTILLA.next_marker_number()
local MARK_FIND_COLOR = 0x4D9999
-local previous_view
+local prev_view
-- Text escape sequences with their associated characters.
-- @class table
@@ -76,7 +76,9 @@ function find.find_in_files(utf8_dir)
search_dir(dir)
if #matches == 1 then matches[2] = L('No results found') end
matches[#matches + 1] = ''
- if buffer._type ~= L('[Files Found Buffer]') then previous_view = view end
+ if buffer._type ~= L('[Files Found Buffer]') then
+ prev_view = _VIEWS[view]
+ end
gui._print(L('[Files Found Buffer]'), table.concat(matches, '\n'))
end
end
@@ -313,17 +315,18 @@ local function goto_file(pos, line_num)
buffer:marker_add(line_num, MARK_FIND)
buffer:goto_pos(buffer.current_pos)
if #_VIEWS == 1 then
- _, previous_view = view:split(false) -- horizontal
+ view:split()
+ prev_view = 2 -- second view
else
local clicked_view = view
- if previous_view then previous_view:focus() end
+ if prev_view then gui.goto_view(prev_view) end
if buffer._type == L('[Files Found Buffer]') then
-- There are at least two find in files views; find one of those views
-- that the file was not selected from and focus it.
- for _, v in ipairs(_VIEWS) do
+ for i, v in ipairs(_VIEWS) do
if v ~= clicked_view then
- previous_view = v
- v:focus()
+ prev_view = i
+ gui.goto_view(i)
break
end
end
@@ -339,12 +342,12 @@ events.connect(events.DOUBLE_CLICK, goto_file)
-- LuaDoc is in core/.find.luadoc.
function find.goto_file_in_list(next)
- local orig_view = view
+ local orig_view = _VIEWS[view]
for _, buffer in ipairs(_BUFFERS) do
if buffer._type == L('[Files Found Buffer]') then
- for _, view in ipairs(_VIEWS) do
- if view.doc_pointer == buffer.doc_pointer then
- view:focus()
+ for j, view in ipairs(_VIEWS) do
+ if view.buffer == buffer then
+ gui.goto_view(j)
local orig_line = buffer:line_from_position(buffer.current_pos)
local line = orig_line
while true do
@@ -352,7 +355,7 @@ function find.goto_file_in_list(next)
if line > buffer.line_count - 1 then line = 0 end
if line < 0 then line = buffer.line_count - 1 end
if line == orig_line then -- prevent infinite loops
- orig_view:focus()
+ gui.goto_view(orig_view)
return
end
if buffer:get_line(line):match('^(.+):(%d+):.+$') then
diff --git a/modules/textadept/keys.lua b/modules/textadept/keys.lua
index 517502ec..5672933a 100644
--- a/modules/textadept/keys.lua
+++ b/modules/textadept/keys.lua
@@ -234,8 +234,8 @@ keys[not OSX and 'caO' or 'cmO'] = utils.snapopen_filedir
keys[not OSX and 'ci' or 'mi'] = utils.show_style
-- Buffer.
-keys['c\t'] = { _view.goto_buffer, _view, 1, false }
-keys['cs\t'] = { _view.goto_buffer, _view, -1, false }
+keys['c\t'] = { _view.goto_buffer, _view, 1, true }
+keys['cs\t'] = { _view.goto_buffer, _view, -1, true }
keys[not OSX and 'cb' or 'mb'] = gui.switch_buffer
-- Indentation.
-- TODO: { utils.set_indentation, 2 }
@@ -258,11 +258,11 @@ keys[not OSX and 'cL' or 'mL'] = m_textadept.mime_types.select_lexer
keys.f5 = { _buffer.colourise, _buffer, 0, -1 }
-- View.
-keys[not OSX and 'can' or 'ca\t'] = { gui.goto_view, 1, false }
-keys[not OSX and 'cap' or 'cas\t'] = { gui.goto_view, -1, false }
-keys[not OSX and 'cas' or 'cs'] = { _view.split, _view, false }
+keys[not OSX and 'can' or 'ca\t'] = { gui.goto_view, 1, true }
+keys[not OSX and 'cap' or 'cas\t'] = { gui.goto_view, -1, true }
+keys[not OSX and 'cas' or 'cs'] = { _view.split, _view }
if not OSX then keys.cah = keys.cas end
-keys[not OSX and 'cav' or 'cv'] = { _view.split, _view }
+keys[not OSX and 'cav' or 'cv'] = { _view.split, _view, true }
keys[not OSX and 'caw' or 'cw'] = { _view.unsplit, _view }
keys[not OSX and 'caW' or 'cW'] = utils.unsplit_all
keys[not OSX and 'ca+' or 'c+'] = { utils.grow, 10 }
diff --git a/modules/textadept/menu.lua b/modules/textadept/menu.lua
index 82c72cfa..e26a2ec4 100644
--- a/modules/textadept/menu.lua
+++ b/modules/textadept/menu.lua
@@ -149,8 +149,8 @@ menubar = {
{ L('Show Style'), utils.show_style },
},
{ title = L('Buffer'),
- { L('Next Buffer'), { _view.goto_buffer, _view, 1, false } },
- { L('Previous Buffer'), { _view.goto_buffer, _view, -1, false } },
+ { L('Next Buffer'), { _view.goto_buffer, _view, 1, true } },
+ { L('Previous Buffer'), { _view.goto_buffer, _view, -1, true } },
{ L('Switch to Buffer...'), gui.switch_buffer },
SEPARATOR,
{ title = L('Indentation'),
@@ -179,11 +179,11 @@ menubar = {
{ L('Refresh Syntax Highlighting'), { _buffer.colourise, _buffer, 0, -1 } },
},
{ title = L('View'),
- { L('Next View'), { gui.goto_view, 1, false } },
- { L('Previous View'), { gui.goto_view, -1, false } },
+ { L('Next View'), { gui.goto_view, 1, true } },
+ { L('Previous View'), { gui.goto_view, -1, true } },
SEPARATOR,
- { L('Split View Horizontal'), { _view.split, _view, false } },
- { L('Split View Vertical'), { _view.split, _view } },
+ { L('Split View Horizontal'), { _view.split, _view } },
+ { L('Split View Vertical'), { _view.split, _view, true } },
{ L('Unsplit View'), { _view.unsplit, _view } },
{ L('Unsplit All Views'), utils.unsplit_all },
{ L('Grow View'), { utils.grow, 10 } },
diff --git a/modules/textadept/mime_types.lua b/modules/textadept/mime_types.lua
index a7a4f4e1..3d461db4 100644
--- a/modules/textadept/mime_types.lua
+++ b/modules/textadept/mime_types.lua
@@ -106,7 +106,7 @@ table.sort(lexers)
-- @param style_num A style number in the range 0 <= style_num < 256.
-- @see buffer.style_at
local function get_style_name(buffer, style_num)
- gui.check_focused_buffer(buffer)
+ buffer:check_global()
if style_num < 0 or style_num > 255 then error('0 <= style_num < 256') end
return buffer:private_lexer_call(style_num)
end
@@ -130,7 +130,7 @@ local SETLEXERLANGUAGE = _SCINTILLA.functions.set_lexer_language[1]
-- @param lang The string language to set.
-- @usage buffer:set_lexer('language_name')
local function set_lexer(buffer, lang)
- gui.check_focused_buffer(buffer)
+ buffer:check_global()
buffer._lexer = lang
buffer:private_lexer_call(SETDIRECTPOINTER, buffer.direct_pointer)
buffer:private_lexer_call(SETLEXERLANGUAGE, lang)
@@ -161,7 +161,7 @@ local GETLEXERLANGUAGE = _SCINTILLA.functions.get_lexer_language[1]
-- lexer can be different from the lexer passed to buffer:set_lexer().
-- Defaults to false.
local function get_lexer(buffer, current)
- gui.check_focused_buffer(buffer)
+ buffer:check_global()
local lexer = buffer:private_lexer_call(GETLEXERLANGUAGE)
if not current then return lexer end
local i, ws, style_at = buffer.current_pos, ws_styles[lexer], buffer.style_at
diff --git a/modules/textadept/session.lua b/modules/textadept/session.lua
index e69f2488..1178380f 100644
--- a/modules/textadept/session.lua
+++ b/modules/textadept/session.lua
@@ -92,7 +92,7 @@ function load(filename)
end
end
f:close()
- _VIEWS[current_view]:focus()
+ gui.goto_view(current_view)
if #not_found > 0 then
gui.dialog('msgbox',
'--title', L('Session Files Not Found'),
@@ -121,7 +121,7 @@ function save(filename)
for _, buffer in ipairs(_BUFFERS) do
local filename = buffer.filename or buffer._type
if filename then
- local current = buffer.doc_pointer == gui.focused_doc_pointer
+ local current = buffer == view.buffer
local anchor = current and 'anchor' or '_anchor'
local current_pos = current and 'current_pos' or '_current_pos'
local top_line = current and 'first_visible_line' or '_first_visible_line'
@@ -138,32 +138,25 @@ function save(filename)
local spaces = (' '):rep(level)
session[#session + 1] = split_line:format(spaces, number, vertical, size)
spaces = (' '):rep(level + 1)
- if type(c1) == 'table' then
+ if c1[1] and c1[2] then
write_split(c1, level + 1, 1)
else
- session[#session + 1] = view_line:format(spaces, 1, c1)
+ session[#session + 1] = view_line:format(spaces, 1, _BUFFERS[c1.buffer])
end
- if type(c2) == 'table' then
+ if c2[1] and c2[2] then
write_split(c2, level + 1, 2)
else
- session[#session + 1] = view_line:format(spaces, 2, c2)
+ session[#session + 1] = view_line:format(spaces, 2, _BUFFERS[c2.buffer])
end
end
local splits = gui.get_split_table()
- if type(splits) == 'table' then
+ if splits[1] and splits[2] then
write_split(splits, 0, 0)
else
- session[#session + 1] = view_line:format('', 1, splits)
+ session[#session + 1] = view_line:format('', 1, _BUFFERS[splits.buffer])
end
-- Write out the current focused view.
- local current_view = view
- for i = 1, #_VIEWS do
- if _VIEWS[i] == current_view then
- current_view = i
- break
- end
- end
- session[#session + 1] = ("current_view: %d"):format(current_view)
+ session[#session + 1] = ("current_view: %d"):format(_VIEWS[view])
-- Write out other things.
local size = gui.size
session[#session + 1] = ("size: %d %d"):format(size[1], size[2])
diff --git a/src/textadept.c b/src/textadept.c
index cd3611cc..a1fdfc9e 100644
--- a/src/textadept.c
+++ b/src/textadept.c
@@ -7,14 +7,14 @@
#include <gtk/gtk.h>
#define PLAT_GTK 1
-#include <Scintilla.h>
-#include <SciLexer.h>
-#include <ScintillaWidget.h>
+#include "Scintilla.h"
+#include "SciLexer.h"
+#include "ScintillaWidget.h"
-#include <gcocoadialog.h>
-#include <lua.h>
-#include <lualib.h>
-#include <lauxlib.h>
+#include "gcocoadialog.h"
+#include "lua.h"
+#include "lualib.h"
+#include "lauxlib.h"
#if __WIN32__
#include <windows.h>
@@ -29,38 +29,15 @@
#include <sys/sysctl.h>
#endif
-#define gbool gboolean
#define SS(view, m, w, l) scintilla_send_message(SCINTILLA(view), m, w, l)
#define signal(o, s, c) g_signal_connect(G_OBJECT(o), s, G_CALLBACK(c), 0)
-#define streq(s1, s2) strcmp(s1, s2) == 0
-#define l_append(l, i) lua_rawseti(l, i, lua_objlen(l, i) + 1)
-#define l_cfunc(l, f, k) { \
- lua_pushcfunction(l, f); \
- lua_setfield(l, -2, k); \
-}
-#define l_emit_event_key(name, event) \
- l_emit_event(name, LUA_TNUMBER, event->keyval, LUA_TBOOLEAN, \
- event->state & GDK_SHIFT_MASK, LUA_TBOOLEAN, \
- event->state & GDK_CONTROL_MASK, LUA_TBOOLEAN, \
- event->state & GDK_MOD1_MASK, LUA_TBOOLEAN, \
- event->state & GDK_MOD5_MASK, -1)
-#define l_mt(l, k, i, ni) { \
- if (luaL_newmetatable(l, k)) { \
- l_cfunc(l, i, "__index"); \
- l_cfunc(l, ni, "__newindex"); \
- } \
- lua_setmetatable(l, -2); \
-}
-#define l_togtkwidget(l, i) (GtkWidget *)lua_touserdata(l, i)
// Defines for different GTK versions.
#if !(GTK_CHECK_VERSION(2,18,0) || GTK_CHECK_VERSION(3,0,0))
#define gtk_widget_set_can_default(w,_) GTK_WIDGET_SET_FLAGS(w, GTK_CAN_DEFAULT)
#define gtk_widget_set_can_focus(w,_) GTK_WIDGET_UNSET_FLAGS(w, GTK_CAN_FOCUS)
-#define gtk_widget_get_allocation(e, a) { \
- (a)->width = e->allocation.width; \
- (a)->height = e->allocation.height; \
-}
+#define gtk_widget_get_allocation(e, a) \
+ ((a)->width = e->allocation.width, (a)->height = e->allocation.height)
#define gtk_widget_has_focus GTK_WIDGET_HAS_FOCUS
#define gtk_widget_get_visible GTK_WIDGET_VISIBLE
#define gtk_widget_get_window(w) w->window
@@ -79,20 +56,18 @@
// Window
GtkWidget *window, *focused_view, *menubar, *statusbar[2];
-GtkAccelGroup *accel = 0;
+GtkAccelGroup *accel;
char *textadept_home;
-
-void create_ui();
-GtkWidget *new_view(sptr_t);
-void new_buffer(GtkWidget *, int, int);
-
-static void s_notification(GtkWidget *, gint, gpointer, gpointer);
+static void new_window();
+static GtkWidget *new_view(sptr_t);
+static void new_buffer(sptr_t);
+static void s_notify(GtkWidget *, gint, gpointer, gpointer);
static void s_command(GtkWidget *, gint, gpointer, gpointer);
-static gbool s_keypress(GtkWidget *, GdkEventKey *, gpointer);
-static gbool s_buttonpress(GtkWidget *, GdkEventButton *, gpointer);
-static gbool w_focus(GtkWidget *, GdkEventFocus *, gpointer);
-static gbool w_keypress(GtkWidget *, GdkEventKey *, gpointer);
-static gbool w_exit(GtkWidget *, GdkEventAny *, gpointer);
+static gboolean s_keypress(GtkWidget *, GdkEventKey *, gpointer);
+static gboolean s_buttonpress(GtkWidget *, GdkEventButton *, gpointer);
+static gboolean w_focus(GtkWidget *, GdkEventFocus *, gpointer);
+static gboolean w_keypress(GtkWidget *, GdkEventKey *, gpointer);
+static gboolean w_exit(GtkWidget *, GdkEventAny *, gpointer);
#if __OSX__
static OSErr w_ae_open(const AppleEvent *, AppleEvent *, long);
static OSErr w_ae_quit(const AppleEvent *, AppleEvent *, long);
@@ -102,22 +77,20 @@ static OSErr w_ae_quit(const AppleEvent *, AppleEvent *, long);
GtkWidget *findbox, *find_entry, *replace_entry, *fnext_button, *fprev_button,
*r_button, *ra_button, *match_case_opt, *whole_word_opt, *lua_opt,
*in_files_opt, *flabel, *rlabel;
-GtkWidget *find_create_ui();
GtkListStore *find_store, *repl_store;
-
-static void find_button_clicked(GtkWidget *, gpointer);
+static GtkWidget *new_findbox();
+static void f_clicked(GtkWidget *, gpointer);
// Command Entry
GtkWidget *command_entry;
GtkListStore *cc_store;
GtkEntryCompletion *command_entry_completion;
-
-static int cc_match_func(GtkEntryCompletion *, const char *, GtkTreeIter *,
- gpointer);
-static gbool cc_match_selected(GtkEntryCompletion *, GtkTreeModel *,
- GtkTreeIter *, gpointer);
-static void c_activated(GtkWidget *, gpointer);
-static gbool c_keypress(GtkWidget *, GdkEventKey *, gpointer);
+static int cc_matchfunc(GtkEntryCompletion *, const char *, GtkTreeIter *,
+ gpointer);
+static gboolean cc_matchselected(GtkEntryCompletion *, GtkTreeModel *,
+ GtkTreeIter *, gpointer);
+static void c_activate(GtkWidget *, gpointer);
+static gboolean c_keypress(GtkWidget *, GdkEventKey *, gpointer);
// Lua
lua_State *lua;
@@ -125,42 +98,40 @@ int closing = FALSE;
char *statusbar_text = 0;
static int tVOID = 0, tINT = 1, tLENGTH = 2, /*tPOSITION = 3, tCOLOUR = 4,*/
tBOOL = 5, tKEYMOD = 6, tSTRING = 7, tSTRINGRESULT = 8;
-
-int l_init(int, char **, int);
-void l_close();
-int l_load_script(const char *);
-void l_add_view(GtkWidget *);
-void l_remove_view(GtkWidget *);
-void l_set_view_global(GtkWidget *);
-int l_add_buffer(sptr_t);
-void l_remove_buffer(sptr_t);
-void l_goto_buffer(GtkWidget *, int, int);
-void l_set_buffer_global(GtkWidget *);
-int l_emit_event(const char *, ...);
-void l_emit_scnotification(struct SCNotification *);
-void l_gui_popup_context_menu(GdkEventButton *);
-// Extra Lua libraries.
-LUALIB_API int (luaopen_lpeg) (lua_State *L);
-LUALIB_API int (luaopen_lfs) (lua_State *L);
-
-static void clear_table(lua_State *, int);
-static int l_buffer_mt_index(lua_State *), l_buffer_mt_newindex(lua_State *),
- l_bufferp_mt_index(lua_State *), l_bufferp_mt_newindex(lua_State *),
- l_view_mt_index(lua_State *), l_view_mt_newindex(lua_State *),
- l_gui_mt_index(lua_State *), l_gui_mt_newindex(lua_State *),
- l_find_mt_index(lua_State *), l_find_mt_newindex(lua_State *),
- l_ce_mt_index(lua_State *), l_ce_mt_newindex(lua_State *);
-static int l_cf_buffer_delete(lua_State *), l_cf_buffer_text_range(lua_State *),
- l_cf_view_focus(lua_State *), l_cf_view_split(lua_State *),
- l_cf_view_unsplit(lua_State *), l_cf_buffer_new(lua_State *),
- l_cf_gui_dialog(lua_State *), l_cf_gui_get_split_table(lua_State *),
- l_cf_gui_goto_view(lua_State *), l_cf_view_goto_buffer(lua_State *),
- l_cf_gui_gtkmenu(lua_State *), l_cf_string_iconv(lua_State *),
- l_cf_reset(lua_State *), l_cf_quit(lua_State *),
- l_cf_find_focus(lua_State *), l_cf_find_next(lua_State *),
- l_cf_find_prev(lua_State *), l_cf_find_replace(lua_State *),
- l_cf_find_replace_all(lua_State *), l_cf_ce_focus(lua_State *),
- l_cf_ce_show_completions(lua_State *), l_cf_timeout(lua_State *);
+static int lL_init(lua_State *, int, char **, int);
+static void l_close(lua_State *);
+static int lL_dofile(lua_State *, const char *);
+static void lL_addview(lua_State *, GtkWidget *);
+static void lL_removeview(lua_State *, GtkWidget *);
+static void lL_adddoc(lua_State *, sptr_t);
+static void lL_removedoc(lua_State *, sptr_t);
+static void lL_gotodoc(lua_State *, GtkWidget *, int, int);
+static int lL_event(lua_State *, const char *, ...);
+static void lL_notify(lua_State *, struct SCNotification *);
+static void lL_showcontextmenu(lua_State *, GdkEventButton *);
+static void lL_cleartable(lua_State *, int);
+static void l_pushview(lua_State *, GtkWidget *);
+static void l_pushdoc(lua_State *, sptr_t);
+#define l_setglobalview(l, v) (l_pushview(l, v), lua_setglobal(l, "view"))
+#define l_setglobaldoc(l, d) (l_pushdoc(l, d), lua_setglobal(l, "buffer"))
+LUALIB_API int (luaopen_lpeg) (lua_State *);
+LUALIB_API int (luaopen_lfs) (lua_State *);
+static int lbuf_property(lua_State *),
+ lview__index(lua_State *), lview__newindex(lua_State *),
+ lgui__index(lua_State *), lgui__newindex(lua_State *),
+ lfind__index(lua_State *), lfind__newindex(lua_State *),
+ lce__index(lua_State *), lce__newindex(lua_State *),
+ lbuffer_check_global(lua_State *), lbuffer_delete(lua_State *),
+ lbuffer_new(lua_State *), lbuffer_text_range(lua_State *),
+ lview_split(lua_State *), lview_unsplit(lua_State *),
+ lgui_dialog(lua_State *), lgui_get_split_table(lua_State *),
+ lgui_goto_view(lua_State *), lview_goto_buffer(lua_State *),
+ lgui_gtkmenu(lua_State *), lstring_iconv(lua_State *),
+ lquit(lua_State *), lreset(lua_State *), ltimeout(lua_State *),
+ lfind_focus(lua_State *), lfind_next(lua_State *),
+ lfind_prev(lua_State *), lfind_replace(lua_State *),
+ lfind_replace_all(lua_State *),
+ lce_focus(lua_State *), lce_show_completions(lua_State *);
/******************************************************************************/
/******************************* GUI Interface ********************************/
@@ -168,8 +139,8 @@ static int l_cf_buffer_delete(lua_State *), l_cf_buffer_text_range(lua_State *),
/**
* Runs Textadept in Linux or Mac.
- * Inits the Lua State, creates the user interface, loads the core/init.lua
- * script, and also loads init.lua.
+ * Inits the Lua state, creates the user interface, and then runs core/init.lua
+ * followed by init.lua.
* @param argc The number of command line params.
* @param argv The array of command line params.
*/
@@ -182,8 +153,7 @@ int main(int argc, char **argv) {
CFStringRef path = CFURLCopyFileSystemPath(bundle, kCFURLPOSIXPathStyle);
const char *p = CFStringGetCStringPtr(path, kCFStringEncodingMacRoman);
textadept_home = g_strconcat(p, "/Contents/Resources/", NULL);
- CFRelease(path);
- CFRelease(bundle);
+ CFRelease(path), CFRelease(bundle);
} else textadept_home = calloc(1, 1);
#elif __BSD__
textadept_home = malloc(FILENAME_MAX);
@@ -194,9 +164,9 @@ int main(int argc, char **argv) {
char *last_slash = strrchr(textadept_home, G_DIR_SEPARATOR);
if (last_slash) *last_slash = '\0';
gtk_init(&argc, &argv);
- if (!l_init(argc, argv, FALSE)) return 1;
- create_ui();
- l_load_script("init.lua");
+ if (lua = lua_open(), !lL_init(lua, argc, argv, FALSE)) return 1;
+ new_window();
+ lL_dofile(lua, "init.lua");
gtk_main();
free(textadept_home);
return 0;
@@ -207,8 +177,7 @@ int main(int argc, char **argv) {
* Runs Textadept in Windows.
* @see main
*/
-int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
- LPSTR lpCmdLine, int nCmdShow) {
+int WINAPI WinMain(HINSTANCE _, HINSTANCE __, LPSTR lpCmdLine, int ___) {
textadept_home = malloc(FILENAME_MAX);
GetModuleFileName(0, textadept_home, FILENAME_MAX);
return main(1, &lpCmdLine);
@@ -216,17 +185,12 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
#endif
/**
- * Creates the user interface.
- * The UI consists of:
- * - A menubar initially hidden and empty. It should be populated by script
- * and then shown.
- * - A frame for Scintilla views.
- * - A find text frame initially hidden.
- * - A command entry initially hidden. This entry accepts and runs Lua code
- * in the current Lua state.
- * - Two status bars: one for notifications, the other for document status.
+ * Creates the Textadept window.
+ * The window contains a menubar, frame for Scintilla views, hidden find box,
+ * hidden command entry, and two status bars: one for notifications and the
+ * other for buffer status.
*/
-void create_ui() {
+static void new_window() {
GList *icon_list = NULL;
const char *icons[] = { "16x16", "32x32", "48x48", "64x64", "128x128" };
for (int i = 0; i < 5; i++) {
@@ -266,18 +230,18 @@ void create_ui() {
GtkWidget *view = new_view(0);
gtk_box_pack_start(GTK_BOX(hbox), view, TRUE, TRUE, 0);
- GtkWidget *find = find_create_ui();
+ GtkWidget *find = new_findbox();
gtk_box_pack_start(GTK_BOX(vbox), find, FALSE, FALSE, 5);
command_entry = gtk_entry_new();
gtk_widget_set_name(command_entry, "textadept-command-entry");
- signal(command_entry, "activate", c_activated);
+ signal(command_entry, "activate", c_activate);
signal(command_entry, "key-press-event", c_keypress);
gtk_box_pack_start(GTK_BOX(vbox), command_entry, FALSE, FALSE, 0);
command_entry_completion = gtk_entry_completion_new();
- signal(command_entry_completion, "match-selected", cc_match_selected);
- gtk_entry_completion_set_match_func(command_entry_completion, cc_match_func,
+ signal(command_entry_completion, "match-selected", cc_matchselected);
+ gtk_entry_completion_set_match_func(command_entry_completion, cc_matchfunc,
NULL, NULL);
gtk_entry_completion_set_popup_set_width(command_entry_completion, FALSE);
gtk_entry_completion_set_text_column(command_entry_completion, 0);
@@ -306,96 +270,86 @@ void create_ui() {
gtk_widget_hide(menubar); // hide initially
gtk_widget_hide(findbox); // hide initially
gtk_widget_hide(command_entry); // hide initially
- gtk_widget_grab_focus(view);
}
/**
* Creates a new Scintilla view.
- * The Scintilla view is the GTK widget that displays a Scintilla buffer.
* Generates a 'view_new' event.
- * @param buffer_id A Scintilla buffer ID to load into the new window. If NULL,
- * creates a new Scintilla buffer and loads it into the new window.
- * @return the Scintilla view.
- * @see l_add_view
+ * @param doc The document to load in the new view. Almost never zero, except
+ * for the first Scintilla view created, in which there is no doc pointer.
+ * @return Scintilla view
+ * @see lL_addview
*/
-GtkWidget *new_view(sptr_t buffer_id) {
+static GtkWidget *new_view(sptr_t doc) {
GtkWidget *view = scintilla_new();
gtk_widget_set_size_request(view, 1, 1); // minimum size
SS(view, SCI_USEPOPUP, 0, 0);
- signal(view, SCINTILLA_NOTIFY, s_notification);
+ signal(view, SCINTILLA_NOTIFY, s_notify);
signal(view, "command", s_command);
signal(view, "key-press-event", s_keypress);
signal(view, "button-press-event", s_buttonpress);
- l_add_view(view);
+ lL_addview(lua, view);
gtk_widget_grab_focus(view);
focused_view = view;
- if (buffer_id) {
- SS(view, SCI_SETDOCPOINTER, 0, buffer_id);
- l_set_buffer_global(view);
- } else new_buffer(view, FALSE, TRUE);
- l_set_view_global(view);
- l_emit_event("view_new", -1);
+ if (doc) {
+ SS(view, SCI_SETDOCPOINTER, 0, doc);
+ l_setglobaldoc(lua, doc);
+ } else new_buffer(SS(view, SCI_GETDOCPOINTER, 0, 0));
+ l_setglobalview(lua, view);
+ lL_event(lua, "view_new", -1);
return view;
}
/**
* Removes a Scintilla view.
* @param view The Scintilla view to remove.
- * @see l_remove_view
+ * @see lL_removeview
*/
-void remove_view(GtkWidget *view) {
- l_remove_view(view);
+static void delete_view(GtkWidget *view) {
+ lL_removeview(lua, view);
gtk_widget_destroy(view);
}
/**
- * Creates a new Scintilla buffer for a newly created Scintilla view.
- * Generates a 'buffer_new' event.
- * @param view The Scintilla view to associate the buffer with.
- * @param create Flag indicating whether or not to create a buffer. If FALSE,
- * the Scintilla view already has a buffer associated with it (typically
- * because new_view was passed a non-NULL buffer_id).
- * @param addref Flag indicating whether or not to add a reference to the buffer
- * in the Scintilla view when create is FALSE. This is necessary for creating
- * Scintilla views in split views. If a buffer appears in two separate
- * Scintilla views, that buffer should have multiple references so when one
- * Scintilla view closes, the buffer is not deleted because its reference
- * count is not zero.
- * @see l_add_buffer
+ * Creates a new Scintilla document and adds it to the Lua state.
+ * Generates 'buffer_before_switch' and 'buffer_new' events.
+ * @param doc Almost always zero, except for the first Scintilla view created,
+ * in which its doc pointer would be given here.
+ * @see lL_adddoc
*/
-void new_buffer(GtkWidget *view, int create, int addref) {
- sptr_t doc;
- doc = SS(view, SCI_GETDOCPOINTER, 0, 0);
- if (create) { // create the new document
- doc = SS(view, SCI_CREATEDOCUMENT, 0, 0);
- l_emit_event("buffer_before_switch", -1);
- l_goto_buffer(focused_view, l_add_buffer(doc), TRUE);
- } else if (addref) {
- l_add_buffer(doc);
- SS(view, SCI_ADDREFDOCUMENT, 0, doc);
+static void new_buffer(sptr_t doc) {
+ if (!doc) { // create the new document
+ doc = SS(focused_view, SCI_CREATEDOCUMENT, 0, 0);
+ lL_event(lua, "buffer_before_switch", -1);
+ lL_adddoc(lua, doc);
+ lL_gotodoc(lua, focused_view, -1, FALSE);
+ } else {
+ // The first Scintilla window already has a pre-created buffer.
+ lL_adddoc(lua, doc);
+ SS(focused_view, SCI_ADDREFDOCUMENT, 0, doc);
}
- l_set_buffer_global(view);
- l_emit_event("buffer_new", -1);
+ l_setglobaldoc(lua, doc);
+ lL_event(lua, "buffer_new", -1);
}
/**
* Removes the Scintilla buffer from the current Scintilla view.
- * @param doc The Scintilla buffer ID to remove.
- * @see l_remove_buffer
+ * @param doc The Scintilla document.
+ * @see lL_removedoc
*/
-void remove_buffer(sptr_t doc) {
- l_remove_buffer(doc);
+static void delete_buffer(sptr_t doc) {
+ lL_removedoc(lua, doc);
SS(focused_view, SCI_RELEASEDOCUMENT, 0, doc);
}
/**
- * Splits a Scintilla view into two windows separated by a GTK pane.
- * The buffer in the original pane is also shown in the new pane.
+ * Splits the given Scintilla view into two views.
+ * The new view shows the same document as the original one.
* @param view The Scintilla view to split.
- * @param vertical Flag indicating whether to split the window vertically or
+ * @param vertical Flag indicating whether to split the view vertically or
* horozontally.
*/
-void split_view(GtkWidget *view, int vertical) {
+static void split_view(GtkWidget *view, int vertical) {
g_object_ref(view);
int first_line = SS(view, SCI_GETFIRSTVISIBLELINE, 0, 0);
int current_pos = SS(view, SCI_GETCURRENTPOS, 0, 0);
@@ -405,53 +359,50 @@ void split_view(GtkWidget *view, int vertical) {
int middle = (vertical ? allocation.width : allocation.height) / 2;
sptr_t curdoc = SS(view, SCI_GETDOCPOINTER, 0, 0);
- GtkWidget *newview = new_view(curdoc);
+ GtkWidget *view2 = new_view(curdoc);
GtkWidget *parent = gtk_widget_get_parent(view);
gtk_container_remove(GTK_CONTAINER(parent), view);
GtkWidget *pane = vertical ? gtk_hpaned_new() : gtk_vpaned_new();
- gtk_paned_add1(GTK_PANED(pane), view);
- gtk_paned_add2(GTK_PANED(pane), newview);
+ gtk_paned_add1(GTK_PANED(pane), view), gtk_paned_add2(GTK_PANED(pane), view2);
gtk_container_add(GTK_CONTAINER(parent), pane);
gtk_paned_set_position(GTK_PANED(pane), middle);
gtk_widget_show_all(pane);
- gtk_widget_grab_focus(newview);
+ gtk_widget_grab_focus(view2);
- SS(newview, SCI_SETSEL, anchor, current_pos);
- int new_first_line = SS(newview, SCI_GETFIRSTVISIBLELINE, 0, 0);
- SS(newview, SCI_LINESCROLL, first_line - new_first_line, 0);
+ SS(view2, SCI_SETSEL, anchor, current_pos);
+ int new_first_line = SS(view2, SCI_GETFIRSTVISIBLELINE, 0, 0);
+ SS(view2, SCI_LINESCROLL, first_line - new_first_line, 0);
g_object_unref(view);
}
/**
- * For a given GTK pane, remove the Scintilla views inside it recursively.
+ * Remove all Scintilla views from the given pane and delete them.
* @param pane The GTK pane to remove Scintilla views from.
- * @see remove_view
+ * @see delete_view
*/
-void remove_views_in_pane(GtkWidget *pane) {
+static void remove_views_from_pane(GtkWidget *pane) {
GtkWidget *child1 = gtk_paned_get_child1(GTK_PANED(pane));
GtkWidget *child2 = gtk_paned_get_child2(GTK_PANED(pane));
- GTK_IS_PANED(child1) ? remove_views_in_pane(child1) : remove_view(child1);
- GTK_IS_PANED(child2) ? remove_views_in_pane(child2) : remove_view(child2);
+ GTK_IS_PANED(child1) ? remove_views_from_pane(child1) : delete_view(child1);
+ GTK_IS_PANED(child2) ? remove_views_from_pane(child2) : delete_view(child2);
}
/**
- * Unsplits the pane a given Scintilla view is in and keeps that window.
- * If the pane to discard contains other Scintilla views, they are removed
- * recursively.
+ * Unsplits the pane a given Scintilla view is in and keeps the view.
+ * All views in the other pane are deleted.
* @param view The Scintilla view to keep when unsplitting.
- * @see remove_views_in_pane
- * @see remove_view
+ * @see remove_views_from_pane
+ * @see delete_view
*/
-int unsplit_view(GtkWidget *view) {
+static int unsplit_view(GtkWidget *view) {
GtkWidget *pane = gtk_widget_get_parent(view);
if (!GTK_IS_PANED(pane)) return FALSE;
GtkWidget *other = gtk_paned_get_child1(GTK_PANED(pane));
if (other == view) other = gtk_paned_get_child2(GTK_PANED(pane));
- g_object_ref(view);
- g_object_ref(other);
+ g_object_ref(view), g_object_ref(other);
gtk_container_remove(GTK_CONTAINER(pane), view);
gtk_container_remove(GTK_CONTAINER(pane), other);
- GTK_IS_PANED(other) ? remove_views_in_pane(other) : remove_view(other);
+ GTK_IS_PANED(other) ? remove_views_from_pane(other) : delete_view(other);
GtkWidget *parent = gtk_widget_get_parent(pane);
gtk_container_remove(GTK_CONTAINER(parent), pane);
if (GTK_IS_PANED(parent)) {
@@ -462,73 +413,40 @@ int unsplit_view(GtkWidget *view) {
} else gtk_container_add(GTK_CONTAINER(parent), view);
gtk_widget_show_all(parent);
gtk_widget_grab_focus(GTK_WIDGET(view));
- g_object_unref(view);
- g_object_unref(other);
+ g_object_unref(view), g_object_unref(other);
return TRUE;
}
-/**
- * Sets a user-defined GTK menubar and displays it.
- * @param new_menubar The GTK menubar.
- * @see l_gui_mt_newindex
- */
-void set_menubar(GtkWidget *new_menubar) {
- GtkWidget *vbox = gtk_widget_get_parent(menubar);
- gtk_container_remove(GTK_CONTAINER(vbox), menubar);
- menubar = new_menubar;
- gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, FALSE, 0);
- gtk_box_reorder_child(GTK_BOX(vbox), menubar, 0);
- gtk_widget_show_all(menubar);
-#if __OSX__
- ige_mac_menu_set_menu_bar(GTK_MENU_SHELL(menubar));
- gtk_widget_hide(menubar);
-#endif
-}
-
-/**
- * Sets the notification statusbar text.
- * @param text The text to display.
- * @param bar Statusbar. 0 for statusbar, 1 for docstatusbar.
- */
-void set_statusbar_text(const char *text, int bar) {
- if (!statusbar[0] || !statusbar[1]) return; // unavailable on startup
- gtk_statusbar_pop(GTK_STATUSBAR(statusbar[bar]), 0);
- gtk_statusbar_push(GTK_STATUSBAR(statusbar[bar]), 0, text);
-}
-
/******************************************************************************/
/************************* GUI Notifications/Signals **************************/
/******************************************************************************/
/**
- * Helper function for switching the focused view to the given one.
+ * Change focus to the given Scintilla view.
+ * Generates 'view_before_switch' and 'view_after_switch' events.
* @param view The Scintilla view to focus.
- * @see s_notification
- * @see s_command
- * @see l_goto_view
*/
-static void switch_to_view(GtkWidget *view) {
- if (!closing) l_emit_event("view_before_switch", -1);
+static void goto_view(GtkWidget *view) {
+ if (!closing) lL_event(lua, "view_before_switch", -1);
focused_view = view;
- l_set_view_global(view);
- l_set_buffer_global(view);
- if (!closing) l_emit_event("view_after_switch", -1);
+ l_setglobalview(lua, view);
+ l_setglobaldoc(lua, SS(view, SCI_GETDOCPOINTER, 0, 0));
+ if (!closing) lL_event(lua, "view_after_switch", -1);
}
/**
* Signal for a Scintilla notification.
*/
-static void s_notification(GtkWidget *view, gint wParam, gpointer lParam,
- gpointer udata) {
+static void s_notify(GtkWidget *view, gint _, gpointer lParam, gpointer __) {
struct SCNotification *n = (struct SCNotification *)lParam;
if (focused_view == view || n->nmhdr.code == SCN_URIDROPPED) {
- if (focused_view != view) switch_to_view(view);
- l_emit_scnotification(n);
+ if (focused_view != view) goto_view(view);
+ lL_notify(lua, n);
} else if (n->nmhdr.code == SCN_SAVEPOINTLEFT) {
GtkWidget *prev = focused_view;
- switch_to_view(view);
- l_emit_scnotification(n);
- switch_to_view(prev); // do not let a split view steal focus
+ goto_view(view);
+ lL_notify(lua, n);
+ goto_view(prev); // do not let a split view steal focus
}
}
@@ -536,35 +454,34 @@ static void s_notification(GtkWidget *view, gint wParam, gpointer lParam,
* Signal for a Scintilla command.
* Currently handles SCEN_SETFOCUS.
*/
-static void s_command(GtkWidget *view, gint wParam, gpointer lParam,
- gpointer udata) {
- if (wParam >> 16 == SCEN_SETFOCUS) switch_to_view(view);
+static void s_command(GtkWidget *view, gint wParam, gpointer _, gpointer __) {
+ if (wParam >> 16 == SCEN_SETFOCUS) goto_view(view);
}
/**
* Signal for a Scintilla keypress.
- * Collects the modifier states as flags and calls Lua to handle the keypress.
*/
-static gbool s_keypress(GtkWidget *view, GdkEventKey *event, gpointer udata) {
- return l_emit_event_key("keypress", event) ? TRUE : FALSE;
+static gboolean s_keypress(GtkWidget *view, GdkEventKey *event, gpointer _) {
+ return lL_event(lua, "keypress", LUA_TNUMBER, event->keyval, LUA_TBOOLEAN,
+ event->state & GDK_SHIFT_MASK, LUA_TBOOLEAN,
+ event->state & GDK_CONTROL_MASK, LUA_TBOOLEAN,
+ event->state & GDK_MOD1_MASK, LUA_TBOOLEAN,
+ event->state & GDK_MOD5_MASK, -1);
}
/**
* Signal for a Scintilla mouse click.
- * If it is a right-click, popup a context menu.
- * @see l_gui_popup_context_menu
*/
-static gbool s_buttonpress(GtkWidget *view, GdkEventButton *event,
- gpointer udata) {
- if (event->type != GDK_BUTTON_PRESS || event->button != 3) return FALSE;
- l_gui_popup_context_menu(event);
- return TRUE;
+static gboolean s_buttonpress(GtkWidget*_, GdkEventButton *event, gpointer __) {
+ if (event->type == GDK_BUTTON_PRESS && event->button == 3)
+ return (lL_showcontextmenu(lua, event), TRUE);
+ return FALSE;
}
/**
* Signal for a Textadept window focus change.
*/
-static gbool w_focus(GtkWidget *window, GdkEventFocus *event, gpointer udata) {
+static gboolean w_focus(GtkWidget*_, GdkEventFocus *event, gpointer __) {
if (focused_view && !gtk_widget_has_focus(focused_view))
gtk_widget_grab_focus(focused_view);
return FALSE;
@@ -573,9 +490,9 @@ static gbool w_focus(GtkWidget *window, GdkEventFocus *event, gpointer udata) {
/**
* Signal for a Textadept keypress.
* Currently handled keypresses:
- * - Escape - hides the search frame if it's open.
+ * - Escape: hides the find box if it is open.
*/
-static gbool w_keypress(GtkWidget *window, GdkEventKey *event, gpointer udata) {
+static gboolean w_keypress(GtkWidget*_, GdkEventKey *event, gpointer __) {
if (event->keyval == 0xff1b && gtk_widget_get_visible(findbox) &&
!gtk_widget_has_focus(command_entry)) {
gtk_widget_hide(findbox);
@@ -586,13 +503,13 @@ static gbool w_keypress(GtkWidget *window, GdkEventKey *event, gpointer udata) {
/**
* Signal for exiting Textadept.
- * Closes the Lua State and releases resources.
* Generates a 'quit' event.
+ * Closes the Lua state and releases resources.
* @see l_close
*/
-static gbool w_exit(GtkWidget *window, GdkEventAny *event, gpointer udata) {
- if (!l_emit_event("quit", -1)) return TRUE;
- l_close();
+static gboolean w_exit(GtkWidget*_, GdkEventAny*__, gpointer ___) {
+ if (!lL_event(lua, "quit", -1)) return TRUE;
+ l_close(lua);
scintilla_release_resources();
gtk_main_quit();
return FALSE;
@@ -601,9 +518,9 @@ static gbool w_exit(GtkWidget *window, GdkEventAny *event, gpointer udata) {
#if __OSX__
/**
* Signal for an Open Document AppleEvent.
- * Generates a 'appleevent_odoc' event for each document sent.
+ * Generates an 'appleevent_odoc' event for each document sent.
*/
-static OSErr w_ae_open(const AppleEvent *event, AppleEvent *reply, long ref) {
+static OSErr w_ae_open(const AppleEvent *event, AppleEvent*_, long __) {
AEDescList file_list;
if (AEGetParamDesc(event, keyDirectObject, typeAEList, &file_list) == noErr) {
long count = 0;
@@ -616,9 +533,8 @@ static OSErr w_ae_open(const AppleEvent *event, AppleEvent *reply, long ref) {
if (url) {
CFStringRef path = CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle);
const char *p = CFStringGetCStringPtr(path, kCFStringEncodingMacRoman);
- l_emit_event("appleevent_odoc", LUA_TSTRING, p, -1);
- CFRelease(path);
- CFRelease(url);
+ lL_event(lua, "appleevent_odoc", LUA_TSTRING, p, -1);
+ CFRelease(path), CFRelease(url);
}
}
AEDisposeDesc(&file_list);
@@ -628,10 +544,8 @@ static OSErr w_ae_open(const AppleEvent *event, AppleEvent *reply, long ref) {
/**
* Signal for a Quit Application AppleEvent.
- * Calls the signal for exiting Textadept.
- * @see w_exit
*/
-static OSErr w_ae_quit(const AppleEvent *event, AppleEvent *reply, long ref) {
+static OSErr w_ae_quit(const AppleEvent*_, AppleEvent*__, long ___) {
return w_exit(NULL, NULL, NULL) ? (OSErr) noErr : errAEEventNotHandled;
}
#endif
@@ -644,11 +558,10 @@ static OSErr w_ae_quit(const AppleEvent *event, AppleEvent *reply, long ref) {
gtk_table_attach(GTK_TABLE(findbox), w, x1, x2, y1, y2, xo, yo, xp, yp)
#define ao_expand (GtkAttachOptions)(GTK_EXPAND | GTK_FILL)
#define ao_normal (GtkAttachOptions)(GTK_SHRINK | GTK_FILL)
-
/**
- * Creates the Find/Replace text frame.
+ * Creates the Find box.
*/
-GtkWidget *find_create_ui() {
+static GtkWidget *new_findbox() {
findbox = gtk_table_new(2, 6, FALSE);
find_store = gtk_list_store_new(1, G_TYPE_STRING);
repl_store = gtk_list_store_new(1, G_TYPE_STRING);
@@ -696,10 +609,10 @@ GtkWidget *find_create_ui() {
attach(lua_opt, 5, 6, 0, 1, ao_normal, ao_normal, 5, 0);
attach(in_files_opt, 5, 6, 1, 2, ao_normal, ao_normal, 5, 0);
- signal(fnext_button, "clicked", find_button_clicked);
- signal(fprev_button, "clicked", find_button_clicked);
- signal(r_button, "clicked", find_button_clicked);
- signal(ra_button, "clicked", find_button_clicked);
+ signal(fnext_button, "clicked", f_clicked);
+ signal(fprev_button, "clicked", f_clicked);
+ signal(r_button, "clicked", f_clicked);
+ signal(ra_button, "clicked", f_clicked);
gtk_widget_set_can_default(fnext_button, TRUE);
gtk_widget_set_can_focus(fnext_button, FALSE);
@@ -714,24 +627,12 @@ GtkWidget *find_create_ui() {
return findbox;
}
-/**
- * Toggles the focus between the Find/Replace frame and the current Scintilla
- * window.
- */
-void find_toggle_focus() {
- if (!gtk_widget_has_focus(findbox)) {
- gtk_widget_show(findbox);
- gtk_widget_grab_focus(find_entry);
- gtk_widget_grab_default(fnext_button);
- } else {
- gtk_widget_grab_focus(focused_view);
- gtk_widget_hide(findbox);
- }
-}
+/******************************************************************************/
+/**************************** Find/Replace Signals ****************************/
+/******************************************************************************/
/**
- * Adds the given text to the Find/Replace history list if it's not the first
- * item.
+ * Adds the given text to the find/replace history list if it is not at the top.
* @param text The text to add.
* @param store The GtkListStore to add the text to.
*/
@@ -750,30 +651,25 @@ static void find_add_to_history(const char *text, GtkListStore *store) {
}
}
-/******************************************************************************/
-/**************************** Find/Replace Signals ****************************/
-/******************************************************************************/
-
/**
- * Signal for a Find frame button click.
- * Performs the appropriate action depending on the button clicked.
+ * Signal for a find box button click.
*/
-static void find_button_clicked(GtkWidget *button, gpointer udata) {
+static void f_clicked(GtkWidget *button, gpointer _) {
const char *find_text = gtk_entry_get_text(GTK_ENTRY(find_entry));
const char *repl_text = gtk_entry_get_text(GTK_ENTRY(replace_entry));
if (strlen(find_text) == 0) return;
if (button == fnext_button || button == fprev_button) {
find_add_to_history(find_text, find_store);
- l_emit_event("find", LUA_TSTRING, find_text, LUA_TBOOLEAN,
- button == fnext_button, -1);
+ lL_event(lua, "find", LUA_TSTRING, find_text, LUA_TBOOLEAN,
+ button == fnext_button, -1);
} else {
find_add_to_history(repl_text, repl_store);
if (button == r_button) {
- l_emit_event("replace", LUA_TSTRING, repl_text, -1);
- l_emit_event("find", LUA_TSTRING, find_text, LUA_TBOOLEAN, 1, -1);
+ lL_event(lua, "replace", LUA_TSTRING, repl_text, -1);
+ lL_event(lua, "find", LUA_TSTRING, find_text, LUA_TBOOLEAN, 1, -1);
} else
- l_emit_event("replace_all", LUA_TSTRING, find_text, LUA_TSTRING,
- repl_text, -1);
+ lL_event(lua, "replace_all", LUA_TSTRING, find_text, LUA_TSTRING,
+ repl_text, -1);
}
}
@@ -782,49 +678,29 @@ static void find_button_clicked(GtkWidget *button, gpointer udata) {
/******************************************************************************/
/**
- * Toggles focus between a Scintilla view and the Command Entry.
- * When the entry is visible, the statusbars are temporarily hidden.
- */
-void ce_toggle_focus() {
- if (!gtk_widget_has_focus(command_entry)) {
- gtk_widget_show(command_entry);
- gtk_widget_grab_focus(command_entry);
- } else {
- gtk_widget_hide(command_entry);
- gtk_widget_grab_focus(focused_view);
- }
-}
-
-/**
- * Sets every item in the Command Entry Model to be a match.
- * For each attempted completion, the Command Entry Model is filled with the
- * results from a call to Lua to make a list of possible completions. Therefore,
- * every item in the list is valid.
+ * The match function for the command entry.
+ * Since the completion list is filled by Lua, every item is a "match".
*/
-static int cc_match_func(GtkEntryCompletion *entry, const char *key,
- GtkTreeIter *iter, gpointer udata) { return 1; }
+static int cc_matchfunc(GtkEntryCompletion*_, const char *__, GtkTreeIter*___,
+ gpointer ____) { return 1; }
/**
- * Enters the requested completion text into the Command Entry.
- * The last word at the cursor is replaced with the completion. A word consists
- * of any alphanumeric character or underscore.
+ * Replaces the current word (consisting of alphanumeric and underscore
+ * characters) with the match text.
*/
-static gbool cc_match_selected(GtkEntryCompletion *entry, GtkTreeModel *model,
- GtkTreeIter *iter, gpointer udata) {
- const char *entry_text = gtk_entry_get_text(GTK_ENTRY(command_entry));
- const char *p = entry_text + strlen(entry_text) - 1;
- while (g_ascii_isalnum(*p) || *p == '_') {
+static gboolean cc_matchselected(GtkEntryCompletion*_, GtkTreeModel *model,
+ GtkTreeIter *iter, gpointer __) {
+ const char *text = gtk_entry_get_text(GTK_ENTRY(command_entry)), *p;
+ for (p = text + strlen(text) - 1; g_ascii_isalnum(*p) || *p == '_'; p--)
g_signal_emit_by_name(G_OBJECT(command_entry), "move-cursor",
GTK_MOVEMENT_VISUAL_POSITIONS, -1, TRUE, 0);
- p--;
- }
- if (p < entry_text + strlen(entry_text) - 1)
+ if (p < text + strlen(text) - 1)
g_signal_emit_by_name(G_OBJECT(command_entry), "backspace", 0);
- char *text;
- gtk_tree_model_get(model, iter, 0, &text, -1);
- g_signal_emit_by_name(G_OBJECT(command_entry), "insert-at-cursor", text, 0);
- g_free(text);
+ char *match;
+ gtk_tree_model_get(model, iter, 0, &match, -1);
+ g_signal_emit_by_name(G_OBJECT(command_entry), "insert-at-cursor", match, 0);
+ g_free(match);
gtk_list_store_clear(cc_store);
return TRUE;
@@ -837,411 +713,328 @@ static gbool cc_match_selected(GtkEntryCompletion *entry, GtkTreeModel *model,
/**
* Signal for the 'enter' key being pressed in the Command Entry.
*/
-static void c_activated(GtkWidget *entry, gpointer udata) {
- l_emit_event("command_entry_command", LUA_TSTRING,
- gtk_entry_get_text(GTK_ENTRY(entry)), -1);
+static void c_activate(GtkWidget *entry, gpointer _) {
+ lL_event(lua, "command_entry_command", LUA_TSTRING,
+ gtk_entry_get_text(GTK_ENTRY(entry)), -1);
}
/**
* Signal for a keypress inside the Command Entry.
*/
-static gbool c_keypress(GtkWidget *entry, GdkEventKey *event, gpointer udata) {
- return l_emit_event_key("command_entry_keypress", event);
+static gboolean c_keypress(GtkWidget*_, GdkEventKey *event, gpointer __) {
+ return lL_event(lua, "command_entry_keypress", LUA_TNUMBER, event->keyval,
+ LUA_TBOOLEAN, event->state & GDK_SHIFT_MASK, LUA_TBOOLEAN,
+ event->state & GDK_CONTROL_MASK, LUA_TBOOLEAN,
+ event->state & GDK_MOD1_MASK, LUA_TBOOLEAN,
+ event->state & GDK_MOD5_MASK, -1);
}
/******************************************************************************/
/******************************** Lua Interface *******************************/
/******************************************************************************/
-#define l_openlib(l, n, f) { \
- lua_pushcfunction(l, f); \
- lua_pushstring(l, n); \
- lua_call(l, 1, 0); \
-}
-#define l_archive(l, k) { \
- lua_pushstring(l, k); \
- lua_rawget(l, -2); \
- lua_setfield(l, LUA_REGISTRYINDEX, k); \
+#define lL_openlib(l, n, f) \
+ (lua_pushcfunction(l, f), lua_pushstring(l, n), lua_call(l, 1, 0))
+#define l_setcfunction(l, n, k, f) \
+ (lua_pushcfunction(l, f), lua_setfield(l, (n > 0) ? n : n - 1, k))
+#define l_setmetatable(l, n, k, i, ni) { \
+ if (luaL_newmetatable(l, k)) { \
+ l_setcfunction(l, -1, "__index", i); \
+ l_setcfunction(l, -1, "__newindex", ni); \
+ } \
+ lua_setmetatable(l, (n > 0) ? n : n - 1); \
}
/**
- * Inits or re-inits the Lua State.
+ * Initializes or re-initializes the Lua state.
* Populates the state with global variables and functions, then runs the
* 'core/init.lua' script.
* @param argc The number of command line parameters.
* @param argv The array of command line parameters.
- * @param reinit Flag indicating whether or not to reinitialize the Lua State.
- * @return TRUE on success, FALSE on failure.
+ * @param reinit Flag indicating whether or not to reinitialize the Lua state.
+ * @return TRUE on success, FALSE otherwise.
*/
-int l_init(int argc, char **argv, int reinit) {
+static int lL_init(lua_State *L, int argc, char **argv, int reinit) {
if (!reinit) {
- lua = lua_open();
- lua_newtable(lua);
- for (int i = 0; i < argc; i++) {
- lua_pushstring(lua, argv[i]);
- lua_rawseti(lua, -2, i);
- }
- lua_setfield(lua, LUA_REGISTRYINDEX, "arg");
- lua_newtable(lua);
- lua_setfield(lua, LUA_REGISTRYINDEX, "buffers");
- lua_newtable(lua);
- lua_setfield(lua, LUA_REGISTRYINDEX, "views");
+ lua_newtable(L);
+ for (int i = 0; i < argc; i++)
+ lua_pushstring(L, argv[i]), lua_rawseti(L, -2, i);
+ lua_setfield(L, LUA_REGISTRYINDEX, "ta_arg");
+ lua_newtable(L), lua_setfield(L, LUA_REGISTRYINDEX, "ta_buffers");
+ lua_newtable(L), lua_setfield(L, LUA_REGISTRYINDEX, "ta_views");
} else { // clear package.loaded and _G
- lua_getglobal(lua, "package");
- lua_getfield(lua, -1, "loaded");
- clear_table(lua, lua_gettop(lua));
- lua_pop(lua, 2); // package and package.loaded
- clear_table(lua, LUA_GLOBALSINDEX);
+ lua_getglobal(L, "package"), lua_getfield(L, -1, "loaded");
+ lL_cleartable(L, lua_gettop(L));
+ lua_pop(L, 2); // package and package.loaded
+ lL_cleartable(L, LUA_GLOBALSINDEX);
}
- luaL_openlibs(lua);
- l_openlib(lua, "lpeg", luaopen_lpeg);
- l_openlib(lua, "lfs", luaopen_lfs);
-
- lua_newtable(lua);
- lua_newtable(lua);
- l_cfunc(lua, l_cf_find_next, "find_next");
- l_cfunc(lua, l_cf_find_prev, "find_prev");
- l_cfunc(lua, l_cf_find_focus, "focus");
- l_cfunc(lua, l_cf_find_replace, "replace");
- l_cfunc(lua, l_cf_find_replace_all, "replace_all");
- l_mt(lua, "_find_mt", l_find_mt_index, l_find_mt_newindex);
- lua_setfield(lua, -2, "find");
- lua_newtable(lua);
- l_cfunc(lua, l_cf_ce_focus, "focus");
- l_cfunc(lua, l_cf_ce_show_completions, "show_completions");
- l_mt(lua, "_ce_mt", l_ce_mt_index, l_ce_mt_newindex);
- lua_setfield(lua, -2, "command_entry");
- l_cfunc(lua, l_cf_gui_dialog, "dialog");
- l_cfunc(lua, l_cf_gui_get_split_table, "get_split_table");
- l_cfunc(lua, l_cf_gui_goto_view, "goto_view");
- l_cfunc(lua, l_cf_gui_gtkmenu, "gtkmenu");
- l_mt(lua, "_gui_mt", l_gui_mt_index, l_gui_mt_newindex);
- lua_setglobal(lua, "gui");
-
- lua_getglobal(lua, "_G");
- l_cfunc(lua, l_cf_buffer_new, "new_buffer");
- l_cfunc(lua, l_cf_quit, "quit");
- l_cfunc(lua, l_cf_reset, "reset");
- l_cfunc(lua, l_cf_timeout, "timeout");
- lua_pop(lua, 1); // _G
-
- lua_getglobal(lua, "string");
- l_cfunc(lua, l_cf_string_iconv, "iconv");
- lua_pop(lua, 1); // string
-
- lua_getfield(lua, LUA_REGISTRYINDEX, "arg");
- lua_setglobal(lua, "arg");
- lua_getfield(lua, LUA_REGISTRYINDEX, "buffers");
- lua_setglobal(lua, "_BUFFERS");
- lua_getfield(lua, LUA_REGISTRYINDEX, "views");
- lua_setglobal(lua, "_VIEWS");
- lua_pushstring(lua, textadept_home);
- lua_setglobal(lua, "_HOME");
+ luaL_openlibs(L);
+ lL_openlib(L, "lpeg", luaopen_lpeg);
+ lL_openlib(L, "lfs", luaopen_lfs);
+
+ lua_newtable(L);
+ lua_newtable(L);
+ l_setcfunction(L, -1, "find_next", lfind_next);
+ l_setcfunction(L, -1, "find_prev", lfind_prev);
+ l_setcfunction(L, -1, "focus", lfind_focus);
+ l_setcfunction(L, -1, "replace", lfind_replace);
+ l_setcfunction(L, -1, "replace_all", lfind_replace_all);
+ l_setmetatable(L, -1, "ta_find", lfind__index, lfind__newindex);
+ lua_setfield(L, -2, "find");
+ lua_newtable(L);
+ l_setcfunction(L, -1, "focus", lce_focus);
+ l_setcfunction(L, -1, "show_completions", lce_show_completions);
+ l_setmetatable(L, -1, "ta_command_entry", lce__index, lce__newindex);
+ lua_setfield(L, -2, "command_entry");
+ l_setcfunction(L, -1, "dialog", lgui_dialog);
+ l_setcfunction(L, -1, "get_split_table", lgui_get_split_table);
+ l_setcfunction(L, -1, "goto_view", lgui_goto_view);
+ l_setcfunction(L, -1, "gtkmenu", lgui_gtkmenu);
+ l_setmetatable(L, -1, "ta_gui", lgui__index, lgui__newindex);
+ lua_setglobal(L, "gui");
+
+ lua_getglobal(L, "_G");
+ l_setcfunction(L, -1, "new_buffer", lbuffer_new);
+ l_setcfunction(L, -1, "quit", lquit);
+ l_setcfunction(L, -1, "reset", lreset);
+ l_setcfunction(L, -1, "timeout", ltimeout);
+ lua_pop(L, 1); // _G
+
+ lua_getglobal(L, "string");
+ l_setcfunction(L, -1, "iconv", lstring_iconv);
+ lua_pop(L, 1); // string
+
+ lua_getfield(L, LUA_REGISTRYINDEX, "ta_arg"), lua_setglobal(L, "arg");
+ lua_getfield(L, LUA_REGISTRYINDEX, "ta_buffers");
+ lua_setglobal(L, "_BUFFERS");
+ lua_getfield(L, LUA_REGISTRYINDEX, "ta_views"), lua_setglobal(L, "_VIEWS");
+ lua_pushstring(L, textadept_home), lua_setglobal(L, "_HOME");
#if __WIN32__
- lua_pushboolean(lua, 1);
- lua_setglobal(lua, "WIN32");
+ lua_pushboolean(L, 1), lua_setglobal(L, "WIN32");
#elif __OSX__
- lua_pushboolean(lua, 1);
- lua_setglobal(lua, "OSX");
+ lua_pushboolean(L, 1), lua_setglobal(L, "OSX");
#endif
const char *charset = 0;
g_get_charset(&charset);
- lua_pushstring(lua, charset);
- lua_setglobal(lua, "_CHARSET");
-
- if (l_load_script("core/init.lua")) {
- lua_getglobal(lua, "_SCINTILLA");
- l_archive(lua, "constants");
- l_archive(lua, "functions");
- l_archive(lua, "properties");
- lua_pop(lua, 1); // _SCINTILLA
+ lua_pushstring(L, charset), lua_setglobal(L, "_CHARSET");
+
+ if (lL_dofile(L, "core/init.lua")) {
+ lua_getglobal(L, "_SCINTILLA");
+ lua_getfield(L, -1, "constants");
+ lua_setfield(L, LUA_REGISTRYINDEX, "ta_constants");
+ lua_getfield(L, -1, "functions");
+ lua_setfield(L, LUA_REGISTRYINDEX, "ta_functions");
+ lua_getfield(L, -1, "properties");
+ lua_setfield(L, LUA_REGISTRYINDEX, "ta_properties");
+ lua_pop(L, 1); // _SCINTILLA
return TRUE;
}
- lua_close(lua);
+ lua_close(L);
return FALSE;
}
/**
- * Loads and runs a given Lua script.
- * @param script_file The path of the Lua script relative to textadept_home.
- * @return TRUE on success, FALSE otherwise.
+ * Loads and runs the given file.
+ * @param L The Lua state.
+ * @param filename The file name relative to textadept_home.
+ * @return 1 if there are no errors or 0 in case of errors.
*/
-int l_load_script(const char *script_file) {
- char *script = g_strconcat(textadept_home, "/", script_file, NULL);
- int retval = luaL_dofile(lua, script) == 0;
- if (!retval) {
- const char *errmsg = lua_tostring(lua, -1);
- lua_settop(lua, 0);
+static int lL_dofile(lua_State *L, const char *filename) {
+ char *file = g_strconcat(textadept_home, "/", filename, NULL);
+ int ok = (luaL_dofile(L, file) == 0);
+ if (!ok) {
GtkWidget *dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL,
GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK, "%s\n", errmsg);
+ GTK_BUTTONS_OK, "%s\n",
+ lua_tostring(L, -1));
gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);
+ lua_settop(L, 0);
}
- g_free(script);
- return retval;
+ g_free(file);
+ return ok;
}
/**
- * Checks a specified stack element to see if it is a Scintilla view and returns
- * it as a GtkWidget.
- * Throws an error if the check is not satisfied.
- * @param lua The Lua State.
- * @param narg Relative stack index to check for a Scintilla view.
- * @return GtkWidget Scintilla view.
+ * Returns the view at the given acceptable index as a Scintilla view.
+ * @param L The Lua state.
+ * @param index Stack index of the view.
+ * @return Scintilla view
*/
-static GtkWidget *l_checkview(lua_State *lua, int narg) {
- luaL_argcheck(lua, lua_istable(lua, narg), narg, "View expected");
- lua_pushstring(lua, "widget_pointer");
- lua_rawget(lua, (narg > 0) ? narg : narg - 1);
- luaL_argcheck(lua, lua_islightuserdata(lua, -1), narg, "View expected");
- GtkWidget *view = l_togtkwidget(lua, -1);
- lua_pop(lua, 1); // widget_pointer
+static GtkWidget *l_toview(lua_State *L, int index) {
+ lua_getfield(L, index, "widget_pointer");
+ GtkWidget *view = (GtkWidget *)lua_touserdata(L, -1);
+ lua_pop(L, 1); // widget pointer
return view;
}
/**
- * Adds a Scintilla view to the global '_VIEWS' table with a metatable.
+ * Adds the Scintilla view with a metatable to the 'views' registry table.
+ * @param L The Lua state.
* @param view The Scintilla view to add.
*/
-void l_add_view(GtkWidget *view) {
- lua_getfield(lua, LUA_REGISTRYINDEX, "views");
- lua_newtable(lua);
- lua_pushlightuserdata(lua, (GtkWidget *)view);
- lua_setfield(lua, -2, "widget_pointer");
- l_cfunc(lua, l_cf_view_focus, "focus");
- l_cfunc(lua, l_cf_view_goto_buffer, "goto_buffer");
- l_cfunc(lua, l_cf_view_split, "split");
- l_cfunc(lua, l_cf_view_unsplit, "unsplit");
- l_mt(lua, "_view_mt", l_view_mt_index, l_view_mt_newindex);
- l_append(lua, -2); // pops table
- lua_pop(lua, 1); // views
+static void lL_addview(lua_State *L, GtkWidget *view) {
+ lua_getfield(L, LUA_REGISTRYINDEX, "ta_views");
+ lua_newtable(L);
+ lua_pushlightuserdata(L, view);
+ lua_pushvalue(L, -1), lua_setfield(L, -3, "widget_pointer");
+ l_setcfunction(L, -2, "goto_buffer", lview_goto_buffer);
+ l_setcfunction(L, -2, "split", lview_split);
+ l_setcfunction(L, -2, "unsplit", lview_unsplit);
+ l_setmetatable(L, -2, "ta_view", lview__index, lview__newindex);
+ // vs[userdata] = v, vs[#vs + 1] = v, vs[v] = #vs
+ lua_pushvalue(L, -2), lua_settable(L, -4);
+ lua_pushvalue(L, -1), lua_rawseti(L, -3, lua_objlen(L, -3) + 1);
+ lua_pushinteger(L, lua_objlen(L, -2)), lua_settable(L, -3);
+ lua_pop(L, 1); // views
}
/**
- * Removes a Scintilla view from the global '_VIEWS' table.
+ * Removes the Scintilla view from the 'views' registry table.
+ * The view must have been previously added with lL_addview.
+ * @param L The Lua state.
* @param view The Scintilla view to remove.
+ * @see lL_addview
*/
-void l_remove_view(GtkWidget *view) {
- lua_newtable(lua);
- lua_getfield(lua, LUA_REGISTRYINDEX, "views");
- lua_pushnil(lua);
- while (lua_next(lua, -2))
- (view != l_checkview(lua, -1)) ? l_append(lua, -4) : lua_pop(lua, 1);
- lua_pop(lua, 1); // views
- lua_pushvalue(lua, -1);
- lua_setfield(lua, LUA_REGISTRYINDEX, "views");
- lua_setglobal(lua, "_VIEWS");
-}
-
-/**
- * Changes focus a Scintilla view in the global '_VIEWS' table.
- * @param view The currently focused Scintilla view.
- * @param n The index of the window in the '_VIEWS' table to focus.
- * @param absolute Flag indicating whether or not the index specified in
- * '_VIEWS' is absolute. If FALSE, focuses the window relative to the
- * currently focused window for the given index.
- * Throws an error if the view does not exist.
- */
-void l_goto_view(GtkWidget *view, int n, int absolute) {
- lua_getfield(lua, LUA_REGISTRYINDEX, "views");
- if (!absolute) {
- unsigned int idx = 1;
- lua_pushnil(lua);
- while (lua_next(lua, -2))
- if (view == l_checkview(lua, -1)) {
- idx = lua_tointeger(lua, -2);
- lua_pop(lua, 2); // key and value
- break;
- } else lua_pop(lua, 1); // value
- idx += n;
- if (idx > lua_objlen(lua, -1))
- idx = 1;
- else if (idx < 1)
- idx = lua_objlen(lua, -1);
- lua_rawgeti(lua, -1, idx);
- } else {
- luaL_argcheck(lua, n >= 0 && n <= lua_objlen(lua, -1), 1,
- "no View exists at that index");
- lua_rawgeti(lua, -1, n);
+static void lL_removeview(lua_State *L, GtkWidget *view) {
+ lua_newtable(L);
+ lua_getfield(L, LUA_REGISTRYINDEX, "ta_views");
+ lua_pushnil(L);
+ while (lua_next(L, -2)) {
+ if (lua_isnumber(L, -2) && view != l_toview(L, -1)) {
+ lua_getfield(L, -1, "widget_pointer");
+ // vs[userdata] = v, vs[#vs + 1] = v, vs[v] = #vs
+ lua_pushvalue(L, -2), lua_rawseti(L, -6, lua_objlen(L, -6) + 1);
+ lua_pushvalue(L, -2), lua_settable(L, -6);
+ lua_pushinteger(L, lua_objlen(L, -4)), lua_settable(L, -5);
+ } else lua_pop(L, 1); // value
}
- view = l_checkview(lua, -1);
- gtk_widget_grab_focus(view);
- // gui.dialog() interferes with focus so gtk_widget_grab_focus() does not
- // always work. If this is the case, ensure switch_to_view() is called.
- if (!gtk_widget_has_focus(view)) switch_to_view(view);
- lua_pop(lua, 2); // view table and views
-}
-
-/**
- * Sets the global 'view' variable to be the specified Scintilla view.
- * @param view The Scintilla view to set 'view' to.
- */
-void l_set_view_global(GtkWidget *view) {
- lua_getfield(lua, LUA_REGISTRYINDEX, "views");
- lua_pushnil(lua);
- while (lua_next(lua, -2))
- if (view == l_checkview(lua, -1)) {
- lua_setglobal(lua, "view"); // value (view table)
- lua_pop(lua, 1); // key
- break;
- } else lua_pop(lua, 1); // value
- lua_pop(lua, 1); // views
+ lua_pop(L, 1); // views
+ lua_pushvalue(L, -1), lua_setfield(L, LUA_REGISTRYINDEX, "ta_views");
+ lua_setglobal(L, "_VIEWS");
}
/**
- * Checks a specified element to see if it is a buffer table and returns the
- * Scintilla document pointer associated with it.
- * Throws an error if the check is not satisfied.
- * @param lua The Lua State.
- * @param narg Relative stack index to check for a buffer table.
+ * Returns the buffer at the given acceptable index as a Scintilla document.
+ * @param L The Lua state.
+ * @param index Stack index of the buffer.
+ * @return Scintilla document
*/
-static sptr_t l_checkdocpointer(lua_State *lua, int narg) {
- luaL_argcheck(lua, lua_istable(lua, narg), narg, "Buffer expected");
- lua_pushstring(lua, "doc_pointer");
- lua_rawget(lua, (narg > 0) ? narg : narg - 1);
- luaL_argcheck(lua, lua_isnumber(lua, -1), narg, "Buffer expected");
- sptr_t doc = lua_tointeger(lua, -1);
- lua_pop(lua, 1); // doc_pointer
+static sptr_t l_todoc(lua_State *L, int index) {
+ lua_getfield(L, index, "doc_pointer");
+ sptr_t doc = (sptr_t)lua_touserdata(L, -1);
+ lua_pop(L, 1); // doc_pointer
return doc;
}
/**
- * Adds a Scintilla document to the global '_BUFFERS' table with a metatable.
+ * Adds a Scintilla document with a metatable to the 'buffers' registry table.
+ * @param L The Lua state.
* @param doc The Scintilla document to add.
- * @return integer index of the new buffer in _BUFFERS.
*/
-int l_add_buffer(sptr_t doc) {
- lua_getfield(lua, LUA_REGISTRYINDEX, "buffers");
- lua_newtable(lua);
- lua_pushinteger(lua, doc);
- lua_setfield(lua, -2, "doc_pointer");
- l_cfunc(lua, l_cf_buffer_delete, "delete");
- l_cfunc(lua, l_cf_buffer_text_range, "text_range");
- l_mt(lua, "_buffer_mt", l_buffer_mt_index, l_buffer_mt_newindex);
- l_append(lua, -2); // pops table
- int index = lua_objlen(lua, -1);
- lua_pop(lua, 1); // buffers
- return index;
+static void lL_adddoc(lua_State *L, sptr_t doc) {
+ lua_getfield(L, LUA_REGISTRYINDEX, "ta_buffers");
+ lua_newtable(L);
+ lua_pushlightuserdata(L, (sptr_t *)doc); // TODO: can this fail?
+ lua_pushvalue(L, -1), lua_setfield(L, -3, "doc_pointer");
+ l_setcfunction(L, -2, "check_global", lbuffer_check_global);
+ l_setcfunction(L, -2, "delete", lbuffer_delete);
+ l_setcfunction(L, -2, "text_range", lbuffer_text_range);
+ l_setmetatable(L, -2, "ta_buffer", lbuf_property, lbuf_property);
+ // bs[userdata] = b, bs[#bs + 1] = b, bs[b] = #bs
+ lua_pushvalue(L, -2), lua_settable(L, -4);
+ lua_pushvalue(L, -1), lua_rawseti(L, -3, lua_objlen(L, -3) + 1);
+ lua_pushinteger(L, lua_objlen(L, -2)), lua_settable(L, -3);
+ lua_pop(L, 1); // buffers
}
/**
- * Removes a Scintilla document from the global '_BUFFERS' table.
- * If any views currently show the document to be removed, change the documents
- * they show first.
- * @param doc The Scintilla buffer to remove.
+ * Removes the Scintilla document from the 'buffers' registry table.
+ * The document must have been previously added with lL_adddoc.
+ * It is removed from any other views showing it first. Therefore, ensure the
+ * length of 'buffers' is more than one unless quitting the application.
+ * @param L The Lua state.
+ * @param doc The Scintilla document to remove.
+ * @see lL_adddoc
*/
-void l_remove_buffer(sptr_t doc) {
- lua_getfield(lua, LUA_REGISTRYINDEX, "views");
- lua_pushnil(lua);
- while (lua_next(lua, -2)) {
- GtkWidget *view = l_checkview(lua, -1);
- sptr_t that_doc = SS(view, SCI_GETDOCPOINTER, 0, 0);
- if (that_doc == doc) l_goto_buffer(view, -1, FALSE);
- lua_pop(lua, 1); // value
+static void lL_removedoc(lua_State *L, sptr_t doc) {
+ lua_getfield(L, LUA_REGISTRYINDEX, "ta_views");
+ lua_pushnil(L);
+ while (lua_next(L, -2)) {
+ if (lua_isnumber(L, -2)) {
+ GtkWidget *view = l_toview(L, -1);
+ if (doc == SS(view, SCI_GETDOCPOINTER, 0, 0))
+ lL_gotodoc(L, view, -1, TRUE);
+ }
+ lua_pop(L, 1); // value
}
- lua_pop(lua, 1); // views
- lua_newtable(lua);
- lua_getfield(lua, LUA_REGISTRYINDEX, "buffers");
- lua_pushnil(lua);
- while (lua_next(lua, -2))
- (doc != l_checkdocpointer(lua, -1)) ? l_append(lua, -4) : lua_pop(lua, 1);
- lua_pop(lua, 1); // buffers
- lua_pushvalue(lua, -1);
- lua_setfield(lua, LUA_REGISTRYINDEX, "buffers");
- lua_setglobal(lua, "_BUFFERS");
-}
-
-/**
- * Retrieves the index in the global '_BUFFERS' table for a given Scintilla
- * document.
- * @param doc The Scintilla document to get the index of.
- * @return int buffer index.
- */
-unsigned int l_get_docpointer_index(sptr_t doc) {
- lua_getfield(lua, LUA_REGISTRYINDEX, "buffers");
- unsigned int idx = 1;
- lua_pushnil(lua);
- while (lua_next(lua, -2))
- if (doc == l_checkdocpointer(lua, -1)) {
- idx = lua_tointeger(lua, -2);
- lua_pop(lua, 2); // key and value
- break;
- } else lua_pop(lua, 1); // value
- lua_pop(lua, 1); // buffers
- return idx;
+ lua_pop(L, 1); // views
+ lua_newtable(L);
+ lua_getfield(L, LUA_REGISTRYINDEX, "ta_buffers");
+ lua_pushnil(L);
+ while (lua_next(L, -2)) {
+ if (lua_isnumber(L, -2) && doc != l_todoc(L, -1)) {
+ lua_getfield(L, -1, "doc_pointer");
+ // bs[userdata] = b, bs[#bs + 1] = b, bs[b] = #bs
+ lua_pushvalue(L, -2), lua_rawseti(L, -6, lua_objlen(L, -6) + 1);
+ lua_pushvalue(L, -2), lua_settable(L, -6);
+ lua_pushinteger(L, lua_objlen(L, -4)), lua_settable(L, -5);
+ } else lua_pop(L, 1); // value
+ }
+ lua_pop(L, 1); // buffers
+ lua_pushvalue(L, -1), lua_setfield(L, LUA_REGISTRYINDEX, "ta_buffers");
+ lua_setglobal(L, "_BUFFERS");
}
/**
- * Changes a Scintilla view's document to one in the global '_BUFFERS' table.
- * Before doing so, it saves the scroll and caret positions in the current
- * Scintilla document. Then when the new document is shown, its scroll and caret
- * positions are restored.
- * @param view The Scintilla view to change the document of.
- * @param n The index of the document in '_BUFFERS' to focus.
- * @param absolute Flag indicating whether or not the index specified in
- * '_BUFFERS' is absolute. If FALSE, focuses the document relative to the
- * currently focused document for the given index.
- * Throws an error if the buffer does not exist.
+ * Switches to a document in the given view.
+ * @param L The Lua state.
+ * @param view The Scintilla view.
+ * @param n Relative or absolute index of the document to switch to. An absolute
+ * n of -1 represents the last document.
+ * @param relative Flag indicating whether or not n is relative.
*/
-void l_goto_buffer(GtkWidget *view, int n, int absolute) {
- lua_getfield(lua, LUA_REGISTRYINDEX, "buffers");
- if (!absolute) {
- sptr_t doc = SS(view, SCI_GETDOCPOINTER, 0, 0);
- unsigned int idx = l_get_docpointer_index(doc);
- idx += n;
- if (idx > lua_objlen(lua, -1))
- idx = 1;
- else if (idx < 1)
- idx = lua_objlen(lua, -1);
- lua_rawgeti(lua, -1, idx);
+static void lL_gotodoc(lua_State *L, GtkWidget *view, int n, int relative) {
+ if (relative && n == 0) return;
+ lua_getfield(L, LUA_REGISTRYINDEX, "ta_buffers");
+ if (relative) {
+ l_pushdoc(L, SS(view, SCI_GETDOCPOINTER, 0, 0)), lua_gettable(L, -2);
+ n = lua_tointeger(L, -1) + n;
+ lua_pop(L, 1); // index
+ if (n > lua_objlen(L, -1))
+ n = 1;
+ else if (n < 1)
+ n = lua_objlen(L, -1);
+ lua_rawgeti(L, -1, n);
} else {
- luaL_argcheck(lua, n >= 0 && n <= lua_objlen(lua, -1), 2,
+ luaL_argcheck(L, (n > 0 && n <= lua_objlen(L, -1)) || n == -1, 2,
"no Buffer exists at that index");
- lua_rawgeti(lua, -1, n);
+ lua_rawgeti(L, -1, (n > 0) ? n : lua_objlen(L, -1));
}
- sptr_t doc = l_checkdocpointer(lua, -1);
+ sptr_t doc = l_todoc(L, -1);
SS(view, SCI_SETDOCPOINTER, 0, doc);
- l_set_buffer_global(view);
- lua_pop(lua, 2); // buffer table and buffers
+ l_setglobaldoc(L, doc);
+ lua_pop(L, 2); // buffer table and buffers
}
/**
- * Sets the global 'buffer' variable to be the document in the specified
- * Scintilla object.
- * @param view The Scintilla widget housing the buffer to be 'buffer'.
+ * Closes the Lua state.
+ * Unsplits and destroys all Scintilla views and removes all Scintilla
+ * documents, before closing the state.
+ * @param L The Lua state.
*/
-void l_set_buffer_global(GtkWidget *view) {
- sptr_t doc = SS(view, SCI_GETDOCPOINTER, 0, 0);
- lua_getfield(lua, LUA_REGISTRYINDEX, "buffers");
- lua_pushnil(lua);
- while (lua_next(lua, -2))
- if (doc == l_checkdocpointer(lua, -1)) {
- lua_setglobal(lua, "buffer"); // value (buffer table)
- lua_pop(lua, 1); // key
- break;
- } else lua_pop(lua, 1); // value
- lua_pop(lua, 1); // buffers
-}
-
-/**
- * Closes the Lua State.
- * Unsplits all Scintilla views recursively, removes all Scintilla documents,
- * and deletes the last Scintilla view before closing the state.
- */
-void l_close() {
+static void l_close(lua_State *L) {
closing = TRUE;
while (unsplit_view(focused_view)) ; // need space to fix compiler warning
- lua_getfield(lua, LUA_REGISTRYINDEX, "buffers");
- lua_pushnil(lua);
- while (lua_next(lua, -2)) {
- sptr_t doc = l_checkdocpointer(lua, -1);
- remove_buffer(doc);
- lua_pop(lua, 1); // value
+ lua_getfield(L, LUA_REGISTRYINDEX, "ta_buffers");
+ lua_pushnil(L);
+ while (lua_next(L, -2)) {
+ if (lua_isnumber(L, -2)) delete_buffer(l_todoc(L, -1));
+ lua_pop(L, 1); // value
}
- lua_pop(lua, 1); // buffers
+ lua_pop(L, 1); // buffers
gtk_widget_destroy(focused_view);
- lua_close(lua);
+ lua_close(L);
}
/******************************************************************************/
@@ -1249,179 +1042,201 @@ void l_close() {
/******************************************************************************/
/**
- * Recurses through a Lua table, setting each of its keys and values to nil,
- * effectively clearing the table.
- * @param lua The Lua State.
- * @param abs_index The absolute stack index of the table to clear.
+ * Clears a table at the given valid index by setting all of its keys to nil.
+ * Cannot be called with a pseudo-index.
+ * @param L The Lua state.
+ * @param index The stack index of the table.
*/
-static void clear_table(lua_State *lua, int abs_index) {
- lua_pushnil(lua);
- while (lua_next(lua, abs_index)) {
- lua_pop(lua, 1); // value
- lua_pushnil(lua);
- lua_rawset(lua, abs_index);
- lua_pushnil(lua); // get 'new' first key
+static void lL_cleartable(lua_State *L, int index) {
+ lua_pushnil(L);
+ while (lua_next(L, index)) {
+ lua_pop(L, 1); // value
+ lua_pushnil(L), lua_rawset(L, index);
+ lua_pushnil(L); // get 'new' first key
}
}
/**
- * Prints a warning.
- * @param s The warning to print.
+ * Pushes the Scintilla view onto the stack.
+ * The view must have previously been added with lL_addview.
+ * @param L The Lua state.
+ * @param view The Scintilla view to push.
+ * @see lL_addview
*/
-static void warn(const char *s) { printf("Warning: %s\n", s); }
+static void l_pushview(lua_State *L, GtkWidget *view) {
+ lua_getfield(L, LUA_REGISTRYINDEX, "ta_views");
+ lua_pushlightuserdata(L, view), lua_gettable(L, -2);
+ lua_remove(L, -2); // views
+}
/**
- * Calls a Lua function with a number of arguments and expected return values.
- * The last argument is at the stack top, and each argument in reverse order is
- * one element lower on the stack with the Lua function being under the first
- * argument.
- * @param nargs The number of arguments to pass to the Lua function to call.
- * @param retn Optional number of expected return values. Defaults to 0.
- * @param keep_return Optional flag indicating whether or not to keep the return
- * values at the top of the stack. If FALSE, discards the return values.
- * Defaults to FALSE.
- * @return FALSE if an error occured or the function returns false explicitly;
- * TRUE otherwise.
+ * Pushes the Scintilla document onto the stack.
+ * The document must have previously been added with lL_adddoc.
+ * @param L The Lua state.
+ * @param doc The document to push.
+ * @see lL_adddoc
*/
-static int l_call_function(int nargs, int retn, int keep_return) {
- int ret = lua_pcall(lua, nargs, retn, 0);
- if (ret == 0) {
- int result = (retn > 0) ? lua_toboolean(lua, -1) == 1 : TRUE;
- if (retn > 0 && !keep_return) lua_pop(lua, retn); // retn
- return result;
- } else {
- if (focused_view)
- l_emit_event("error", LUA_TSTRING, lua_tostring(lua, -1), -1);
- else
- printf("Lua Error: %s\n", lua_tostring(lua, -1));
- lua_settop(lua, 0);
- }
- return FALSE;
+static void l_pushdoc(lua_State *L, sptr_t doc) {
+ lua_getfield(L, LUA_REGISTRYINDEX, "ta_buffers");
+ lua_pushlightuserdata(L, (sptr_t *)doc), lua_gettable(L, -2);
+ lua_remove(L, -2); // buffers
}
/**
- * Performs a Lua rawget on a table at a given stack index and returns an int.
- * @param lua The Lua State.
- * @param index The relative index of the table to rawget from.
- * @param n The index in the table to rawget.
- * @return int result of lua_rawgeti().
+ * Prints a warning.
+ * @param s The warning to print.
*/
-static int l_rawgeti_int(lua_State *lua, int index, int n) {
- lua_rawgeti(lua, index, n);
- int ret = lua_tointeger(lua, -1);
- lua_pop(lua, 1); // integer
- return ret;
-}
+static void warn(const char *s) { printf("Warning: %s\n", s); }
/**
- * Performs a Lua rawget on a table at a given stack index and returns a string.
- * @param lua The Lua State.
- * @param index The relative index of the table to rawget from.
- * @param k String key in the table to rawget.
- * @return string result of lua_rawget().
+ * Returns the value t[n] as an integer where t is the value at the given valid
+ * index.
+ * The access is raw; that is, it does not invoke metamethods.
+ * @param L The Lua state.
+ * @param index The stack index of the table.
+ * @param n The index in the table to get.
+ * @return integer
*/
-static const char *l_rawget_str(lua_State *lua, int index, const char *k) {
- lua_pushstring(lua, k);
- lua_rawget(lua, index);
- const char *str = lua_tostring(lua, -1);
- lua_pop(lua, 1); // string
- return str;
+static int l_rawgetiint(lua_State *L, int index, int n) {
+ lua_rawgeti(L, index, n);
+ int ret = lua_tointeger(L, -1);
+ lua_pop(L, 1); // integer
+ return ret;
}
/**
- * Creates a GtkMenu from a table at the top of the Lua stack.
- * The table has a key 'title' and a numeric list of subitems.
- * @param lua The Lua State.
- * @param callback A GCallback associated with each menu item.
- * @param submenu Flag indicating whether or not this menu is a submenu.
- * @return GtkWidget menu.
+ * Returns the value t[k] as a string where t is the value at the given valid
+ * index.
+ * The access is raw; that is, it does not invoke metamethods.
+ * @param L The Lua state.
+ * @param index The stack index of the table.
+ * @param k String key in the table to get.
+ * @return string
*/
-GtkWidget *l_create_gtkmenu(lua_State *lua, GCallback callback, int submenu) {
- GtkWidget *menu = gtk_menu_new(), *menu_item = 0, *submenu_root = 0;
- const char *label;
- lua_getfield(lua, -1, "title");
- if (!lua_isnil(lua, -1) || submenu) { // title required for submenu
- label = !lua_isnil(lua, -1) ? lua_tostring(lua, -1) : "notitle";
- submenu_root = gtk_menu_item_new_with_mnemonic(label);
- gtk_menu_item_set_submenu(GTK_MENU_ITEM(submenu_root), menu);
- }
- lua_pop(lua, 1); // title
- lua_pushnil(lua);
- while (lua_next(lua, -2)) {
- if (lua_istable(lua, -1)) {
- lua_getfield(lua, -1, "title");
- int is_submenu = !lua_isnil(lua, -1);
- lua_pop(lua, 1); // title
- if (is_submenu)
- gtk_menu_shell_append(GTK_MENU_SHELL(menu),
- l_create_gtkmenu(lua, callback, TRUE));
- else
- if (lua_objlen(lua, -1) == 2 || lua_objlen(lua, -1) == 4) {
- lua_rawgeti(lua, -1, 1);
- lua_rawgeti(lua, -2, 2);
- label = lua_tostring(lua, -2);
- int menu_id = lua_tointeger(lua, -1);
- lua_rawgeti(lua, -3, 3);
- lua_rawgeti(lua, -4, 4);
- int key = !lua_isnil(lua, -2) ? lua_tointeger(lua, -2) : 0;
- int modifiers = !lua_isnil(lua, -1) ? lua_tointeger(lua, -1) : 0;
- lua_pop(lua, 4); // label, id, key, and modifiers
- if (label) {
- if (g_str_has_prefix(label, "gtk-"))
- menu_item = gtk_image_menu_item_new_from_stock(label, NULL);
- else if (streq(label, "separator"))
- menu_item = gtk_separator_menu_item_new();
- else
- menu_item = gtk_menu_item_new_with_mnemonic(label);
- if (key || modifiers)
- gtk_widget_add_accelerator(menu_item, "activate", accel, key,
- modifiers, GTK_ACCEL_VISIBLE);
- g_signal_connect(menu_item, "activate", callback,
- GINT_TO_POINTER(menu_id));
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
- }
- } else warn("gtkmenu: { 'label', id_num [, keycode, mods] } expected");
- }
- lua_pop(lua, 1); // value
- }
- return !submenu_root ? menu : submenu_root;
+static const char *l_rawgetstr(lua_State *L, int index, const char *k) {
+ lua_pushstring(L, k);
+ lua_rawget(L, index);
+ const char *str = lua_tostring(L, -1);
+ lua_pop(L, 1); // string
+ return str;
}
/**
- * Convert the stack element at a specified index to a Scintilla w and/or l long
- * parameter based on type.
- * @param lua The Lua State.
- * @param type The Lua type the top stack element is.
- * @param arg_idx The initial stack index to start converting at. It is
- * incremented as parameters are read from the stack.
- * @return long for Scintilla.
+ * Checks whether the function argument narg is the given Scintilla parameter
+ * type and returns it cast to the proper type.
+ * @param L The Lua state.
+ * @param index The stack index of the Scintilla parameter.
+ * @param type The Scintilla type to convert to.
+ * @return Scintilla param
*/
-static long l_toscintillaparam(lua_State *lua, int type, int *arg_idx) {
+static long lL_checkscintillaparam(lua_State *L, int *narg, int type) {
if (type == tSTRING)
- return (long)luaL_checkstring(lua, (*arg_idx)++);
+ return (long)luaL_checkstring(L, (*narg)++);
else if (type == tBOOL)
- return lua_toboolean(lua, (*arg_idx)++);
+ return lua_toboolean(L, (*narg)++);
else if (type == tKEYMOD) {
- int key = luaL_checkinteger(lua, (*arg_idx)++) & 0xFFFF;
- return key | ((luaL_checkinteger(lua, (*arg_idx)++) &
+ int key = luaL_checkinteger(L, (*narg)++) & 0xFFFF;
+ return key | ((luaL_checkinteger(L, (*narg)++) &
(SCMOD_SHIFT | SCMOD_CTRL | SCMOD_ALT)) << 16);
} else if (type > tVOID && type < tBOOL)
- return luaL_checklong(lua, (*arg_idx)++);
+ return luaL_checklong(L, (*narg)++);
else
return 0;
}
/**
- * Checks if the Scintilla document of the buffer table at the index specified
- * is the document of the focused Scintilla view.
- * Throws an error if the check is not satisfied.
- * @param lua The Lua State.
- * @param narg The relative stack position of the buffer table.
+ * Checks whether the function argument narg is a Scintilla view and returns
+ * this view cast to a GtkWidget.
+ * @param L The Lua state.
+ * @param narg The stack index of the Scintilla view.
+ * @return Scintilla view
+ */
+static GtkWidget *lL_checkview(lua_State *L, int narg) {
+ luaL_getmetatable(L, "ta_view");
+ lua_getmetatable(L, narg);
+ luaL_argcheck(L, lua_equal(L, -1, -2), narg, "View expected");
+ lua_getfield(L, (narg > 0) ? narg : narg - 2, "widget_pointer");
+ GtkWidget *view = (GtkWidget *)lua_touserdata(L, -1);
+ lua_pop(L, 3); // widget_pointer, metatable, metatable
+ return view;
+}
+
+/**
+ * Checks whether the function argument narg is a Scintilla document. If not,
+ * raises an error.
+ * @param L The Lua state.
+ * @param narg The stack index of the Scintilla document.
+ * @return Scintilla document
*/
-static void l_check_focused_buffer(lua_State *lua, int narg) {
- sptr_t cur_doc = SS(focused_view, SCI_GETDOCPOINTER, 0, 0);
- luaL_argcheck(lua, cur_doc == l_checkdocpointer(lua, narg), 1,
+static void lL_globaldoccheck(lua_State *L, int narg) {
+ luaL_getmetatable(L, "ta_buffer");
+ lua_getmetatable(L, (narg > 0) ? narg : narg - 1);
+ luaL_argcheck(L, lua_equal(L, -1, -2), narg, "Buffer expected");
+ lua_getfield(L, (narg > 0) ? narg : narg - 2, "doc_pointer");
+ sptr_t doc = (sptr_t)lua_touserdata(L, -1);
+ luaL_argcheck(L, doc == SS(focused_view, SCI_GETDOCPOINTER, 0, 0), narg,
"this buffer is not the current one");
+ lua_pop(L, 3); // doc_pointer, metatable, metatable
+}
+
+/**
+ * Pushes a GTK menu created from the table at the given valid index onto the
+ * stack.
+ * Consult the LuaDoc for the table format.
+ * @param L The Lua state.
+ * @param callback A GCallback associated with each menu item.
+ * @param submenu Flag indicating whether or not this menu is a submenu.
+ */
+static void l_pushgtkmenu(lua_State *L, int index, GCallback callback,
+ int submenu) {
+ GtkWidget *menu = gtk_menu_new(), *menu_item = 0, *submenu_root = 0;
+ const char *label;
+ lua_pushvalue(L, index); // copy to stack top so pseudo-indices can be used
+ lua_getfield(L, -1, "title");
+ if (!lua_isnil(L, -1) || submenu) { // title required for submenu
+ label = !lua_isnil(L, -1) ? lua_tostring(L, -1) : "notitle";
+ submenu_root = gtk_menu_item_new_with_mnemonic(label);
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(submenu_root), menu);
+ }
+ lua_pop(L, 1); // title
+ lua_pushnil(L);
+ while (lua_next(L, -2)) {
+ if (lua_istable(L, -1)) {
+ lua_getfield(L, -1, "title");
+ int is_submenu = !lua_isnil(L, -1);
+ lua_pop(L, 1); // title
+ if (is_submenu) {
+ l_pushgtkmenu(L, -1, callback, TRUE);
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu),
+ (GtkWidget *)lua_touserdata(L, -1));
+ lua_pop(L, 1); // gtkmenu
+ } else if (lua_objlen(L, -1) == 2 || lua_objlen(L, -1) == 4) {
+ lua_rawgeti(L, -1, 1);
+ label = lua_tostring(L, -1);
+ lua_pop(L, 1); // label
+ int menu_id = l_rawgetiint(L, -1, 2);
+ int key = l_rawgetiint(L, -1, 3);
+ int modifiers = l_rawgetiint(L, -1, 4);
+ if (label) {
+ if (g_str_has_prefix(label, "gtk-"))
+ menu_item = gtk_image_menu_item_new_from_stock(label, NULL);
+ else if (strcmp(label, "separator") == 0)
+ menu_item = gtk_separator_menu_item_new();
+ else
+ menu_item = gtk_menu_item_new_with_mnemonic(label);
+ if (key || modifiers)
+ gtk_widget_add_accelerator(menu_item, "activate", accel, key,
+ modifiers, GTK_ACCEL_VISIBLE);
+ g_signal_connect(menu_item, "activate", callback,
+ GINT_TO_POINTER(menu_id));
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
+ }
+ } else warn("gtkmenu: { 'label', id_num [, keycode, mods] } expected");
+ }
+ lua_pop(L, 1); // value
+ }
+ lua_pop(L, 1); // table copy
+ lua_pushlightuserdata(L, !submenu_root ? menu : submenu_root);
}
/******************************************************************************/
@@ -1429,99 +1244,107 @@ static void l_check_focused_buffer(lua_State *lua, int narg) {
/******************************************************************************/
/**
- * Handles a Textadept event.
- * @param s String event name.
- * @param ... Optional arguments to pass to the handler. The variable argument
- * list should contain Lua types followed by the data of that type to pass.
- * The list is terminated by a -1.
- * @return FALSE on error or if event returns false explicitly; TRUE otherwise.
+ * Emits an event.
+ * @param L The Lua state.
+ * @param name The event name.
+ * @param ... Arguments to pass with the event. Each pair of arguments should be
+ * a Lua type followed by the data value itself. For LUA_TLIGHTUSERDATA and
+ * LUA_TTABLE types, push the data values to the stack and give the value
+ * returned by luaL_ref(); luaL_unref() will be called appropriately. The list
+ * must be terminated with a -1.
+ * @return TRUE or FALSE depending on the boolean value returned by the event
+ * handler, if any.
*/
-int l_emit_event(const char *s, ...) {
- lua_getglobal(lua, "events");
- if (lua_istable(lua, -1)) {
- lua_getfield(lua, -1, "emit");
- lua_remove(lua, -2); // events table
- if (lua_isfunction(lua, -1)) {
- lua_pushstring(lua, s);
+static int lL_event(lua_State *L, const char *name, ...) {
+ int ret = FALSE;
+ lua_getglobal(L, "events");
+ if (lua_istable(L, -1)) {
+ lua_getfield(L, -1, "emit");
+ lua_remove(L, -2); // events table
+ if (lua_isfunction(L, -1)) {
+ lua_pushstring(L, name);
int n = 1;
va_list ap;
- va_start(ap, s);
+ va_start(ap, name);
int type = va_arg(ap, int);
while (type != -1) {
void *arg = va_arg(ap, void*);
if (type == LUA_TNIL)
- lua_pushnil(lua);
+ lua_pushnil(L);
else if (type == LUA_TBOOLEAN)
- lua_pushboolean(lua, (long)arg);
+ lua_pushboolean(L, (long)arg);
else if (type == LUA_TNUMBER)
- lua_pushinteger(lua, (long)arg);
+ lua_pushinteger(L, (long)arg);
else if (type == LUA_TSTRING)
- lua_pushstring(lua, (char *)arg);
+ lua_pushstring(L, (char *)arg);
else if (type == LUA_TLIGHTUSERDATA || type == LUA_TTABLE) {
long ref = (long)arg;
- lua_rawgeti(lua, LUA_REGISTRYINDEX, ref);
- luaL_unref(lua, LUA_REGISTRYINDEX, ref);
+ lua_rawgeti(L, LUA_REGISTRYINDEX, ref);
+ luaL_unref(L, LUA_REGISTRYINDEX, ref);
} else warn("events.emit: ignored invalid argument type");
n++;
type = va_arg(ap, int);
}
va_end(ap);
- return l_call_function(n, 1, FALSE);
- } else lua_pop(lua, 1); // non-function
- } else lua_pop(lua, 1); // non-table
- return FALSE;
-}
-
-#define l_pushscninteger(i, n) { \
- lua_pushinteger(lua, i); \
- lua_setfield(lua, -2, n); \
+ if (lua_pcall(L, n, 1, 0) == 0)
+ ret = lua_toboolean(L, -1);
+ else
+ lL_event(L, "error", LUA_TSTRING, lua_tostring(L, -1), -1);
+ lua_pop(L, 1); // result
+ } else lua_pop(L, 1); // non-function
+ } else lua_pop(L, 1); // non-table
+ return ret;
}
/**
- * Handles a Scintilla notification.
+ * Emits a Scintilla notification event.
+ * @param L The Lua state.
* @param n The Scintilla notification struct.
+ * @see lL_event
*/
-void l_emit_scnotification(struct SCNotification *n) {
- lua_newtable(lua);
- l_pushscninteger(n->nmhdr.code, "code");
- l_pushscninteger(n->position, "position");
- l_pushscninteger(n->ch, "ch");
- l_pushscninteger(n->modifiers, "modifiers");
- //l_pushscninteger(n->modificationType, "modification_type");
- lua_pushstring(lua, n->text);
- lua_setfield(lua, -2, "text");
- //l_pushscninteger(n->length, "length");
- //l_pushscninteger(n->linesAdded, "lines_added");
- //l_pushscninteger(n->message, "message");
- l_pushscninteger(n->wParam, "wParam");
- l_pushscninteger(n->lParam, "lParam");
- l_pushscninteger(n->line, "line");
- //l_pushscninteger(n->foldLevelNow, "fold_level_now");
- //l_pushscninteger(n->foldLevelPrev, "fold_level_prev");
- l_pushscninteger(n->margin, "margin");
- l_pushscninteger(n->x, "x");
- l_pushscninteger(n->y, "y");
- l_emit_event("SCN", LUA_TTABLE, luaL_ref(lua, LUA_REGISTRYINDEX), -1);
+static void lL_notify(lua_State *L, struct SCNotification *n) {
+ lua_newtable(L);
+ lua_pushinteger(L, n->nmhdr.code), lua_setfield(L, -2, "code");
+ lua_pushinteger(L, n->position), lua_setfield(L, -2, "position");
+ lua_pushinteger(L, n->ch), lua_setfield(L, -2, "ch");
+ lua_pushinteger(L, n->modifiers), lua_setfield(L, -2, "modifiers");
+ //lua_pushinteger(L, n->modificationType);
+ //lua_setfield(L, -2, "modification_type");
+ lua_pushstring(L, n->text), lua_setfield(L, -2, "text");
+ //lua_pushinteger(L, n->length), lua_setfield(L, -2, "length");
+ //lua_pushinteger(L, n->linesAdded), lua_setfield(L, -2, "lines_added");
+ //lua_pushinteger(L, n->message), lua_setfield(L, -2, "message");
+ lua_pushinteger(L, n->wParam), lua_setfield(L, -2, "wParam");
+ lua_pushinteger(L, n->lParam), lua_setfield(L, -2, "lParam");
+ lua_pushinteger(L, n->line), lua_setfield(L, -2, "line");
+ //lua_pushinteger(L, n->foldLevelNow), lua_setfield(L, -2, "fold_level_now");
+ //lua_pushinteger(L, n->foldLevelPrev);
+ //lua_setfield(L, -2, "fold_level_prev");
+ lua_pushinteger(L, n->margin), lua_setfield(L, -2, "margin");
+ lua_pushinteger(L, n->x), lua_setfield(L, -2, "x");
+ lua_pushinteger(L, n->y), lua_setfield(L, -2, "y");
+ lL_event(L, "SCN", LUA_TTABLE, luaL_ref(L, LUA_REGISTRYINDEX), -1);
}
/**
- * Requests and pops up a context menu for the Scintilla view.
+ * Shows the context menu for a Scintilla view based on a mouse event.
+ * @param L The Lua state.
* @param event The mouse button event.
*/
-void l_gui_popup_context_menu(GdkEventButton *event) {
- lua_getglobal(lua, "gui");
- if (lua_istable(lua, -1)) {
- lua_getfield(lua, -1, "context_menu");
- if (lua_isuserdata(lua, -1)) {
- GtkWidget *menu = l_togtkwidget(lua, -1);
+static void lL_showcontextmenu(lua_State *L, GdkEventButton *event) {
+ lua_getglobal(L, "gui");
+ if (lua_istable(L, -1)) {
+ lua_getfield(L, -1, "context_menu");
+ if (lua_isuserdata(L, -1)) {
+ GtkWidget *menu = (GtkWidget *)lua_touserdata(L, -1);
gtk_widget_show_all(menu);
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
event ? event->button : 0,
gdk_event_get_time((GdkEvent *)event));
- } else if (!lua_isnil(lua, -1))
+ } else if (!lua_isnil(L, -1))
warn("gui.context_menu: gtkmenu expected");
- lua_pop(lua, 1); // gui.context_menu
- } else lua_pop(lua, 1);
+ lua_pop(L, 1); // gui.context_menu
+ } else lua_pop(L, 1); // non-table
}
/******************************************************************************/
@@ -1530,518 +1353,476 @@ void l_gui_popup_context_menu(GdkEventButton *event) {
/******************************************************************************/
/**
- * Calls Scintilla with appropriate parameters and returs appropriate values.
- * @param lua The Lua State.
- * @param view The Scintilla view to call.
- * @param msg The integer message index to call Scintilla with.
- * @param p1_type The Lua type of p1, the Scintilla w parameter.
- * @param p2_type The Lua type of p2, the Scintilla l parameter.
- * @param rt_type The Lua type of the Scintilla return parameter.
- * @param arg The index on the Lua stack where arguments to Scintilla begin.
+ * Calls a function as a Scintilla function.
+ * Does not remove any arguments from the stack, but does push results.
+ * @param L The Lua state.
+ * @param msg The Scintilla message.
+ * @param wtype The type of Scintilla wParam.
+ * @param ltype The type of Scintilla lParam.
+ * @param rtype The type of the Scintilla return.
+ * @param arg The stack index of the first Scintilla parameter. Subsequent
+ * elements will also be passed to Scintilla as needed.
+ * @return number of results pushed onto the stack.
+ * @see lL_checkscintillaparam
*/
-static int l_call_scintilla(lua_State *lua, GtkWidget *view, int msg,
- int p1_type, int p2_type, int rt_type, int arg) {
- long params[2] = {0, 0};
- int params_needed = 2, len = 0, string_return = FALSE;
+static int l_callscintilla(lua_State *L, int msg, int wtype, int ltype,
+ int rtype, int arg) {
+ uptr_t wparam = 0;
+ sptr_t lparam = 0, len = 0;
+ int params_needed = 2, string_return = FALSE;
char *return_string = 0;
- // SCI_PRIVATELEXERCALL iface has p1_type int, p2_type int. Change p2_type
- // appropriately. See LPeg lexer API for more info.
+ // Even though the SCI_PRIVATELEXERCALL interface has ltype int, the LPeg
+ // lexer API uses different types depending on wparam. Modify ltype
+ // appropriately. See the LPeg lexer API for more information.
if (msg == SCI_PRIVATELEXERCALL) {
- p2_type = tSTRINGRESULT;
- int c = luaL_checklong(lua, arg);
+ ltype = tSTRINGRESULT;
+ int c = luaL_checklong(L, arg);
if (c == SCI_GETDIRECTFUNCTION || c == SCI_SETDOCPOINTER)
- p2_type = tINT;
+ ltype = tINT;
else if (c == SCI_SETLEXERLANGUAGE)
- p2_type = tSTRING;
+ ltype = tSTRING;
}
- // Set the w and l parameters appropriately for Scintilla.
- if (p1_type == tLENGTH && p2_type == tSTRING) {
- params[0] = (long)lua_strlen(lua, arg);
- params[1] = (long)luaL_checkstring(lua, arg);
+ // Set wParam and lParam appropriately for Scintilla based on wtype and ltype.
+ if (wtype == tLENGTH && ltype == tSTRING) {
+ wparam = (uptr_t)lua_strlen(L, arg);
+ lparam = (sptr_t)luaL_checkstring(L, arg);
params_needed = 0;
- } else if (p2_type == tSTRINGRESULT) {
+ } else if (ltype == tSTRINGRESULT) {
string_return = TRUE;
- params_needed = (p1_type == tLENGTH) ? 0 : 1;
+ params_needed = (wtype == tLENGTH) ? 0 : 1;
}
- if (params_needed > 0) params[0] = l_toscintillaparam(lua, p1_type, &arg);
- if (params_needed > 1) params[1] = l_toscintillaparam(lua, p2_type, &arg);
- if (string_return) { // if a string return, create a buffer for it
- len = SS(view, msg, params[0], 0);
- if (p1_type == tLENGTH) params[0] = len;
- return_string = malloc(len + 1);
- return_string[len] = '\0';
+ if (params_needed > 0) wparam = lL_checkscintillaparam(L, &arg, wtype);
+ if (params_needed > 1) lparam = lL_checkscintillaparam(L, &arg, ltype);
+ if (string_return) { // create a buffer for the return string
+ len = SS(focused_view, msg, wparam, 0);
+ if (wtype == tLENGTH) wparam = len;
+ return_string = malloc(len + 1), return_string[len] = '\0';
if (msg == SCI_GETTEXT || msg == SCI_GETSELTEXT || msg == SCI_GETCURLINE)
len--; // Scintilla appends '\0' for these messages; compensate
- params[1] = (long)return_string;
+ lparam = (sptr_t)return_string;
}
// Send the message to Scintilla and return the appropriate values.
- sptr_t result = SS(view, msg, params[0], params[1]);
- arg = lua_gettop(lua);
- if (string_return) lua_pushlstring(lua, return_string, len);
- if (rt_type == tBOOL) lua_pushboolean(lua, result);
- if (rt_type > tVOID && rt_type < tBOOL) lua_pushinteger(lua, result);
+ sptr_t result = SS(focused_view, msg, wparam, lparam);
+ arg = lua_gettop(L);
+ if (string_return) lua_pushlstring(L, return_string, len);
+ if (rtype == tBOOL) lua_pushboolean(L, result);
+ if (rtype > tVOID && rtype < tBOOL) lua_pushinteger(L, result);
g_free(return_string);
- return lua_gettop(lua) - arg;
-}
-
-/**
- * Calls a Scintilla buffer function with upvalues from a closure.
- * @param lua The Lua State.
- * @see l_buffer_mt_index
- */
-static int l_call_buffer_function(lua_State *lua) {
- GtkWidget *view = focused_view;
- int buffer_func_table_idx = lua_upvalueindex(1);
- int msg = l_rawgeti_int(lua, buffer_func_table_idx, 1);
- int rt_type = l_rawgeti_int(lua, buffer_func_table_idx, 2);
- int p1_type = l_rawgeti_int(lua, buffer_func_table_idx, 3);
- int p2_type = l_rawgeti_int(lua, buffer_func_table_idx, 4);
- int arg = 1;
- if (lua_type(lua, 1) == LUA_TTABLE) {
- l_check_focused_buffer(lua, 1);
- arg = 2;
+ return lua_gettop(L) - arg;
+}
+
+static int lbuf_closure(lua_State *L) {
+ // If optional buffer argument is given, check it.
+ if (lua_istable(L, 1)) lL_globaldoccheck(L, 1);
+ // Interface table is of the form { msg, rtype, wtype, ltype }.
+ return l_callscintilla(L, l_rawgetiint(L, lua_upvalueindex(1), 1),
+ l_rawgetiint(L, lua_upvalueindex(1), 3),
+ l_rawgetiint(L, lua_upvalueindex(1), 4),
+ l_rawgetiint(L, lua_upvalueindex(1), 2),
+ lua_istable(L, 1) ? 2 : 1);
+}
+
+static int lbuf_property(lua_State *L) {
+ int newindex = (lua_gettop(L) == 3);
+ luaL_getmetatable(L, "ta_buffer");
+ lua_getmetatable(L, 1); // metatable can be either ta_buffer or ta_bufferp
+ int is_buffer = lua_equal(L, -1, -2);
+ lua_pop(L, 2); // metatable, metatable
+
+ // If the key is a Scintilla function, return a callable closure.
+ if (is_buffer && !newindex) {
+ lua_getfield(L, LUA_REGISTRYINDEX, "ta_functions");
+ lua_pushvalue(L, 2), lua_gettable(L, -2);
+ if (lua_istable(L, -1)) return (lua_pushcclosure(L, lbuf_closure, 1), 1);
+ lua_pop(L, 2); // non-table, ta_functions
}
- return l_call_scintilla(lua, view, msg, p1_type, p2_type, rt_type, arg);
-}
-/**
- * Metatable index for a buffer table.
- * If the key is a Scintilla buffer function, push a closure so it can be called
- * as a function. If the key is a non-indexable buffer property, call Scintilla
- * to get it. If the key is an indexible buffer property, push a table with a
- * metatable to access buffer property indices.
- * @param lua The Lua State.
- */
-static int l_buffer_mt_index(lua_State *lua) {
- const char *key = luaL_checkstring(lua, 2);
-
- lua_getfield(lua, LUA_REGISTRYINDEX, "functions");
- lua_getfield(lua, -1, key);
- lua_remove(lua, -2); // buffer functions
- if (lua_istable(lua, -1)) {
- // Of the form { msg, rt_type, p1_type, p2_type }
- lua_pushcclosure(lua, l_call_buffer_function, 1);
- return 1;
- } else lua_pop(lua, 1); // non-table
-
- lua_getfield(lua, LUA_REGISTRYINDEX, "properties");
- lua_getfield(lua, -1, key);
- lua_remove(lua, -2); // buffer properties
- if (lua_istable(lua, -1)) {
- l_check_focused_buffer(lua, 1);
- // Of the form { get_id, set_id, rt_type, p1_type }
- int msg = l_rawgeti_int(lua, -1, 1); // getter
- int rt_type = l_rawgeti_int(lua, -1, 3);
- int p1_type = l_rawgeti_int(lua, -1, 4);
- if (p1_type != tVOID) { // indexible property
- sptr_t doc = SS(focused_view, SCI_GETDOCPOINTER, 0, 0);
- lua_newtable(lua);
- lua_pushstring(lua, key);
- lua_setfield(lua, -2, "property");
- lua_pushinteger(lua, doc);
- lua_setfield(lua, -2, "doc_pointer");
- l_mt(lua, "_bufferp_mt", l_bufferp_mt_index, l_bufferp_mt_newindex);
+ // If the key is a Scintilla property, determine if it is an indexible one or
+ // not. If so, return a table with the appropriate metatable; otherwise call
+ // Scintilla to get or set the property's value.
+ lua_getfield(L, LUA_REGISTRYINDEX, "ta_properties");
+ if (is_buffer)
+ lua_pushvalue(L, 2); // key is given
+ else
+ lua_getfield(L, 1, "property"); // indexible property
+ lua_gettable(L, -2);
+ if (lua_istable(L, -1)) {
+ // Interface table is of the form { get_id, set_id, rtype, wtype }.
+ if (!is_buffer)
+ lua_getfield(L, 1, "buffer"), lL_globaldoccheck(L, -1), lua_pop(L, 1);
+ else
+ lL_globaldoccheck(L, 1);
+ if (is_buffer && l_rawgetiint(L, -1, 4) != tVOID) { // indexible property
+ lua_newtable(L);
+ lua_pushvalue(L, 2), lua_setfield(L, -2, "property");
+ lua_pushvalue(L, 1), lua_setfield(L, -2, "buffer");
+ l_setmetatable(L, -1, "ta_bufferp", lbuf_property, lbuf_property);
return 1;
- } else return l_call_scintilla(lua, focused_view, msg, p1_type, tVOID,
- rt_type, 2);
- } else lua_pop(lua, 1); // non-table
-
- lua_rawget(lua, 1);
- return 1;
-}
-
-/**
- * Helper function for the buffer property metatable.
- * Throws an error when trying to write to a read-only property or when trying
- * to read a write-only property.
- * @param lua The Lua State.
- * @param n 1 for getter property, 2 for setter.
- * @param prop String property name.
- * @param arg The index on the Lua stack where arguments to Scintilla begin.
- * For setter properties, it is 3 because the index is not an argument. For
- * getter and setter properties, it is 2 because the index is an argument.
- */
-static int l_bufferp_mt_(lua_State *lua, int n, const char *prop, int arg) {
- lua_getfield(lua, LUA_REGISTRYINDEX, "properties");
- lua_getfield(lua, -1, prop);
- lua_remove(lua, -2); // buffer properties
- if (lua_istable(lua, -1)) {
- l_check_focused_buffer(lua, 1);
- int msg = l_rawgeti_int(lua, -1, n); // getter (1) or setter (2)
- int rt_type = (n == 1) ? l_rawgeti_int(lua, -1, 3) : tVOID;
- int p1_type = l_rawgeti_int(lua, -1, (n == 1) ? 4 : 3);
- int p2_type = (n == 2) ? l_rawgeti_int(lua, -1, 4) : tVOID;
- if (n == 2 &&
- (p2_type != tVOID || (p2_type == tVOID && p1_type == tSTRING))) {
- int temp = p1_type;
- p1_type = p2_type;
- p2_type = temp;
}
- luaL_argcheck(lua, msg != 0, arg,
- (n == 1) ? "write-only property" : "read-only property");
- return l_call_scintilla(lua, focused_view, msg, p1_type, p2_type, rt_type,
- arg);
- } else lua_pop(lua, 1); // non-table
-
- (lua_gettop(lua) > 2) ? lua_rawset(lua, 1) : lua_rawget(lua, 1);
- return 0;
-}
-
-static int l_buffer_mt_newindex(lua_State *lua) {
- return l_bufferp_mt_(lua, 2, lua_tostring(lua, 2), 3);
-}
-
-static int l_bufferp_mt_index(lua_State *lua) {
- return l_bufferp_mt_(lua, 1, l_rawget_str(lua, 1, "property"), 2);
-}
+ int msg = l_rawgetiint(L, -1, !newindex ? 1 : 2);
+ int wtype = l_rawgetiint(L, -1, !newindex ? 4 : 3);
+ int ltype = !newindex ? tVOID : l_rawgetiint(L, -1, 4);
+ int rtype = !newindex ? l_rawgetiint(L, -1, 3) : tVOID;
+ if (newindex && (ltype != tVOID || wtype == tSTRING)) {
+ int temp = wtype;
+ wtype = ltype, ltype = temp;
+ }
+ luaL_argcheck(L, msg != 0, !newindex ? 2 : 3,
+ !newindex ? "write-only property" : "read-only property");
+ return l_callscintilla(L, msg, wtype, ltype, rtype,
+ (!is_buffer || !newindex) ? 2 : 3);
+ } else lua_pop(L, 2); // non-table, ta_properties
-static int l_bufferp_mt_newindex(lua_State *lua) {
- return l_bufferp_mt_(lua, 2, l_rawget_str(lua, 1, "property"), 2);
+ !newindex ? lua_rawget(L, 1) : lua_rawset(L, 1);
+ return 1;
}
-static int l_view_mt_index(lua_State *lua) {
- const char *key = lua_tostring(lua, 2);
- if (streq(key, "doc_pointer"))
- lua_pushinteger(lua, SS(l_checkview(lua, 1), SCI_GETDOCPOINTER, 0, 0));
- else if (streq(key, "size")) {
- GtkWidget *view = l_checkview(lua, 1);
+static int lview__index(lua_State *L) {
+ const char *key = lua_tostring(L, 2);
+ if (strcmp(key, "buffer") == 0)
+ l_pushdoc(L, SS(lL_checkview(L, 1), SCI_GETDOCPOINTER, 0, 0));
+ else if (strcmp(key, "size") == 0) {
+ GtkWidget *view = lL_checkview(L, 1);
if (GTK_IS_PANED(gtk_widget_get_parent(view))) {
int pos = gtk_paned_get_position(GTK_PANED(gtk_widget_get_parent(view)));
- lua_pushinteger(lua, pos);
- } else lua_pushnil(lua);
- } else lua_rawget(lua, 1);
+ lua_pushinteger(L, pos);
+ } else lua_pushnil(L);
+ } else lua_rawget(L, 1);
return 1;
}
-static int l_view_mt_newindex(lua_State *lua) {
- const char *key = lua_tostring(lua, 2);
- if (streq(key, "size")) {
- GtkWidget *pane = gtk_widget_get_parent(l_checkview(lua, 1));
- int size = luaL_checkinteger(lua, 3);
+static int lview__newindex(lua_State *L) {
+ const char *key = lua_tostring(L, 2);
+ if (strcmp(key, "buffer") == 0)
+ luaL_argerror(L, 3, "read-only property");
+ else if (strcmp(key, "size") == 0) {
+ GtkWidget *pane = gtk_widget_get_parent(lL_checkview(L, 1));
+ int size = luaL_checkinteger(L, 3);
if (size < 0) size = 0;
if (GTK_IS_PANED(pane)) gtk_paned_set_position(GTK_PANED(pane), size);
- } else lua_rawset(lua, 1);
+ } else lua_rawset(L, 1);
return 0;
}
-static int l_gui_mt_index(lua_State *lua) {
- const char *key = lua_tostring(lua, 2);
- if (streq(key, "title"))
- lua_pushstring(lua, gtk_window_get_title(GTK_WINDOW(window)));
- else if (streq(key, "focused_doc_pointer"))
- lua_pushinteger(lua, SS(focused_view, SCI_GETDOCPOINTER, 0, 0));
- else if (streq(key, "statusbar_text"))
- lua_pushstring(lua, statusbar_text);
- else if (streq(key, "clipboard_text")) {
+static int lgui__index(lua_State *L) {
+ const char *key = lua_tostring(L, 2);
+ if (strcmp(key, "title") == 0)
+ lua_pushstring(L, gtk_window_get_title(GTK_WINDOW(window)));
+ else if (strcmp(key, "statusbar_text") == 0)
+ lua_pushstring(L, statusbar_text);
+ else if (strcmp(key, "clipboard_text") == 0) {
char *text = gtk_clipboard_wait_for_text(
gtk_clipboard_get(GDK_SELECTION_CLIPBOARD));
- if (text) {
- lua_pushstring(lua, text);
- g_free(text);
- } else lua_pushstring(lua, "");
- } else if (streq(key, "size")) {
- lua_newtable(lua);
+ lua_pushstring(L, text ? text : "");
+ if (text) g_free(text);
+ } else if (strcmp(key, "size") == 0) {
int width, height;
gtk_window_get_size(GTK_WINDOW(window), &width, &height);
- lua_pushinteger(lua, width);
- lua_rawseti(lua, -2, 1);
- lua_pushinteger(lua, height);
- lua_rawseti(lua, -2, 2);
- } else lua_rawget(lua, 1);
+ lua_newtable(L);
+ lua_pushinteger(L, width), lua_rawseti(L, -2, 1);
+ lua_pushinteger(L, height), lua_rawseti(L, -2, 2);
+ } else lua_rawget(L, 1);
return 1;
}
-static int l_gui_mt_newindex(lua_State *lua) {
- const char *key = lua_tostring(lua, 2);
- if (streq(key, "title"))
- gtk_window_set_title(GTK_WINDOW(window), lua_tostring(lua, 3));
- else if (streq(key, "focused_doc_pointer") || streq(key, "clipboard_text"))
- luaL_argerror(lua, 3, "read-only property");
- else if (streq(key, "docstatusbar_text"))
- set_statusbar_text(lua_tostring(lua, 3), 1);
- else if (streq(key, "statusbar_text")) {
+static void set_statusbar_text(const char *text, int bar) {
+ if (!statusbar[0] || !statusbar[1]) return; // unavailable on startup
+ gtk_statusbar_pop(GTK_STATUSBAR(statusbar[bar]), 0);
+ gtk_statusbar_push(GTK_STATUSBAR(statusbar[bar]), 0, text);
+}
+
+static int lgui__newindex(lua_State *L) {
+ const char *key = lua_tostring(L, 2);
+ if (strcmp(key, "title") == 0)
+ gtk_window_set_title(GTK_WINDOW(window), lua_tostring(L, 3));
+ else if (strcmp(key, "clipboard_text") == 0)
+ luaL_argerror(L, 3, "read-only property");
+ else if (strcmp(key, "docstatusbar_text") == 0)
+ set_statusbar_text(lua_tostring(L, 3), 1);
+ else if (strcmp(key, "statusbar_text") == 0) {
g_free(statusbar_text);
- statusbar_text = g_strdup(!lua_isnil(lua, 3) ? lua_tostring(lua, 3) : "");
+ statusbar_text = g_strdup(luaL_optstring(L, 3, ""));
set_statusbar_text(statusbar_text, 0);
- } else if (streq(key, "menubar")) {
- luaL_argcheck(lua, lua_istable(lua, 3), 3, "table of menus expected");
- GtkWidget *menubar = gtk_menu_bar_new();
- lua_pushnil(lua);
- while (lua_next(lua, 3)) {
- luaL_argcheck(lua, lua_isuserdata(lua, -1), 3, "table of menus expected");
- GtkWidget *menu_item = l_togtkwidget(lua, -1);
- gtk_menu_shell_append(GTK_MENU_SHELL(menubar), menu_item);
- lua_pop(lua, 1); // value
+ } else if (strcmp(key, "menubar") == 0) {
+ luaL_argcheck(L, lua_istable(L, 3), 3, "table of menus expected");
+ GtkWidget *new_menubar = gtk_menu_bar_new();
+ lua_pushnil(L);
+ while (lua_next(L, 3)) {
+ luaL_argcheck(L, lua_isuserdata(L, -1), 3, "table of menus expected");
+ GtkWidget *menu_item = (GtkWidget *)lua_touserdata(L, -1);
+ gtk_menu_shell_append(GTK_MENU_SHELL(new_menubar), menu_item);
+ lua_pop(L, 1); // value
}
- set_menubar(menubar);
- } else if (streq(key, "size")) {
- luaL_argcheck(lua, lua_istable(lua, 3) && lua_objlen(lua, 3) == 2, 3,
+ GtkWidget *vbox = gtk_widget_get_parent(menubar);
+ gtk_container_remove(GTK_CONTAINER(vbox), menubar);
+ menubar = new_menubar;
+ gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, FALSE, 0);
+ gtk_box_reorder_child(GTK_BOX(vbox), menubar, 0);
+ gtk_widget_show_all(menubar);
+#if __OSX__
+ ige_mac_menu_set_menu_bar(GTK_MENU_SHELL(menubar));
+ gtk_widget_hide(menubar);
+#endif
+ } else if (strcmp(key, "size") == 0) {
+ luaL_argcheck(L, lua_istable(L, 3) && lua_objlen(L, 3) == 2, 3,
"{ width, height } table expected");
- int width = l_rawgeti_int(lua, 3, 1);
- int height = l_rawgeti_int(lua, 3, 2);
- if (width > 0 && height > 0)
- gtk_window_resize(GTK_WINDOW(window), width, height);
- } else lua_rawset(lua, 1);
+ int w = l_rawgetiint(L, 3, 1), h = l_rawgetiint(L, 3, 2);
+ if (w > 0 && h > 0) gtk_window_resize(GTK_WINDOW(window), w, h);
+ } else lua_rawset(L, 1);
return 0;
}
#define toggled(w) gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))
-static int l_find_mt_index(lua_State *lua) {
- const char *key = lua_tostring(lua, 2);
- if (streq(key, "find_entry_text"))
- lua_pushstring(lua, gtk_entry_get_text(GTK_ENTRY(find_entry)));
- else if (streq(key, "replace_entry_text"))
- lua_pushstring(lua, gtk_entry_get_text(GTK_ENTRY(replace_entry)));
- else if (streq(key, "match_case"))
- lua_pushboolean(lua, toggled(match_case_opt));
- else if (streq(key, "whole_word"))
- lua_pushboolean(lua, toggled(whole_word_opt));
- else if (streq(key, "lua"))
- lua_pushboolean(lua, toggled(lua_opt));
- else if (streq(key, "in_files"))
- lua_pushboolean(lua, toggled(in_files_opt));
+static int lfind__index(lua_State *L) {
+ const char *key = lua_tostring(L, 2);
+ if (strcmp(key, "find_entry_text") == 0)
+ lua_pushstring(L, gtk_entry_get_text(GTK_ENTRY(find_entry)));
+ else if (strcmp(key, "replace_entry_text") == 0)
+ lua_pushstring(L, gtk_entry_get_text(GTK_ENTRY(replace_entry)));
+ else if (strcmp(key, "match_case") == 0)
+ lua_pushboolean(L, toggled(match_case_opt));
+ else if (strcmp(key, "whole_word") == 0)
+ lua_pushboolean(L, toggled(whole_word_opt));
+ else if (strcmp(key, "lua") == 0)
+ lua_pushboolean(L, toggled(lua_opt));
+ else if (strcmp(key, "in_files") == 0)
+ lua_pushboolean(L, toggled(in_files_opt));
else
- lua_rawget(lua, 1);
+ lua_rawget(L, 1);
return 1;
}
#define toggle(w, b) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), b)
-static int l_find_mt_newindex(lua_State *lua) {
- const char *key = lua_tostring(lua, 2);
- if (streq(key, "find_entry_text"))
- gtk_entry_set_text(GTK_ENTRY(find_entry), lua_tostring(lua, 3));
- else if (streq(key, "replace_entry_text"))
- gtk_entry_set_text(GTK_ENTRY(replace_entry), lua_tostring(lua, 3));
- else if (streq(key, "match_case"))
- toggle(match_case_opt, lua_toboolean(lua, -1) ? TRUE : FALSE);
- else if (streq(key, "whole_word"))
- toggle(whole_word_opt, lua_toboolean(lua, -1) ? TRUE : FALSE);
- else if (streq(key, "lua"))
- toggle(lua_opt, lua_toboolean(lua, -1) ? TRUE : FALSE);
- else if (streq(key, "in_files"))
- toggle(in_files_opt, lua_toboolean(lua, -1) ? TRUE : FALSE);
- else if (streq(key, "find_label_text"))
- gtk_label_set_text_with_mnemonic(GTK_LABEL(flabel), lua_tostring(lua, 3));
- else if (streq(key, "replace_label_text"))
- gtk_label_set_text_with_mnemonic(GTK_LABEL(rlabel), lua_tostring(lua, 3));
- else if (streq(key, "find_next_button_text"))
- gtk_button_set_label(GTK_BUTTON(fnext_button), lua_tostring(lua, 3));
- else if (streq(key, "find_prev_button_text"))
- gtk_button_set_label(GTK_BUTTON(fprev_button), lua_tostring(lua, 3));
- else if (streq(key, "replace_button_text"))
- gtk_button_set_label(GTK_BUTTON(r_button), lua_tostring(lua, 3));
- else if (streq(key, "replace_all_button_text"))
- gtk_button_set_label(GTK_BUTTON(ra_button), lua_tostring(lua, 3));
- else if (streq(key, "match_case_label_text"))
- gtk_button_set_label(GTK_BUTTON(match_case_opt), lua_tostring(lua, 3));
- else if (streq(key, "whole_word_label_text"))
- gtk_button_set_label(GTK_BUTTON(whole_word_opt), lua_tostring(lua, 3));
- else if (streq(key, "lua_pattern_label_text"))
- gtk_button_set_label(GTK_BUTTON(lua_opt), lua_tostring(lua, 3));
- else if (streq(key, "in_files_label_text"))
- gtk_button_set_label(GTK_BUTTON(in_files_opt), lua_tostring(lua, 3));
+static int lfind__newindex(lua_State *L) {
+ const char *key = lua_tostring(L, 2);
+ if (strcmp(key, "find_entry_text") == 0)
+ gtk_entry_set_text(GTK_ENTRY(find_entry), lua_tostring(L, 3));
+ else if (strcmp(key, "replace_entry_text") == 0)
+ gtk_entry_set_text(GTK_ENTRY(replace_entry), lua_tostring(L, 3));
+ else if (strcmp(key, "match_case") == 0)
+ toggle(match_case_opt, lua_toboolean(L, -1));
+ else if (strcmp(key, "whole_word") == 0)
+ toggle(whole_word_opt, lua_toboolean(L, -1));
+ else if (strcmp(key, "lua") == 0)
+ toggle(lua_opt, lua_toboolean(L, -1));
+ else if (strcmp(key, "in_files") == 0)
+ toggle(in_files_opt, lua_toboolean(L, -1));
+ else if (strcmp(key, "find_label_text") == 0)
+ gtk_label_set_text_with_mnemonic(GTK_LABEL(flabel), lua_tostring(L, 3));
+ else if (strcmp(key, "replace_label_text") == 0)
+ gtk_label_set_text_with_mnemonic(GTK_LABEL(rlabel), lua_tostring(L, 3));
+ else if (strcmp(key, "find_next_button_text") == 0)
+ gtk_button_set_label(GTK_BUTTON(fnext_button), lua_tostring(L, 3));
+ else if (strcmp(key, "find_prev_button_text") == 0)
+ gtk_button_set_label(GTK_BUTTON(fprev_button), lua_tostring(L, 3));
+ else if (strcmp(key, "replace_button_text") == 0)
+ gtk_button_set_label(GTK_BUTTON(r_button), lua_tostring(L, 3));
+ else if (strcmp(key, "replace_all_button_text") == 0)
+ gtk_button_set_label(GTK_BUTTON(ra_button), lua_tostring(L, 3));
+ else if (strcmp(key, "match_case_label_text") == 0)
+ gtk_button_set_label(GTK_BUTTON(match_case_opt), lua_tostring(L, 3));
+ else if (strcmp(key, "whole_word_label_text") == 0)
+ gtk_button_set_label(GTK_BUTTON(whole_word_opt), lua_tostring(L, 3));
+ else if (strcmp(key, "lua_pattern_label_text") == 0)
+ gtk_button_set_label(GTK_BUTTON(lua_opt), lua_tostring(L, 3));
+ else if (strcmp(key, "in_files_label_text") == 0)
+ gtk_button_set_label(GTK_BUTTON(in_files_opt), lua_tostring(L, 3));
else
- lua_rawset(lua, 1);
+ lua_rawset(L, 1);
return 0;
}
-static int l_ce_mt_index(lua_State *lua) {
- const char *key = lua_tostring(lua, 2);
- if (streq(key, "entry_text"))
- lua_pushstring(lua, gtk_entry_get_text(GTK_ENTRY(command_entry)));
+static int lce__index(lua_State *L) {
+ const char *key = lua_tostring(L, 2);
+ if (strcmp(key, "entry_text") == 0)
+ lua_pushstring(L, gtk_entry_get_text(GTK_ENTRY(command_entry)));
else
- lua_rawget(lua, 1);
+ lua_rawget(L, 1);
return 1;
}
-static int l_ce_mt_newindex(lua_State *lua) {
- const char *key = lua_tostring(lua, 2);
- if (streq(key, "entry_text"))
- gtk_entry_set_text(GTK_ENTRY(command_entry), lua_tostring(lua, 3));
+static int lce__newindex(lua_State *L) {
+ const char *key = lua_tostring(L, 2);
+ if (strcmp(key, "entry_text") == 0)
+ gtk_entry_set_text(GTK_ENTRY(command_entry), lua_tostring(L, 3));
else
- lua_rawset(lua, 1);
+ lua_rawset(L, 1);
return 0;
}
/******************************************************************************/
-/****************** Lua CFunctions *******************/
+/****************** Lua CFunctions *******************/
/****************** (For documentation, consult the LuaDoc) *******************/
/******************************************************************************/
-static int l_cf_buffer_delete(lua_State *lua) {
- l_check_focused_buffer(lua, 1);
- sptr_t doc = l_checkdocpointer(lua, 1);
- lua_getfield(lua, LUA_REGISTRYINDEX, "buffers");
- if (lua_objlen(lua, -1) > 1)
- l_goto_buffer(focused_view, -1, FALSE);
- else
- new_buffer(focused_view, TRUE, TRUE);
- remove_buffer(doc);
- l_emit_event("buffer_deleted", -1);
- l_emit_event("buffer_after_switch", -1);
+static int lbuffer_check_global(lua_State *L) {
+ lL_globaldoccheck(L, 1);
return 0;
}
-static int l_cf_buffer_new(lua_State *lua) {
- new_buffer(focused_view, TRUE, TRUE);
- lua_getfield(lua, LUA_REGISTRYINDEX, "buffers");
- lua_rawgeti(lua, -1, lua_objlen(lua, -1));
+static int lbuffer_delete(lua_State *L) {
+ lL_globaldoccheck(L, 1);
+ sptr_t doc = SS(focused_view, SCI_GETDOCPOINTER, 0, 0);
+ lua_getfield(L, LUA_REGISTRYINDEX, "ta_buffers");
+ if (lua_objlen(L, -1) == 1) new_buffer(0);
+ lL_gotodoc(L, focused_view, -1, TRUE);
+ delete_buffer(doc);
+ lL_event(L, "buffer_deleted", -1),
+ lL_event(L, "buffer_after_switch", -1);
+ return 0;
+}
+
+static int lbuffer_new(lua_State *L) {
+ new_buffer(0);
+ lua_getfield(L, LUA_REGISTRYINDEX, "ta_buffers");
+ lua_rawgeti(L, -1, lua_objlen(L, -1));
return 1;
}
-static int l_cf_buffer_text_range(lua_State *lua) {
- l_check_focused_buffer(lua, 1);
+static int lbuffer_text_range(lua_State *L) {
+ lL_globaldoccheck(L, 1);
struct Sci_TextRange tr;
- tr.chrg.cpMin = luaL_checkinteger(lua, 2);
- tr.chrg.cpMax = luaL_checkinteger(lua, 3);
- luaL_argcheck(lua, tr.chrg.cpMin <= tr.chrg.cpMax, 3, "start > end");
- int length = tr.chrg.cpMax - tr.chrg.cpMin;
- char *text = malloc(length + 1);
- tr.lpstrText = text;
+ tr.chrg.cpMin = luaL_checkinteger(L, 2);
+ tr.chrg.cpMax = luaL_checkinteger(L, 3);
+ luaL_argcheck(L, tr.chrg.cpMin <= tr.chrg.cpMax, 3, "start > end");
+ tr.lpstrText = malloc(tr.chrg.cpMax - tr.chrg.cpMin + 1);
SS(focused_view, SCI_GETTEXTRANGE, 0, (long)(&tr));
- lua_pushlstring(lua, text, length);
- g_free(text);
+ lua_pushlstring(L, tr.lpstrText, tr.chrg.cpMax - tr.chrg.cpMin);
+ g_free(tr.lpstrText);
return 1;
}
-static int l_cf_view_focus(lua_State *lua) {
- GtkWidget *view = l_checkview(lua, 1);
- // view might be an old reference; GTK_IS_WIDGET checks for a valid widget
- if (GTK_IS_WIDGET(view)) gtk_widget_grab_focus(view);
- return 0;
-}
-
-static int l_cf_view_split(lua_State *lua) {
- GtkWidget *view = l_checkview(lua, 1);
- int vertical = TRUE;
- if (lua_gettop(lua) > 1) vertical = lua_toboolean(lua, 2) == 1;
- split_view(view, vertical);
- lua_pushvalue(lua, 1); // old view
- lua_getglobal(lua, "view"); // new view
+static int lview_split(lua_State *L) {
+ split_view(lL_checkview(L, 1), lua_toboolean(L, 2));
+ lua_pushvalue(L, 1); // old view
+ lua_getglobal(L, "view"); // new view
return 2;
}
-static int l_cf_view_unsplit(lua_State *lua) {
- GtkWidget *view = l_checkview(lua, 1);
- lua_pushboolean(lua, unsplit_view(view));
+static int lview_unsplit(lua_State *L) {
+ lua_pushboolean(L, unsplit_view(lL_checkview(L, 1)));
return 1;
}
#define child1(p) gtk_paned_get_child1(GTK_PANED(p))
#define child2(p) gtk_paned_get_child2(GTK_PANED(p))
-#define view_dpi(view) l_get_docpointer_index(SS(view, SCI_GETDOCPOINTER, 0, 0))
-void l_create_entry(lua_State *lua, GtkWidget *c1, GtkWidget *c2,
- int vertical) {
- lua_newtable(lua);
+static void l_pushsplittable(lua_State *L, GtkWidget *c1, GtkWidget *c2) {
+ lua_newtable(L);
if (GTK_IS_PANED(c1))
- l_create_entry(lua, child1(c1), child2(c1), GTK_IS_HPANED(c1) == 1);
+ l_pushsplittable(L, child1(c1), child2(c1));
else
- lua_pushinteger(lua, view_dpi(c1));
- lua_rawseti(lua, -2, 1);
+ l_pushview(L, c1);
+ lua_rawseti(L, -2, 1);
if (GTK_IS_PANED(c2))
- l_create_entry(lua, child1(c2), child2(c2), GTK_IS_HPANED(c2) == 1);
+ l_pushsplittable(L, child1(c2), child2(c2));
else
- lua_pushinteger(lua, view_dpi(c2));
- lua_rawseti(lua, -2, 2);
- lua_pushboolean(lua, vertical);
- lua_setfield(lua, -2, "vertical");
+ l_pushview(L, c2);
+ lua_rawseti(L, -2, 2);
+ lua_pushboolean(L, GTK_IS_HPANED(gtk_widget_get_parent(c1)));
+ lua_setfield(L, -2, "vertical");
int size = gtk_paned_get_position(GTK_PANED(gtk_widget_get_parent(c1)));
- lua_pushinteger(lua, size);
- lua_setfield(lua, -2, "size");
+ lua_pushinteger(L, size), lua_setfield(L, -2, "size");
}
-static int l_cf_gui_get_split_table(lua_State *lua) {
- lua_getfield(lua, LUA_REGISTRYINDEX, "views");
- if (lua_objlen(lua, -1) > 1) {
- GtkWidget *pane = gtk_widget_get_parent(focused_view);
+static int lgui_get_split_table(lua_State *L) {
+ GtkWidget *pane = gtk_widget_get_parent(focused_view);
+ if (GTK_IS_PANED(pane)) {
while (GTK_IS_PANED(gtk_widget_get_parent(pane)))
pane = gtk_widget_get_parent(pane);
- l_create_entry(lua, child1(pane), child2(pane), GTK_IS_HPANED(pane) == 1);
- } else lua_pushinteger(lua, view_dpi(focused_view));
+ l_pushsplittable(L, child1(pane), child2(pane));
+ } else l_pushview(L, focused_view);
return 1;
}
-static int l_cf_gui_goto_(lua_State *lua, GtkWidget *view, int buffer) {
- int n = luaL_checkinteger(lua, 1);
- int abs = (lua_gettop(lua) > 1) ? lua_toboolean(lua, 2) == 1 : TRUE;
- buffer ? l_goto_buffer(view, n, abs) : l_goto_view(view, n, abs);
- return 0;
-}
-
// If the indexed view is not currently focused, temporarily focus it so calls
// to handlers will not throw 'indexed buffer is not the focused one' error.
-static int l_cf_view_goto_buffer(lua_State *lua) {
- GtkWidget *view = l_checkview(lua, 1);
- int switch_focus = view != focused_view;
- GtkWidget *orig_focused_view = focused_view;
+static int lview_goto_buffer(lua_State *L) {
+ GtkWidget *view = lL_checkview(L, 1), *prev_view = focused_view;
+ int n = luaL_checkinteger(L, 2), relative = lua_toboolean(L, 3);
+ int switch_focus = (view != focused_view);
if (switch_focus) SS(view, SCI_SETFOCUS, TRUE, 0);
- lua_remove(lua, 1); // view table
- l_emit_event("buffer_before_switch", -1);
- l_cf_gui_goto_(lua, view, TRUE);
- l_emit_event("buffer_after_switch", -1);
- if (switch_focus) {
- SS(view, SCI_SETFOCUS, FALSE, 0);
- gtk_widget_grab_focus(orig_focused_view);
- }
+ lL_event(L, "buffer_before_switch", -1);
+ lL_gotodoc(L, view, n, relative);
+ lL_event(L, "buffer_after_switch", -1);
+ if (switch_focus)
+ SS(view, SCI_SETFOCUS, FALSE, 0), gtk_widget_grab_focus(prev_view);
return 0;
}
-static int l_cf_gui_dialog(lua_State *lua) {
- GCDialogType type = gcocoadialog_type(luaL_checkstring(lua, 1));
- int i, j, k, n = lua_gettop(lua) - 1, argc = n;
+static int lgui_dialog(lua_State *L) {
+ GCDialogType type = gcocoadialog_type(luaL_checkstring(L, 1));
+ int i, j, k, n = lua_gettop(L) - 1, argc = n;
for (i = 2; i < n + 2; i++)
- if (lua_type(lua, i) == LUA_TTABLE) argc += lua_objlen(lua, i) - 1;
+ if (lua_istable(L, i)) argc += lua_objlen(L, i) - 1;
const char **argv = malloc((argc + 1) * sizeof(const char *));
for (i = 0, j = 2; j < n + 2; j++)
- if (lua_type(lua, j) == LUA_TTABLE) {
- int len = lua_objlen(lua, j);
+ if (lua_istable(L, j)) {
+ int len = lua_objlen(L, j);
for (k = 1; k <= len; k++) {
- lua_rawgeti(lua, j, k);
- argv[i++] = luaL_checkstring(lua, -1);
- lua_pop(lua, 1);
+ lua_rawgeti(L, j, k);
+ argv[i++] = luaL_checkstring(L, -1);
+ lua_pop(L, 1);
}
- } else argv[i++] = luaL_checkstring(lua, j);
+ } else argv[i++] = luaL_checkstring(L, j);
argv[argc] = 0;
char *out = gcocoadialog(type, argc, argv);
- lua_pushstring(lua, out);
- free(out);
- free(argv);
+ lua_pushstring(L, out);
+ free(out), free(argv);
return 1;
}
-static int l_cf_gui_goto_view(lua_State *lua) {
- return l_cf_gui_goto_(lua, focused_view, FALSE);
+static int lgui_goto_view(lua_State *L) {
+ int n = luaL_checkinteger(L, 1), relative = lua_toboolean(L, 2);
+ if (relative && n == 0) return 0;
+ lua_getfield(L, LUA_REGISTRYINDEX, "ta_views");
+ if (relative) {
+ l_pushview(L, focused_view), lua_gettable(L, -2);
+ n = lua_tointeger(L, -1) + n;
+ if (n > lua_objlen(L, -2))
+ n = 1;
+ else if (n < 1)
+ n = lua_objlen(L, -2);
+ lua_rawgeti(L, -2, n);
+ } else {
+ luaL_argcheck(L, n > 0 && n <= lua_objlen(L, -1), 1,
+ "no View exists at that index");
+ lua_rawgeti(L, -1, n);
+ }
+ GtkWidget *view = l_toview(L, -1);
+ gtk_widget_grab_focus(view);
+ // gui.dialog() interferes with focus so gtk_widget_grab_focus() does not
+ // always work. If this is the case, ensure goto_view() is called.
+ if (!gtk_widget_has_focus(view)) goto_view(view);
+ return 0;
}
-static void t_menu_activate(GtkWidget *menu, gpointer id) {
- l_emit_event("menu_clicked", LUA_TNUMBER, GPOINTER_TO_INT(id), -1);
+static void m_clicked(GtkWidget *menu, gpointer id) {
+ lL_event(lua, "menu_clicked", LUA_TNUMBER, GPOINTER_TO_INT(id), -1);
}
-static int l_cf_gui_gtkmenu(lua_State *lua) {
- luaL_checktype(lua, 1, LUA_TTABLE);
- GtkWidget *menu = l_create_gtkmenu(lua, G_CALLBACK(t_menu_activate), FALSE);
- lua_pushlightuserdata(lua, (GtkWidget *)menu);
+static int lgui_gtkmenu(lua_State *L) {
+ luaL_checktype(L, 1, LUA_TTABLE);
+ l_pushgtkmenu(L, -1, G_CALLBACK(m_clicked), FALSE);
return 1;
}
-static int l_cf_string_iconv(lua_State *lua) {
+static int lstring_iconv(lua_State *L) {
size_t text_len = 0, conv_len = 0;
- const char *text = luaL_checklstring(lua, 1, &text_len);
- const char *to = luaL_checkstring(lua, 2);
- const char *from = luaL_checkstring(lua, 3);
+ const char *text = luaL_checklstring(L, 1, &text_len);
+ const char *to = luaL_checkstring(L, 2);
+ const char *from = luaL_checkstring(L, 3);
char *converted = g_convert(text, text_len, to, from, NULL, &conv_len, NULL);
- if (converted) {
- lua_pushlstring(lua, converted, conv_len);
- g_free(converted);
- } else luaL_error(lua, "Conversion failed");
+ if (!converted) luaL_error(L, "Conversion failed");
+ lua_pushlstring(L, converted, conv_len);
+ g_free(converted);
return 1;
}
-static int l_cf_quit(lua_State *lua) {
+static int lquit(lua_State *L) {
GdkEventAny event;
event.type = GDK_DELETE;
event.window = gtk_widget_get_window(window);
@@ -2050,84 +1831,103 @@ static int l_cf_quit(lua_State *lua) {
return 0;
}
-static int l_cf_reset(lua_State *lua) {
- l_emit_event("reset_before", -1);
- l_init(0, NULL, TRUE);
- lua_pushboolean(lua, TRUE);
- lua_setglobal(lua, "RESETTING");
- l_set_view_global(focused_view);
- l_set_buffer_global(focused_view);
- l_load_script("init.lua");
- lua_pushnil(lua);
- lua_setglobal(lua, "RESETTING");
- l_emit_event("reset_after", -1);
+static int lreset(lua_State *L) {
+ lL_event(L, "reset_before", -1);
+ lL_init(L, 0, NULL, TRUE);
+ lua_pushboolean(L, TRUE), lua_setglobal(L, "RESETTING");
+ l_setglobalview(L, focused_view);
+ l_setglobaldoc(L, SS(focused_view, SCI_GETDOCPOINTER, 0, 0));
+ lL_dofile(L, "init.lua");
+ lua_pushnil(L), lua_setglobal(L, "RESETTING");
+ lL_event(L, "reset_after", -1);
return 0;
}
-static gbool emit_timeout(gpointer data) {
+static gboolean emit_timeout(gpointer data) {
int *refs = (int *)data;
lua_rawgeti(lua, LUA_REGISTRYINDEX, refs[0]); // function
int nargs = 0, repeat = TRUE;
while (refs[++nargs]) lua_rawgeti(lua, LUA_REGISTRYINDEX, refs[nargs]);
- l_call_function(nargs - 1, 1, TRUE);
- if (lua_toboolean(lua, -1) == 0 || lua_isnil(lua, -1)) {
+ int ok = (lua_pcall(lua, nargs - 1, 1, 0) == 0);
+ if (!ok || !lua_toboolean(lua, -1)) {
while (--nargs >= 0) luaL_unref(lua, LUA_REGISTRYINDEX, refs[nargs]);
repeat = FALSE;
+ if (!ok) lL_event(lua, "error", LUA_TSTRING, lua_tostring(lua, -1), -1);
}
- lua_pop(lua, 1); // boolean or nil
+ lua_pop(lua, 1); // result
return repeat;
}
-static int l_cf_timeout(lua_State *lua) {
- int timeout = luaL_checkinteger(lua, 1);
- luaL_argcheck(lua, timeout > 0, 1, "timeout must be > 0");
- luaL_argcheck(lua, lua_isfunction(lua, 2), 2, "function expected");
- int n = lua_gettop(lua);
+static int ltimeout(lua_State *L) {
+ int timeout = luaL_checkinteger(L, 1);
+ luaL_argcheck(L, timeout > 0, 1, "timeout must be > 0");
+ luaL_argcheck(L, lua_isfunction(L, 2), 2, "function expected");
+ int n = lua_gettop(L);
int *refs = (int *)calloc(n, sizeof(int));
- lua_pushvalue(lua, 2);
- refs[0] = luaL_ref(lua, LUA_REGISTRYINDEX);
+ lua_pushvalue(L, 2);
+ refs[0] = luaL_ref(L, LUA_REGISTRYINDEX);
for (int i = 3; i <= n; i++) {
- lua_pushvalue(lua, i);
- refs[i - 2] = luaL_ref(lua, LUA_REGISTRYINDEX);
+ lua_pushvalue(L, i);
+ refs[i - 2] = luaL_ref(L, LUA_REGISTRYINDEX);
}
g_timeout_add_seconds(timeout, emit_timeout, (gpointer)refs);
return 0;
}
-static int l_cf_find_focus(lua_State *lua) {
- find_toggle_focus();
+static int lfind_focus(lua_State *L) {
+ if (!gtk_widget_has_focus(findbox)) {
+ gtk_widget_show(findbox);
+ gtk_widget_grab_focus(find_entry);
+ gtk_widget_grab_default(fnext_button);
+ } else {
+ gtk_widget_grab_focus(focused_view);
+ gtk_widget_hide(findbox);
+ }
return 0;
}
-#define emit(o, s) { \
- g_signal_emit_by_name(G_OBJECT(o), s); \
- return 0; \
+static int lfind_next(lua_State *L) {
+ return (g_signal_emit_by_name(G_OBJECT(fnext_button), "clicked"), 0);
}
-static int l_cf_find_next(lua_State *lua) { emit(fnext_button, "clicked") }
-static int l_cf_find_prev(lua_State *lua) { emit(fprev_button, "clicked") }
-static int l_cf_find_replace(lua_State *lua) { emit(r_button, "clicked") }
-static int l_cf_find_replace_all(lua_State *lua) { emit(ra_button, "clicked") }
-static int l_cf_ce_focus(lua_State *lua) {
- ce_toggle_focus();
+static int lfind_prev(lua_State *L) {
+ return (g_signal_emit_by_name(G_OBJECT(fprev_button), "clicked"), 0);
+}
+
+static int lfind_replace(lua_State *L) {
+ return (g_signal_emit_by_name(G_OBJECT(r_button), "clicked"), 0);
+}
+
+static int lfind_replace_all(lua_State *L) {
+ return (g_signal_emit_by_name(G_OBJECT(ra_button), "clicked"), 0);
+}
+
+static int lce_focus(lua_State *L) {
+ if (!gtk_widget_has_focus(command_entry)) {
+ gtk_widget_show(command_entry);
+ gtk_widget_grab_focus(command_entry);
+ } else {
+ gtk_widget_hide(command_entry);
+ gtk_widget_grab_focus(focused_view);
+ }
return 0;
}
-static int l_cf_ce_show_completions(lua_State *lua) {
- luaL_checktype(lua, 1, LUA_TTABLE);
+static int lce_show_completions(lua_State *L) {
+ luaL_checktype(L, 1, LUA_TTABLE);
GtkEntryCompletion *completion = gtk_entry_get_completion(
GTK_ENTRY(command_entry));
GtkListStore *store = GTK_LIST_STORE(
gtk_entry_completion_get_model(completion));
gtk_list_store_clear(store);
- lua_pushnil(lua);
- while (lua_next(lua, 1)) {
- if (lua_type(lua, -1) == LUA_TSTRING) {
+ lua_pushnil(L);
+ while (lua_next(L, 1)) {
+ if (lua_type(L, -1) == LUA_TSTRING) {
GtkTreeIter iter;
gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter, 0, lua_tostring(lua, -1), -1);
+ gtk_list_store_set(store, &iter, 0, lua_tostring(L, -1), -1);
} else warn("command_entry.show_completions: non-string value ignored");
- lua_pop(lua, 1); // value
+ lua_pop(L, 1); // value
}
gtk_entry_completion_complete(completion);
return 0;