aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+667e-11@users.noreply.github.com>2020-03-26 17:37:08 -0400
committerGravatar mitchell <70453897+667e-11@users.noreply.github.com>2020-03-26 17:37:08 -0400
commit940732342827ebe0d3bb98740419f621f9c77391 (patch)
tree32a3a6ac703429ca036e73c5215bac4f87b0818f
parent52b0ec63792b3023b4ab42e42d2ce1e1fcb813bc (diff)
Switched to 1-based indices for buffer positions, lines, and countable entities.
-rw-r--r--core/.buffer.luadoc246
-rw-r--r--core/file_io.lua2
-rw-r--r--core/iface.lua10
-rw-r--r--core/init.lua4
-rw-r--r--core/ui.lua18
-rw-r--r--doc/manual.md40
-rw-r--r--init.lua14
-rw-r--r--modules/ansi_c/init.lua2
-rw-r--r--modules/lua/init.lua2
-rw-r--r--modules/textadept/bookmarks.lua21
-rw-r--r--modules/textadept/command_entry.lua4
-rw-r--r--modules/textadept/editing.lua55
-rw-r--r--modules/textadept/file_types.lua4
-rw-r--r--modules/textadept/find.lua45
-rw-r--r--modules/textadept/menu.lua6
-rw-r--r--modules/textadept/run.lua23
-rw-r--r--modules/textadept/session.lua6
-rw-r--r--modules/textadept/snippets.lua11
-rwxr-xr-xscripts/gen_iface.lua82
-rw-r--r--src/Makefile2
-rw-r--r--src/textadept.c33
-rw-r--r--test/test.lua25
-rw-r--r--themes/dark.lua2
-rw-r--r--themes/light.lua2
24 files changed, 389 insertions, 270 deletions
diff --git a/core/.buffer.luadoc b/core/.buffer.luadoc
index 91ee6236..f3e91dd9 100644
--- a/core/.buffer.luadoc
+++ b/core/.buffer.luadoc
@@ -36,15 +36,13 @@
-- @field anchor (number)
-- The anchor's position.
-- @field annotation_lines (table, Read-only)
--- Table of the number of annotation text lines for line numbers starting from
--- zero.
+-- Table of the number of annotation text lines per line number.
-- @field annotation_style (table)
--- Table of style numbers for annotation text for line numbers starting from
--- zero.
+-- Table of style numbers for annotation text per line number.
-- Only some style attributes are active in annotations: font,
-- size/size_fractional, bold/weight, italics, fore, back, and character_set.
-- @field annotation_text (table)
--- Table of annotation text for line numbers starting from zero.
+-- Table of annotation text per line number.
-- @field annotation_visible (number)
-- The annotation visibility mode.
--
@@ -212,10 +210,9 @@
-- The line caret's pixel width in insert mode, either `0`, `1`, `2`, or `3`.
-- The default value is `1`.
-- @field char_at (table, Read-only)
--- Table of character bytes at positions starting from zero.
+-- Table of character bytes per position.
-- @field column (table, Read-only)
--- Table of column numbers (taking tab widths into account) for positions
--- starting from zero.
+-- Table of column numbers (taking tab widths into account) per position.
-- Multi-byte characters count as single characters.
-- @field current_pos (number)
-- The caret's position.
@@ -283,7 +280,7 @@
-- @field filename (string)
-- The absolute file path associated with the buffer.
-- @field first_visible_line (number)
--- The line number of the line at the top of the view, starting from zero.
+-- The line number of the line at the top of the view.
-- @field fold_display_text_style (number)
-- The fold display text mode.
--
@@ -296,8 +293,8 @@
--
-- The default value is `buffer.FOLDDISPLAYTEXT_HIDDEN`.
-- @field fold_expanded (table)
--- Table of flags that indicate whether or not fold points are expanded for
--- line numbers starting from zero.
+-- Table of flags per line number that indicate whether or not fold points are
+-- expanded for those line numbers.
-- Setting expanded fold states does not toggle folds; it only updates fold
-- margin markers. Use [`buffer.toggle_fold()`]() instead.
-- @field fold_flags (number, Read-only)
@@ -320,7 +317,7 @@
--
-- The default value is `0`.
-- @field fold_level (table)
--- Table of fold level bit-masks for line numbers starting from zero.
+-- Table of fold level bit-masks per line number.
-- Fold level masks comprise of an integer level combined with any of the
-- following bit flags:
--
@@ -331,7 +328,7 @@
-- * `buffer.FOLDLEVELHEADERFLAG`
-- The line is a header, or fold point.
-- @field fold_parent (table, Read-only)
--- Table of fold point line numbers for child line numbers starting from zero.
+-- Table of fold point line numbers per child line number.
-- A line number of `-1` means no line was found.
-- @field h_scroll_bar (bool)
-- Display the horizontal scroll bar.
@@ -377,30 +374,30 @@
-- The default value is `buffer.IV_NONE`.
-- @field indic_alpha (table)
-- Table of fill color alpha values, ranging from `0` (transparent) to `255`
--- (opaque), for indicator numbers from `0` to `31` whose styles are either
+-- (opaque), for indicator numbers from `1` to `32` whose styles are either
-- `INDIC_ROUNDBOX`, `INDIC_STRAIGHTBOX`, or `INDIC_DOTBOX`.
-- The default values are `buffer.ALPHA_NOALPHA`, for no alpha.
-- @field indic_fore (table)
-- Table of foreground colors, in "0xBBGGRR" format, for indicator numbers
--- from `0` to `31`.
+-- from `1` to `32`.
-- Changing an indicator's foreground color resets that indicator's hover
-- foreground color.
-- @field indic_hover_fore (table)
-- Table of hover foreground colors, in "0xBBGGRR" format, for indicator
--- numbers from `0` to `31`.
+-- numbers from `1` to `32`.
-- The default values are the respective indicator foreground colors.
-- @field indic_hover_style (table)
--- Table of hover styles for indicators numbers from `0` to `31`. An
+-- Table of hover styles for indicators numbers from `1` to `32`. An
-- indicator's hover style drawn when either the cursor hovers over that
-- indicator or the caret is within that indicator.
-- The default values are the respective indicator styles.
-- @field indic_outline_alpha (table)
-- Table of outline color alpha values, ranging from `0` (transparent) to
--- `255` (opaque), for indicator numbers from `0` to `31` whose styles are
+-- `255` (opaque), for indicator numbers from `1` to `32` whose styles are
-- either `INDIC_ROUNDBOX`, `INDIC_STRAIGHTBOX`, or `INDIC_DOTBOX`.
-- The default values are `buffer.ALPHA_NOALPHA`, for no alpha.
-- @field indic_style (table)
--- Table of styles for indicator numbers from `0` to `31`.
+-- Table of styles for indicator numbers from `1` to `32`.
--
-- * `buffer.INDIC_PLAIN`
-- An underline.
@@ -465,10 +462,10 @@
-- Changing an indicator's style resets that indicator's hover style.
-- @field indic_under (table)
-- Table of flags that indicate whether or not to draw indicators behind text
--- instead of over the top of it for indicator numbers from `0` to `31`.
+-- instead of over the top of it for indicator numbers from `1` to `32`.
-- The default values are `false`.
-- @field indicator_current (number)
--- The indicator number in the range of `0` to `31` used by
+-- The indicator number in the range of `1` to `32` used by
-- [`buffer.indicator_fill_range()`]() and
-- [`buffer.indicator_clear_range()`]().
-- @field length (number, Read-only)
@@ -478,15 +475,14 @@
-- There is always at least one.
-- @field line_end_position (table, Read-only)
-- Table of positions at the ends of lines, but before any end of line
--- characters, for line numbers starting from zero.
+-- characters, per line number.
-- @field line_indent_position (table, Read-only)
--- Table of positions at the ends of indentation for line numbers starting
--- from zero.
+-- Table of positions at the ends of indentation per line number.
-- @field line_indentation (table)
--- Table of column indentation amounts, for line numbers starting from zero.
+-- Table of column indentation amounts per line number.
-- @field line_visible (table, Read-only)
--- Table of flags that indicate whether or not lines are visible for line
--- numbers starting from zero.
+-- Table of flags per line number that indicate whether or not lines are
+-- visible for those line numbers.
-- @field lines_on_screen (number, Read-only)
-- The number of completely visible lines in the view.
-- It is possible to have a partial line visible at the bottom of the view.
@@ -498,11 +494,11 @@
-- The default value is `5`.
-- @field margin_back_n (table)
-- Table of background colors, in "0xBBGGRR" format, of margin numbers from
--- `0` to `buffer.margins - 1` (`4` by default).
+-- `1` to `buffer.margins` (`5` by default).
-- Only affects margins of type `buffer.MARGIN_COLOUR`.
-- @field margin_cursor_n (table)
--- Table of cursor types shown over margin numbers from `0` to
--- `buffer.margins - 1` (`4` by default).
+-- Table of cursor types shown over margin numbers from `1` to
+-- `buffer.margins` (`5` by default).
--
-- * `buffer.CURSORARROW`
-- Normal arrow cursor.
@@ -515,11 +511,10 @@
-- The default value is `1`.
-- @field margin_mask_n (table)
-- Table of bit-masks of markers whose symbols marker symbol margins can
--- display for margin numbers from `0` to `buffer.margins - 1` (`4` by
--- default).
+-- display for margin numbers from `1` to `buffer.margins` (`5` by default).
-- Bit-masks are 32-bit values whose bits correspond to the 32 available
-- markers.
--- The default values are `0`, `~buffer.MASK_FOLDERS`, `0`, `0`, and `0`, for
+-- The default values are `0`, `buffer.MASK_FOLDERS`, `0`, `0`, and `0`, for
-- a line margin and logical marker margin.
-- @field margin_options (number)
-- A bit-mask of margin option settings.
@@ -536,20 +531,18 @@
-- The default value is `1`.
-- @field margin_sensitive_n (table)
-- Table of flags that indicate whether or not mouse clicks in margins emit
--- `MARGIN_CLICK` events for margin numbers from `0` to `buffer.margins - 1`
--- (`4` by default).
+-- `MARGIN_CLICK` events for margin numbers from `1` to `buffer.margins` (`5`
+-- by default).
-- The default values are `false`.
-- @field margin_style (table)
--- Table of style numbers for line numbers starting from zero in the text
--- margin.
+-- Table of style numbers in the text margin per line number.
-- Only some style attributes are active in text margins: font, size, bold,
-- italics, fore, and back.
-- @field margin_text (table)
--- Table of text displayed in text margins for line numbers starting from
--- zero.
+-- Table of text displayed in text margins per line number.
-- @field margin_type_n (table)
--- Table of margin types for margin numbers from `0` to `buffer.margins - 1`
--- (`4` by default).
+-- Table of margin types for margin numbers from `1` to `buffer.margins` (`5`
+-- by default).
--
-- * `buffer.MARGIN_SYMBOL`
-- A marker symbol margin.
@@ -571,22 +564,22 @@
-- The default value for the first margin is `buffer.MARGIN_NUMBER`, followed
-- by `buffer.MARGIN_SYMBOL` for the rest.
-- @field margin_width_n (table)
--- Table of pixel margin widths for margin numbers from `0` to
--- `buffer.margins - 1` (`4` by default).
+-- Table of pixel margin widths for margin numbers from `1` to
+-- `buffer.margins` (`5` by default).
-- @field marker_alpha (table, Write-only)
-- Table of alpha values, ranging from `0` (transparent) to `255` (opaque),
-- of markers drawn in the text area (not the margin) for markers numbers from
--- `0` to `31`.
+-- `1` to `32`.
-- The default values are `buffer.ALPHA_NOALPHA`, for no alpha.
-- @field marker_back (table, Write-only)
-- Table of background colors, in "0xBBGGRR" format, of marker numbers from
--- `0` to `31`.
+-- `1` to `32`.
-- @field marker_back_selected (table, Write-only)
-- Table of background colors, in "0xBBGGRR" format, of markers whose folding
--- blocks are selected for marker numbers from `0` to `31`.
+-- blocks are selected for marker numbers from `1` to `32`.
-- @field marker_fore (table, Write-only)
-- Table of foreground colors, in "0xBBGGRR" format, of marker numbers from
--- `0` to `31`.
+-- `1` to `32`.
-- @field mouse_dwell_time (number)
-- The number of milliseconds the mouse must idle before generating a
-- `DWELL_START` event. A time of `buffer.TIME_FOREVER` will never generate
@@ -727,44 +720,44 @@
-- again to the same value or until [`buffer.cancel()`]() is called.
-- @field selection_n_anchor (table)
-- Table of positions at the beginning of existing selections numbered from
--- zero, the main selection.
+-- `1`, the main selection.
-- @field selection_n_anchor_virtual_space (table)
-- Table of positions at the beginning of virtual space selected in existing
--- selections numbered from zero, the main selection.
+-- selections numbered from `1`, the main selection.
-- @field selection_n_caret (table)
--- Table of positions at the end of existing selections numbered from zero,
+-- Table of positions at the end of existing selections numbered from `1`,
-- the main selection.
-- @field selection_n_caret_virtual_space (table)
-- Table of positions at the end of virtual space selected in existing
--- selections numbered from zero, the main selection.
+-- selections numbered from `1`, the main selection.
-- @field selection_n_end (table)
--- Table of positions at the end of existing selections numbered from zero,
+-- Table of positions at the end of existing selections numbered from `1`,
-- the main selection.
-- @field selection_n_start (table)
-- Table of positions at the beginning of existing selections numbered from
--- zero, the main selection.
+-- `1`, the main selection.
-- @field selection_n_end_virtual_space (number, Read-only)
-- Table of positions at the end of virtual space selected in existing
--- selections numbered from zero, the main selection.
+-- selections numbered from `1`, the main selection.
-- @field selection_n_start_virtual_space (number, Read-only)
-- Table of positions at the beginning of virtual space selected in existing
--- selections numbered from zero, the main selection.
+-- selections numbered from `1`, the main selection.
-- @field selection_start (number)
-- The position of the beginning of the selected text.
-- When set, becomes the anchor, but is not scrolled into view.
-- @field selections (number, Read-only)
-- The number of active selections. There is always at least one selection.
-- @field style_at (table, Read-only)
--- Table of style numbers at positions starting from zero.
+-- Table of style numbers per position.
-- @field style_back (table)
-- Table of background colors, in "0xBBGGRR" format, of text for style numbers
--- from `0` to `255`.
+-- from `1` to `256`.
-- @field style_bold (table)
-- Table of flags that indicate whether or not text is bold for style numbers
--- from `0` to `255`.
+-- from `1` to `256`.
-- The default values are `false`.
-- @field style_case (table)
--- Table of letter case modes of text for style numbers from `0` to `255`.
+-- Table of letter case modes of text for style numbers from `1` to `256`.
--
-- * `buffer.CASE_MIXED`
-- Display text in normally.
@@ -778,32 +771,32 @@
-- The default values are `buffer.CASE_MIXED`.
-- @field style_changeable (table)
-- Table of flags that indicate whether or not text is changeable for style
--- numbers from `0` to `255`.
+-- numbers from `1` to `256`.
-- The default values are `true`.
-- Read-only styles do not allow the caret into the range of text.
-- @field style_eol_filled (table)
-- Table of flags that indicate whether or not the background colors of styles
-- whose characters occur last on lines extend all the way to the view's right
--- margin for style numbers from `0` to `255`.
+-- margin for style numbers from `1` to `256`.
-- The default values are `false`.
-- @field style_font (table)
--- Table of string font names of text for style numbers from `0` to `255`.
+-- Table of string font names of text for style numbers from `1` to `256`.
-- @field style_fore (table)
-- Table of foreground colors, in "0xBBGGRR" format, of text for style numbers
--- from `0` to `255`.
+-- from `1` to `256`.
-- @field style_italic (table)
-- Table of flags that indicate whether or not text is italic for style
--- numbers from `0` to `255`.
+-- numbers from `1` to `256`.
-- The default values are `false`.
-- @field style_size (table)
--- Table of font sizes of text for style numbers from `0` to `255`.
+-- Table of font sizes of text for style numbers from `1` to `256`.
-- @field style_underline (table)
-- Table of flags that indicate whether or not text is underlined for style
--- numbers from `0` to `255`.
+-- numbers from `1` to `256`.
-- The default values are `false`.
-- @field style_visible (table)
-- Table of flags that indicate whether or not text is visible for style
--- numbers from `0` to `255`.
+-- numbers from `1` to `256`.
-- The default values are `true`.
-- @field tab_draw_mode (number)
-- The draw mode of visible tabs.
@@ -829,7 +822,7 @@
-- This is also set by a successful [`buffer.search_in_target()`]().
-- @field target_end_virtual_space (number)
-- The position of the end of virtual space in the target range.
--- This is set to `0` when [`buffer.target_start`]() or
+-- This is set to `1` when [`buffer.target_start`]() or
-- [`buffer.target_end`]() is set, or when [`buffer.set_target_range()`]() is
-- called.
-- @field target_start (number)
@@ -837,7 +830,7 @@
-- This is also set by a successful [`buffer.search_in_target()`]().
-- @field target_start_virtual_space (number)
-- The position of the beginning of virtual space in the target range.
--- This is set to `0` when [`buffer.target_start`]() or
+-- This is set to `1` when [`buffer.target_start`]() or
-- [`buffer.target_end`]() is set, or when [`buffer.set_target_range()`]() is
-- called.
-- @field target_text (string, Read-only)
@@ -1437,7 +1430,7 @@ function brace_bad_light(buffer, pos) end
---
-- Highlights unmatched brace characters with indicator number *indicator*, in
--- the range of `0` to `31`, instead of the
+-- the range of `1 to `32`, instead of the
-- `buffer.STYLE_BRACEBAD` style if *use_indicator* is `true`.
-- @param buffer A buffer.
-- @param use_indicator Whether or not to use an indicator.
@@ -1456,7 +1449,7 @@ function brace_highlight(buffer, pos1, pos2) end
---
-- Highlights matching brace characters with indicator number *indicator*, in
--- the range of `0` to `31`, instead of the
+-- the range of `1` to `32`, instead of the
-- `buffer.STYLE_BRACELIGHT` style if *use_indicator* is `true`.
-- @param buffer A buffer.
-- @param use_indicator Whether or not to use an indicator.
@@ -1492,8 +1485,8 @@ function call_tip_cancel(buffer) end
function call_tip_pos_start(buffer) end
---
--- Highlights a call tip's text between positions *start_pos*, starting from
--- zero, to *end_pos* with the color `buffer.call_tip_fore_hlt`.
+-- Highlights a call tip's text between positions *start_pos* to *end_pos* with
+-- the color `buffer.call_tip_fore_hlt`.
-- @param buffer A buffer.
-- @param start_pos The start position in a call tip text to highlight.
-- @param end_pos The end position in a call tip text to highlight.
@@ -1731,9 +1724,9 @@ function delete_range(buffer, pos, length) end
---
-- Returns the actual line number of displayed line number *display_line*,
-- taking hidden lines into account.
--- If *display_line* is less than or equal to zero, returns `0`. If
--- *display_line* is greater than or equal to the number of displayed lines,
--- returns `buffer.line_count`.
+-- If *display_line* is less than or equal to `1`, returns `1`. If
+-- *display_line* is greater than the number of displayed lines, returns
+-- `buffer.line_count`.
-- @param buffer A buffer.
-- @param display_line The display line number to use.
-- @return number
@@ -1839,8 +1832,7 @@ function fold_children(buffer, line, action) end
function fold_line(buffer, line, action) end
---
--- Returns the current line's text and the caret's position on that line,
--- starting from zero.
+-- Returns the current line's text and the caret's position on that line.
-- @param buffer A buffer.
-- @return string, number
function get_cur_line(buffer) end
@@ -1957,7 +1949,8 @@ function home_wrap_extend(buffer) end
---
-- Returns a bit-mask that represents which indicators are on at position *pos*.
--- Bit 0 is set if indicator 0 is on, bit 1 for indicator 1, etc.
+-- The first bit is set if indicator 1 is on, the second bit for indicator 2,
+-- etc.
-- @param buffer A buffer.
-- @param pos The position in *buffer* to get indicators at.
-- @return number
@@ -1975,10 +1968,10 @@ function indicator_clear_range(buffer, pos, length) end
---
-- Returns the next boundary position, starting from position *pos*, of
--- indicator number *indicator*, in the range of `0` to `31`.
--- Returns `0` if *indicator* was not found.
+-- indicator number *indicator*, in the range of `1` to `32`.
+-- Returns `1` if *indicator* was not found.
-- @param buffer A buffer.
--- @param indicator An indicator number in the range of `0` to `31`.
+-- @param indicator An indicator number in the range of `1` to `32`.
-- @param pos The position in *buffer* of the indicator.
function indicator_end(buffer, indicator, pos) end
@@ -1994,10 +1987,10 @@ function indicator_fill_range(buffer, pos, length) end
---
-- Returns the previous boundary position, starting from position *pos*, of
--- indicator number *indicator*, in the range of `0` to `31`.
--- Returns `0` if *indicator* was not found.
+-- indicator number *indicator*, in the range of `1` to `32`.
+-- Returns `1` if *indicator* was not found.
-- @param buffer A buffer.
--- @param indicator An indicator number in the range of `0` to `31`.
+-- @param indicator An indicator number in the range of `1` to `32`.
-- @param pos The position in *buffer* of the indicator.
function indicator_start(buffer, indicator, pos) end
@@ -2101,8 +2094,8 @@ function line_end_wrap_extend(buffer) end
---
-- Returns the line number of the line that contains position *pos*.
--- Returns `0` if *pos* is less than 0 or `buffer.line_count` if *pos* is
--- greater than `buffer.length`.
+-- Returns `1` if *pos* is less than 1 or `buffer.line_count` if *pos* is
+-- greater than `buffer.length + 1`.
-- @param buffer A buffer.
-- @param pos The position in *buffer* to get the line number of.
-- @return number
@@ -2188,53 +2181,53 @@ function lower_case(buffer) end
function margin_text_clear_all(buffer) end
---
--- Adds marker number *marker*, in the range of `0` to `31`, to line number
+-- Adds marker number *marker*, in the range of `1` to `32`, to line number
-- *line*, returning the added marker's handle which can be used in
-- `buffer.marker_delete_handle()` and `buffer.marker_line_from_handle()`, or
--- `0` if *line* is invalid.
+-- `-1` if *line* is invalid.
-- @param buffer A buffer.
-- @param line The line number to add the marker on.
--- @param marker The marker number in the range of `0` to `31` to add.
+-- @param marker The marker number in the range of `1` to `32` to add.
-- @return number
function marker_add(buffer, line, marker) end
---
-- Adds the markers specified in marker bit-mask *marker_mask* to line number
-- *line*.
--- The first bit is set to add marker number 0, the second bit for marker number
--- 1, and so on up to marker number 31.
+-- The first bit is set to add marker number 1, the second bit for marker number
+-- 2, and so on up to marker number 32.
-- @param buffer A buffer.
-- @param line The line number to add the markers on.
--- @param marker_mask The mask of markers to set. Set bit 0 to set marker 0, bit
--- 1 for marker 1 and so on.
+-- @param marker_mask The mask of markers to set. Set the first bit to set
+-- marker 1, the second bit for marker 2 and so on.
function marker_add_set(buffer, line, marker_mask) end
---
--- Assigns marker symbol *symbol* to marker number *marker*, in the range of `0`
--- to `31`.
+-- Assigns marker symbol *symbol* to marker number *marker*, in the range of `1`
+-- to `32`.
-- *symbol* is shown in marker symbol margins next to lines marked with
-- *marker*.
-- @param buffer A buffer.
--- @param marker The marker number in the range of `0` to `31` to set *symbol*
+-- @param marker The marker number in the range of `1` to `32` to set *symbol*
-- for.
-- @param symbol The marker symbol: `buffer.MARK_*`.
-- @see _SCINTILLA.next_marker_number
function marker_define(buffer, marker, symbol) end
---
--- Associates marker number *marker*, in the range of `0` to `31`, with XPM
+-- Associates marker number *marker*, in the range of `1` to `32`, with XPM
-- image *pixmap*.
-- The `buffer.MARK_PIXMAP` marker symbol must be assigned to *marker*.
-- *pixmap* is shown in marker symbol margins next to lines marked with
-- *marker*.
-- @param buffer A buffer.
--- @param marker The marker number in the range of `0` to `31` to define
+-- @param marker The marker number in the range of `1` to `32` to define
-- pixmap *pixmap* for.
-- @param pixmap The string pixmap data.
function marker_define_pixmap(buffer, marker, pixmap) end
---
--- Associates marker number *marker*, in the range of `0` to `31`, with RGBA
+-- Associates marker number *marker*, in the range of `1` to `32`, with RGBA
-- image *pixels*.
-- The dimensions for *pixels* (`buffer.rgba_image_width` and
-- `buffer.rgba_image_height`) must have already been defined. *pixels* is a
@@ -2243,7 +2236,7 @@ function marker_define_pixmap(buffer, marker, pixmap) end
-- The `buffer.MARK_RGBAIMAGE` marker symbol must be assigned to *marker*.
-- *pixels* is shown in symbol margins next to lines marked with *marker*.
-- @param buffer A buffer.
--- @param marker The marker number in the range of `0` to `31` to define RGBA
+-- @param marker The marker number in the range of `1` to `32` to define RGBA
-- data *pixels* for.
-- @param pixels The string sequence of 4 byte pixel values starting with the
-- pixels for the top line, with the leftmost pixel first, then continuing
@@ -2255,20 +2248,20 @@ function marker_define_pixmap(buffer, marker, pixmap) end
function marker_define_rgba_image(buffer, marker, pixels) end
---
--- Deletes marker number *marker*, in the range of `0` to `31`, from line number
+-- Deletes marker number *marker*, in the range of `1` to `32`, from line number
-- *line*. If *marker* is `-1`, deletes all markers from *line*.
-- @param buffer A buffer.
-- @param line The line number to delete the marker on.
--- @param marker The marker number in the range of `0` to `31` to delete from
+-- @param marker The marker number in the range of `1` to `32` to delete from
-- *line*, or `-1` to delete all markers from the line.
function marker_delete(buffer, line, marker) end
---
--- Deletes marker number *marker*, in the range of `0` to `31`, from any line
+-- Deletes marker number *marker*, in the range of `1` to `32`, from any line
-- that has it.
-- If *marker* is `-1`, deletes all markers from all lines.
-- @param buffer A buffer.
--- @param marker The marker number in the range of `0` to `31` to delete from
+-- @param marker The marker number in the range of `1` to `32` to delete from
-- all lines, or `-1` to delete all markers from all lines.
function marker_delete_all(buffer, marker) end
@@ -2288,8 +2281,8 @@ function marker_enable_highlight(buffer, enabled) end
---
-- Returns a bit-mask that represents the markers that were added to line number
-- *line*.
--- The first bit is set if marker number 0 is present, the second bit for marker
--- number 1, and so on.
+-- The first bit is set if marker number 1 is present, the second bit for marker
+-- number 2, and so on.
-- @param buffer A buffer.
-- @param line The line number to get markers on.
-- @return number
@@ -2307,11 +2300,12 @@ function marker_line_from_handle(buffer, handle) end
-- Returns the first line number, starting at line number *line*, that has had
-- all of the markers represented by marker bit-mask *marker_mask* added to it.
-- Returns `-1` if no line was found.
--- Bit 0 is set if marker 0 is set, bit 1 for marker 1, etc., up to marker 31.
+-- The first bit is set if marker 1 is set, the second bit for marker 2, etc.,
+-- up to marker 32.
-- @param buffer A buffer.
-- @param line The start line to search from.
--- @param marker_mask The mask of markers to find. Set bit 0 to find marker 0,
--- bit 1 for marker 1 and so on.
+-- @param marker_mask The mask of markers to find. Set the first bit to find
+-- marker 1, the second bit for marker 2, and so on.
-- @return number
function marker_next(buffer, line, marker_mask) end
@@ -2319,20 +2313,21 @@ function marker_next(buffer, line, marker_mask) end
-- Returns the last line number, before or on line number *line*, that has had
-- all of the markers represented by marker bit-mask *marker_mask* added to it.
-- Returns `-1` if no line was found.
--- Bit 0 is set if marker 0 is set, bit 1 for marker 1, etc., up to marker 31.
+-- The first bit is set if marker 1 is set, the second bit for marker 2, etc.,
+-- up to marker 32.
-- @param buffer A buffer.
-- @param line The start line to search from.
--- @param marker_mask The mask of markers to find. Set bit 0 to find marker 0,
--- bit 1 for marker 1 and so on.
+-- @param marker_mask The mask of markers to find. Set the first bit to find
+-- marker 1, the second bit for marker 2, and so on.
-- @return number
function marker_previous(buffer, line, marker_mask) end
---
--- Returns the symbol assigned to marker number *marker*, in the range of `0` to
--- `31`, used in `buffer.marker_define()`,
+-- Returns the symbol assigned to marker number *marker*, in the range of `1` to
+-- `32`, used in `buffer.marker_define()`,
-- `buffer.marker_define_pixmap()`, or `buffer.marker_define_rgba_image()`.
-- @param buffer A buffer.
--- @param marker The marker number in the range of `0` to `31` to get the symbol
+-- @param marker The marker number in the range of `1` to `32` to get the symbol
-- of.
-- @return number
function marker_symbol_defined(buffer, marker) end
@@ -2381,9 +2376,9 @@ function multi_edge_add_line(buffer, column, color) end
function multi_edge_clear_all(buffer) end
---
--- Returns the name of style number *style*, which is between `0` and `255`.
+-- Returns the name of style number *style*, which is between `1` and `256`.
-- @param buffer A buffer.
--- @param style The style number between `0` and `255` to get the name of.
+-- @param style The style number between `1` and `256` to get the name of.
-- @return string
function name_of_style(buffer, style) end
@@ -2467,7 +2462,7 @@ function position_after(buffer, pos) end
---
-- Returns the position of the character before position *pos* (taking
--- multi-byte characters into account), or `0` if there is no character before
+-- multi-byte characters into account), or `1` if there is no character before
-- *pos*.
-- @param buffer A buffer.
-- @param pos The position in *buffer* to get the position before from.
@@ -2476,7 +2471,7 @@ function position_before(buffer, pos) end
---
-- Returns the position at the beginning of line number *line*.
--- Returns `-1` if *line* is greater than `buffer.line_count`.
+-- Returns `-1` if *line* is greater than `buffer.line_count + 1`.
-- @param buffer A buffer.
-- @param line The line number in *buffer* to get the beginning position for.
-- @return number
@@ -2485,7 +2480,8 @@ function position_from_line(buffer, line) end
---
-- Returns the position *n* characters before or after position *pos* (taking
-- multi-byte characters into account).
--- Returns `0` if the position is less than 0 or greater than `buffer.length`.
+-- Returns `1` if the position is less than 1 or greater than
+-- `buffer.length + 1`.
-- @param buffer A buffer.
-- @param pos The position in *buffer* to get the relative position from.
-- @param n The relative number of characters to get the position for. A
@@ -2715,7 +2711,7 @@ function set_sel_fore(buffer, use_setting, color) end
function set_selection(buffer, end_pos, start_pos) end
---
--- Assigns style number *style*, in the range from `0` to `255`, to the next
+-- Assigns style number *style*, in the range from `1` to `256`, to the next
-- *length* characters, starting from the current styling position, and
-- increments the styling position by *length*.
-- [`buffer:start_styling`]() should be called before `buffer:set_styling()`.
@@ -2798,7 +2794,7 @@ function show_lines(buffer, start_line, end_line) end
-- @param buffer A buffer.
-- @param position The position in *buffer* to start styling at.
-- @param unused Unused number. `0` can be safely used.
--- @usage buffer:start_styling(0, 0)
+-- @usage buffer:start_styling(1, 0)
-- @see set_styling
function start_styling(buffer, position, unused) end
@@ -2867,9 +2863,9 @@ function text_height(buffer, line) end
---
-- Returns the pixel width string *text* would have when styled with style
--- number *style_num*, in the range of `0` to `255`.
+-- number *style_num*, in the range of `1` to `256`.
-- @param buffer A buffer.
--- @param style_num The style number between `0` and `255` to use.
+-- @param style_num The style number between `1` and `256` to use.
-- @param text The text to measure the width of.
-- @return number
function text_width(buffer, style_num, text) end
diff --git a/core/file_io.lua b/core/file_io.lua
index b6fe441a..aa5aedc6 100644
--- a/core/file_io.lua
+++ b/core/file_io.lua
@@ -126,7 +126,7 @@ function io.open_file(filenames, encodings)
buffer.encoding, text = encodings[i], text:iconv('UTF-8', encodings[i])
else
-- Try to detect character encoding and convert to UTF-8.
- local has_zeroes = text:sub(1, 65536):find('\0')
+ local has_zeroes = text:sub(1, 65535):find('\0')
for _, encoding in ipairs(io.encodings) do
if not has_zeroes or encoding:find('^UTF%-[13][62]') then
local ok, conv = pcall(string.iconv, text, 'UTF-8', encoding)
diff --git a/core/iface.lua b/core/iface.lua
index 8360bbed..5dbead53 100644
--- a/core/iface.lua
+++ b/core/iface.lua
@@ -14,7 +14,7 @@ module('_SCINTILLA')]]
-- @class table
-- @name constants
-- @see _G.buffer
-M.constants = {ACCESSIBILITY_DISABLED=0,ACCESSIBILITY_ENABLED=1,ALPHA_NOALPHA=256,ALPHA_OPAQUE=255,ALPHA_TRANSPARENT=0,ANNOTATION_BOXED=2,ANNOTATION_HIDDEN=0,ANNOTATION_INDENTED=3,ANNOTATION_STANDARD=1,AUTOMATICFOLD_CHANGE=0x0004,AUTOMATICFOLD_CLICK=0x0002,AUTOMATICFOLD_SHOW=0x0001,CARETSTICKY_OFF=0,CARETSTICKY_ON=1,CARETSTICKY_WHITESPACE=2,CARETSTYLE_BLOCK=2,CARETSTYLE_BLOCK_AFTER=0x100,CARETSTYLE_INS_MASK=0xF,CARETSTYLE_INVISIBLE=0,CARETSTYLE_LINE=1,CARETSTYLE_OVERSTRIKE_BAR=0,CARETSTYLE_OVERSTRIKE_BLOCK=0x10,CARET_EVEN=0x08,CARET_JUMPS=0x10,CARET_SLOP=0x01,CARET_STRICT=0x04,CASEINSENSITIVEBEHAVIOUR_IGNORECASE=1,CASEINSENSITIVEBEHAVIOUR_RESPECTCASE=0,CASE_CAMEL=3,CASE_LOWER=2,CASE_MIXED=0,CASE_UPPER=1,CHARACTERSOURCE_DIRECT_INPUT=0,CHARACTERSOURCE_IME_RESULT=2,CHARACTERSOURCE_TENTATIVE_INPUT=1,CP_UTF8=65001,CURSORARROW=2,CURSORNORMAL=-1,CURSORREVERSEARROW=7,CURSORWAIT=4,EDGE_BACKGROUND=2,EDGE_LINE=1,EDGE_MULTILINE=3,EDGE_NONE=0,EOL_CR=1,EOL_CRLF=0,EOL_LF=2,FIND_CXX11REGEX=0x00800000,FIND_MATCHCASE=0x4,FIND_NONE=0x0,FIND_REGEXP=10485760,FIND_WHOLEWORD=0x2,FIND_WORDSTART=0x00100000,FOLDACTION_CONTRACT=0,FOLDACTION_EXPAND=1,FOLDACTION_TOGGLE=2,FOLDDISPLAYTEXT_BOXED=2,FOLDDISPLAYTEXT_HIDDEN=0,FOLDDISPLAYTEXT_STANDARD=1,FOLDFLAG_LEVELNUMBERS=0x0040,FOLDFLAG_LINEAFTER_CONTRACTED=0x0010,FOLDFLAG_LINEAFTER_EXPANDED=0x0008,FOLDFLAG_LINEBEFORE_CONTRACTED=0x0004,FOLDFLAG_LINEBEFORE_EXPANDED=0x0002,FOLDFLAG_LINESTATE=0x0080,FOLDLEVELBASE=0x400,FOLDLEVELHEADERFLAG=0x2000,FOLDLEVELNUMBERMASK=0x0FFF,FOLDLEVELWHITEFLAG=0x1000,IDLESTYLING_AFTERVISIBLE=2,IDLESTYLING_ALL=3,IDLESTYLING_NONE=0,IDLESTYLING_TOVISIBLE=1,IME_INLINE=1,IME_WINDOWED=0,INDICATOR_CONTAINER=8,INDICATOR_IME=32,INDICATOR_IME_MAX=35,INDICATOR_MAX=35,INDIC_BOX=6,INDIC_COMPOSITIONTHICK=14,INDIC_COMPOSITIONTHIN=15,INDIC_CONTAINER=8,INDIC_DASH=9,INDIC_DIAGONAL=3,INDIC_DOTBOX=12,INDIC_DOTS=10,INDIC_FULLBOX=16,INDIC_GRADIENT=20,INDIC_GRADIENTCENTRE=21,INDIC_HIDDEN=5,INDIC_IME=32,INDIC_IME_MAX=35,INDIC_MAX=35,INDIC_PLAIN=0,INDIC_POINT=18,INDIC_POINTCHARACTER=19,INDIC_ROUNDBOX=7,INDIC_SQUIGGLE=1,INDIC_SQUIGGLELOW=11,INDIC_SQUIGGLEPIXMAP=13,INDIC_STRAIGHTBOX=8,INDIC_STRIKE=4,INDIC_TEXTFORE=17,INDIC_TT=2,IV_LOOKBOTH=3,IV_LOOKFORWARD=2,IV_NONE=0,IV_REAL=1,LASTSTEPINUNDOREDO=0x100,MARGINOPTION_NONE=0,MARGINOPTION_SUBLINESELECT=1,MARGIN_BACK=2,MARGIN_COLOUR=6,MARGIN_FORE=3,MARGIN_NUMBER=1,MARGIN_RTEXT=5,MARGIN_SYMBOL=0,MARGIN_TEXT=4,MARKER_MAX=31,MARKNUM_FOLDER=30,MARKNUM_FOLDEREND=25,MARKNUM_FOLDERMIDTAIL=27,MARKNUM_FOLDEROPEN=31,MARKNUM_FOLDEROPENMID=26,MARKNUM_FOLDERSUB=29,MARKNUM_FOLDERTAIL=28,MARK_ARROW=2,MARK_ARROWDOWN=6,MARK_ARROWS=24,MARK_AVAILABLE=28,MARK_BACKGROUND=22,MARK_BOOKMARK=31,MARK_BOXMINUS=14,MARK_BOXMINUSCONNECTED=15,MARK_BOXPLUS=12,MARK_BOXPLUSCONNECTED=13,MARK_CHARACTER=10000,MARK_CIRCLE=0,MARK_CIRCLEMINUS=20,MARK_CIRCLEMINUSCONNECTED=21,MARK_CIRCLEPLUS=18,MARK_CIRCLEPLUSCONNECTED=19,MARK_DOTDOTDOT=23,MARK_EMPTY=5,MARK_FULLRECT=26,MARK_LCORNER=10,MARK_LCORNERCURVE=16,MARK_LEFTRECT=27,MARK_MINUS=7,MARK_PIXMAP=25,MARK_PLUS=8,MARK_RGBAIMAGE=30,MARK_ROUNDRECT=1,MARK_SHORTARROW=4,MARK_SMALLRECT=3,MARK_TCORNER=11,MARK_TCORNERCURVE=17,MARK_UNDERLINE=29,MARK_VERTICALBOOKMARK=32,MARK_VLINE=9,MASK_FOLDERS=-33554432,MAX_MARGIN=4,MODEVENTMASKALL=0x3FFFFF,MOD_ALT=4,MOD_BEFOREDELETE=0x800,MOD_BEFOREINSERT=0x400,MOD_CHANGEANNOTATION=0x20000,MOD_CHANGEFOLD=0x8,MOD_CHANGEINDICATOR=0x4000,MOD_CHANGELINESTATE=0x8000,MOD_CHANGEMARGIN=0x10000,MOD_CHANGEMARKER=0x200,MOD_CHANGESTYLE=0x4,MOD_CHANGETABSTOPS=0x200000,MOD_CONTAINER=0x40000,MOD_CTRL=2,MOD_DELETETEXT=0x2,MOD_INSERTCHECK=0x100000,MOD_INSERTTEXT=0x1,MOD_LEXERSTATE=0x80000,MOD_META=16,MOD_NONE=0x0,MOD_NORM=0,MOD_SHIFT=1,MOD_SUPER=8,MOUSE_DRAG=2,MOUSE_PRESS=1,MOUSE_RELEASE=3,MULTIAUTOC_EACH=1,MULTIAUTOC_ONCE=0,MULTILINEUNDOREDO=0x1000,MULTIPASTE_EACH=1,MULTIPASTE_ONCE=0,MULTISTEPUNDOREDO=0x80,ORDER_CUSTOM=2,ORDER_PERFORMSORT=1,ORDER_PRESORTED=0,PERFORMED_REDO=0x40,PERFORMED_UNDO=0x20,PERFORMED_USER=0x10,SEL_LINES=2,SEL_RECTANGLE=1,SEL_STREAM=0,SEL_THIN=3,STARTACTION=0x2000,STYLE_BRACEBAD=35,STYLE_BRACELIGHT=34,STYLE_CALLTIP=38,STYLE_CONTROLCHAR=36,STYLE_DEFAULT=32,STYLE_FOLDDISPLAYTEXT=39,STYLE_INDENTGUIDE=37,STYLE_LASTPREDEFINED=39,STYLE_LINENUMBER=33,STYLE_MAX=255,TD_LONGARROW=0,TD_STRIKEOUT=1,TIME_FOREVER=10000000,UNDO_NONE=0,UPDATE_CONTENT=0x1,UPDATE_H_SCROLL=0x8,UPDATE_SELECTION=0x2,UPDATE_V_SCROLL=0x4,VISIBLE_SLOP=0x01,VISIBLE_STRICT=0x04,VS_NONE=0,VS_NOWRAPLINESTART=4,VS_RECTANGULARSELECTION=1,VS_USERACCESSIBLE=2,WRAPINDENT_DEEPINDENT=3,WRAPINDENT_FIXED=0,WRAPINDENT_INDENT=2,WRAPINDENT_SAME=1,WRAPVISUALFLAGLOC_DEFAULT=0x0000,WRAPVISUALFLAGLOC_END_BY_TEXT=0x0001,WRAPVISUALFLAGLOC_START_BY_TEXT=0x0002,WRAPVISUALFLAG_END=0x0001,WRAPVISUALFLAG_MARGIN=0x0004,WRAPVISUALFLAG_NONE=0x0000,WRAPVISUALFLAG_START=0x0002,WRAP_CHAR=2,WRAP_NONE=0,WRAP_WHITESPACE=3,WRAP_WORD=1,WS_INVISIBLE=0,WS_VISIBLEAFTERINDENT=2,WS_VISIBLEALWAYS=1,WS_VISIBLEONLYININDENT=3}
+M.constants = {ACCESSIBILITY_DISABLED=0,ACCESSIBILITY_ENABLED=1,ALPHA_NOALPHA=256,ALPHA_OPAQUE=255,ALPHA_TRANSPARENT=0,ANNOTATION_BOXED=2,ANNOTATION_HIDDEN=0,ANNOTATION_INDENTED=3,ANNOTATION_STANDARD=1,AUTOMATICFOLD_CHANGE=0x0004,AUTOMATICFOLD_CLICK=0x0002,AUTOMATICFOLD_SHOW=0x0001,CARETSTICKY_OFF=0,CARETSTICKY_ON=1,CARETSTICKY_WHITESPACE=2,CARETSTYLE_BLOCK=2,CARETSTYLE_BLOCK_AFTER=0x100,CARETSTYLE_INS_MASK=0xF,CARETSTYLE_INVISIBLE=0,CARETSTYLE_LINE=1,CARETSTYLE_OVERSTRIKE_BAR=0,CARETSTYLE_OVERSTRIKE_BLOCK=0x10,CARET_EVEN=0x08,CARET_JUMPS=0x10,CARET_SLOP=0x01,CARET_STRICT=0x04,CASEINSENSITIVEBEHAVIOUR_IGNORECASE=1,CASEINSENSITIVEBEHAVIOUR_RESPECTCASE=0,CASE_CAMEL=3,CASE_LOWER=2,CASE_MIXED=0,CASE_UPPER=1,CHARACTERSOURCE_DIRECT_INPUT=0,CHARACTERSOURCE_IME_RESULT=2,CHARACTERSOURCE_TENTATIVE_INPUT=1,CP_UTF8=65001,CURSORARROW=2,CURSORNORMAL=-1,CURSORREVERSEARROW=7,CURSORWAIT=4,EDGE_BACKGROUND=2,EDGE_LINE=1,EDGE_MULTILINE=3,EDGE_NONE=0,EOL_CR=1,EOL_CRLF=0,EOL_LF=2,FIND_CXX11REGEX=0x00800000,FIND_MATCHCASE=0x4,FIND_NONE=0x0,FIND_REGEXP=10485760,FIND_WHOLEWORD=0x2,FIND_WORDSTART=0x00100000,FOLDACTION_CONTRACT=0,FOLDACTION_EXPAND=1,FOLDACTION_TOGGLE=2,FOLDDISPLAYTEXT_BOXED=2,FOLDDISPLAYTEXT_HIDDEN=0,FOLDDISPLAYTEXT_STANDARD=1,FOLDFLAG_LEVELNUMBERS=0x0040,FOLDFLAG_LINEAFTER_CONTRACTED=0x0010,FOLDFLAG_LINEAFTER_EXPANDED=0x0008,FOLDFLAG_LINEBEFORE_CONTRACTED=0x0004,FOLDFLAG_LINEBEFORE_EXPANDED=0x0002,FOLDFLAG_LINESTATE=0x0080,FOLDLEVELBASE=0x400,FOLDLEVELHEADERFLAG=0x2000,FOLDLEVELNUMBERMASK=0x0FFF,FOLDLEVELWHITEFLAG=0x1000,IDLESTYLING_AFTERVISIBLE=2,IDLESTYLING_ALL=3,IDLESTYLING_NONE=0,IDLESTYLING_TOVISIBLE=1,IME_INLINE=1,IME_WINDOWED=0,INDICATOR_CONTAINER=9,INDICATOR_IME=33,INDICATOR_IME_MAX=36,INDICATOR_MAX=36,INDIC_BOX=6,INDIC_COMPOSITIONTHICK=14,INDIC_COMPOSITIONTHIN=15,INDIC_CONTAINER=9,INDIC_DASH=9,INDIC_DIAGONAL=3,INDIC_DOTBOX=12,INDIC_DOTS=10,INDIC_FULLBOX=16,INDIC_GRADIENT=20,INDIC_GRADIENTCENTRE=21,INDIC_HIDDEN=5,INDIC_IME=33,INDIC_IME_MAX=36,INDIC_MAX=36,INDIC_PLAIN=0,INDIC_POINT=18,INDIC_POINTCHARACTER=19,INDIC_ROUNDBOX=7,INDIC_SQUIGGLE=1,INDIC_SQUIGGLELOW=11,INDIC_SQUIGGLEPIXMAP=13,INDIC_STRAIGHTBOX=8,INDIC_STRIKE=4,INDIC_TEXTFORE=17,INDIC_TT=2,IV_LOOKBOTH=3,IV_LOOKFORWARD=2,IV_NONE=0,IV_REAL=1,LASTSTEPINUNDOREDO=0x100,MARGINOPTION_NONE=0,MARGINOPTION_SUBLINESELECT=1,MARGIN_BACK=2,MARGIN_COLOUR=6,MARGIN_FORE=3,MARGIN_NUMBER=1,MARGIN_RTEXT=5,MARGIN_SYMBOL=0,MARGIN_TEXT=4,MARKER_MAX=32,MARKNUM_FOLDER=31,MARKNUM_FOLDEREND=26,MARKNUM_FOLDERMIDTAIL=28,MARKNUM_FOLDEROPEN=32,MARKNUM_FOLDEROPENMID=27,MARKNUM_FOLDERSUB=30,MARKNUM_FOLDERTAIL=29,MARK_ARROW=2,MARK_ARROWDOWN=6,MARK_ARROWS=24,MARK_AVAILABLE=28,MARK_BACKGROUND=22,MARK_BOOKMARK=31,MARK_BOXMINUS=14,MARK_BOXMINUSCONNECTED=15,MARK_BOXPLUS=12,MARK_BOXPLUSCONNECTED=13,MARK_CHARACTER=10000,MARK_CIRCLE=0,MARK_CIRCLEMINUS=20,MARK_CIRCLEMINUSCONNECTED=21,MARK_CIRCLEPLUS=18,MARK_CIRCLEPLUSCONNECTED=19,MARK_DOTDOTDOT=23,MARK_EMPTY=5,MARK_FULLRECT=26,MARK_LCORNER=10,MARK_LCORNERCURVE=16,MARK_LEFTRECT=27,MARK_MINUS=7,MARK_PIXMAP=25,MARK_PLUS=8,MARK_RGBAIMAGE=30,MARK_ROUNDRECT=1,MARK_SHORTARROW=4,MARK_SMALLRECT=3,MARK_TCORNER=11,MARK_TCORNERCURVE=17,MARK_UNDERLINE=29,MARK_VERTICALBOOKMARK=32,MARK_VLINE=9,MASK_FOLDERS=0xFE000000,MAX_MARGIN=5,MODEVENTMASKALL=0x3FFFFF,MOD_ALT=4,MOD_BEFOREDELETE=0x800,MOD_BEFOREINSERT=0x400,MOD_CHANGEANNOTATION=0x20000,MOD_CHANGEFOLD=0x8,MOD_CHANGEINDICATOR=0x4000,MOD_CHANGELINESTATE=0x8000,MOD_CHANGEMARGIN=0x10000,MOD_CHANGEMARKER=0x200,MOD_CHANGESTYLE=0x4,MOD_CHANGETABSTOPS=0x200000,MOD_CONTAINER=0x40000,MOD_CTRL=2,MOD_DELETETEXT=0x2,MOD_INSERTCHECK=0x100000,MOD_INSERTTEXT=0x1,MOD_LEXERSTATE=0x80000,MOD_META=16,MOD_NONE=0x0,MOD_NORM=0,MOD_SHIFT=1,MOD_SUPER=8,MOUSE_DRAG=2,MOUSE_PRESS=1,MOUSE_RELEASE=3,MULTIAUTOC_EACH=1,MULTIAUTOC_ONCE=0,MULTILINEUNDOREDO=0x1000,MULTIPASTE_EACH=1,MULTIPASTE_ONCE=0,MULTISTEPUNDOREDO=0x80,ORDER_CUSTOM=2,ORDER_PERFORMSORT=1,ORDER_PRESORTED=0,PERFORMED_REDO=0x40,PERFORMED_UNDO=0x20,PERFORMED_USER=0x10,SEL_LINES=2,SEL_RECTANGLE=1,SEL_STREAM=0,SEL_THIN=3,STARTACTION=0x2000,STYLE_BRACEBAD=35,STYLE_BRACELIGHT=34,STYLE_CALLTIP=38,STYLE_CONTROLCHAR=36,STYLE_DEFAULT=32,STYLE_FOLDDISPLAYTEXT=39,STYLE_INDENTGUIDE=37,STYLE_LASTPREDEFINED=39,STYLE_LINENUMBER=33,STYLE_MAX=256,TD_LONGARROW=0,TD_STRIKEOUT=1,TIME_FOREVER=10000000,UNDO_NONE=0,UPDATE_CONTENT=0x1,UPDATE_H_SCROLL=0x8,UPDATE_SELECTION=0x2,UPDATE_V_SCROLL=0x4,VISIBLE_SLOP=0x01,VISIBLE_STRICT=0x04,VS_NONE=0,VS_NOWRAPLINESTART=4,VS_RECTANGULARSELECTION=1,VS_USERACCESSIBLE=2,WRAPINDENT_DEEPINDENT=3,WRAPINDENT_FIXED=0,WRAPINDENT_INDENT=2,WRAPINDENT_SAME=1,WRAPVISUALFLAGLOC_DEFAULT=0x0000,WRAPVISUALFLAGLOC_END_BY_TEXT=0x0001,WRAPVISUALFLAGLOC_START_BY_TEXT=0x0002,WRAPVISUALFLAG_END=0x0001,WRAPVISUALFLAG_MARGIN=0x0004,WRAPVISUALFLAG_NONE=0x0000,WRAPVISUALFLAG_START=0x0002,WRAP_CHAR=2,WRAP_NONE=0,WRAP_WHITESPACE=3,WRAP_WORD=1,WS_INVISIBLE=0,WS_VISIBLEAFTERINDENT=2,WS_VISIBLEALWAYS=1,WS_VISIBLEONLYININDENT=3}
---
-- Map of Scintilla function names to tables containing their IDs, return types,
@@ -31,7 +31,7 @@ M.constants = {ACCESSIBILITY_DISABLED=0,ACCESSIBILITY_ENABLED=1,ALPHA_NOALPHA=25
-- + `8`: String return value.
-- @class table
-- @name functions
-M.functions = {add_ref_document={2376,0,0,1},add_selection={2573,0,1,1},add_styled_text={2002,0,2,8},add_tab_stop={2676,0,1,1},add_text={2001,0,2,6},add_undo_action={2560,0,1,1},allocate={2446,0,1,0},allocate_extended_styles={2553,1,1,0},allocate_sub_styles={4020,1,1,1},annotation_clear_all={2547,0,0,0},append_text={2282,0,2,6},assign_cmd_key={2070,0,5,1},auto_c_active={2102,4,0,0},auto_c_cancel={2101,0,0,0},auto_c_complete={2104,0,0,0},auto_c_pos_start={2103,1,0,0},auto_c_select={2108,0,0,6},auto_c_show={2100,0,1,6},auto_c_stops={2105,0,0,6},back_tab={2328,0,0,0},begin_undo_action={2078,0,0,0},brace_bad_light={2352,0,1,0},brace_bad_light_indicator={2499,0,4,1},brace_highlight={2351,0,1,1},brace_highlight_indicator={2498,0,4,1},brace_match={2353,1,1,1},call_tip_active={2202,4,0,0},call_tip_cancel={2201,0,0,0},call_tip_pos_start={2203,1,0,0},call_tip_set_hlt={2204,0,1,1},call_tip_show={2200,0,1,6},can_paste={2173,4,0,0},can_redo={2016,4,0,0},can_undo={2174,4,0,0},cancel={2325,0,0,0},change_insertion={2672,0,2,6},change_lexer_state={2617,1,1,1},char_left={2304,0,0,0},char_left_extend={2305,0,0,0},char_left_rect_extend={2428,0,0,0},char_position_from_point={2561,1,1,1},char_position_from_point_close={2562,1,1,1},char_right={2306,0,0,0},char_right_extend={2307,0,0,0},char_right_rect_extend={2429,0,0,0},choose_caret_x={2399,0,0,0},clear={2180,0,0,0},clear_all={2004,0,0,0},clear_all_cmd_keys={2072,0,0,0},clear_cmd_key={2071,0,5,0},clear_document_style={2005,0,0,0},clear_registered_images={2408,0,0,0},clear_representation={2667,0,6,0},clear_selections={2571,0,0,0},clear_tab_stops={2675,0,1,0},colourise={4003,0,1,1},contracted_fold_next={2618,1,1,0},convert_eols={2029,0,1,0},copy={2178,0,0,0},copy_allow_line={2519,0,0,0},copy_range={2419,0,1,1},copy_text={2420,0,2,6},count_characters={2633,1,1,1},count_code_units={2715,1,1,1},create_document={2375,1,1,1},create_loader={2632,1,1,1},cut={2177,0,0,0},del_line_left={2395,0,0,0},del_line_right={2396,0,0,0},del_word_left={2335,0,0,0},del_word_right={2336,0,0,0},del_word_right_end={2518,0,0,0},delete_back={2326,0,0,0},delete_back_not_line={2344,0,0,0},delete_range={2645,0,1,1},describe_key_word_sets={4017,1,0,7},describe_property={4016,1,6,7},description_of_style={4032,1,1,7},doc_line_from_visible={2221,1,1,0},document_end={2318,0,0,0},document_end_extend={2319,0,0,0},document_start={2316,0,0,0},document_start_extend={2317,0,0,0},drop_selection_n={2671,0,1,0},edit_toggle_overtype={2324,0,0,0},empty_undo_buffer={2175,0,0,0},encoded_from_utf8={2449,1,6,7},end_undo_action={2079,0,0,0},ensure_visible={2232,0,1,0},ensure_visible_enforce_policy={2234,0,1,0},expand_children={2239,0,1,1},find_column={2456,1,1,1},find_indicator_flash={2641,0,1,1},find_indicator_hide={2642,0,0,0},find_indicator_show={2640,0,1,1},find_text={2150,1,1,10},fold_all={2662,0,1,0},fold_children={2238,0,1,1},fold_line={2237,0,1,1},form_feed={2330,0,0,0},format_range={2151,1,4,11},free_sub_styles={4023,0,0,0},get_cur_line={2027,1,2,7},get_default_fold_display_text={2723,1,0,7},get_hotspot_active_back={2495,3,0,0},get_hotspot_active_fore={2494,3,0,0},get_last_child={2224,1,1,1},get_line={2153,1,1,7},get_line_sel_end_position={2425,1,1,0},get_line_sel_start_position={2424,1,1,0},get_next_tab_stop={2677,1,1,1},get_range_pointer={2643,1,1,1},get_sel_text={2161,1,0,7},get_styled_text={2015,1,0,9},get_text={2182,1,2,7},get_text_range={2162,1,0,9},goto_line={2024,0,1,0},goto_pos={2025,0,1,0},grab_focus={2400,0,0,0},hide_lines={2227,0,1,1},hide_selection={2163,0,4,0},home={2312,0,0,0},home_display={2345,0,0,0},home_display_extend={2346,0,0,0},home_extend={2313,0,0,0},home_rect_extend={2430,0,0,0},home_wrap={2349,0,0,0},home_wrap_extend={2450,0,0,0},indicator_all_on_for={2506,1,1,0},indicator_clear_range={2505,0,1,1},indicator_end={2509,1,1,1},indicator_fill_range={2504,0,1,1},indicator_start={2508,1,1,1},indicator_value_at={2507,1,1,1},insert_text={2003,0,1,6},is_range_word={2691,4,1,1},line_copy={2455,0,0,0},line_cut={2337,0,0,0},line_delete={2338,0,0,0},line_down={2300,0,0,0},line_down_extend={2301,0,0,0},line_down_rect_extend={2426,0,0,0},line_duplicate={2404,0,0,0},line_end={2314,0,0,0},line_end_display={2347,0,0,0},line_end_display_extend={2348,0,0,0},line_end_extend={2315,0,0,0},line_end_rect_extend={2432,0,0,0},line_end_wrap={2451,0,0,0},line_end_wrap_extend={2452,0,0,0},line_from_position={2166,1,1,0},line_length={2350,1,1,0},line_reverse={2354,0,0,0},line_scroll={2168,0,1,1},line_scroll_down={2342,0,0,0},line_scroll_up={2343,0,0,0},line_transpose={2339,0,0,0},line_up={2302,0,0,0},line_up_extend={2303,0,0,0},line_up_rect_extend={2427,0,0,0},lines_join={2288,0,0,0},lines_split={2289,0,1,0},load_lexer_library={4007,0,0,6},lower_case={2340,0,0,0},margin_text_clear_all={2536,0,0,0},marker_add={2043,1,1,1},marker_add_set={2466,0,1,1},marker_define={2040,0,1,1},marker_define_pixmap={2049,0,1,6},marker_define_rgba_image={2626,0,1,6},marker_delete={2044,0,1,1},marker_delete_all={2045,0,1,0},marker_delete_handle={2018,0,1,0},marker_enable_highlight={2293,0,4,0},marker_get={2046,1,1,0},marker_line_from_handle={2017,1,1,0},marker_next={2047,1,1,1},marker_previous={2048,1,1,1},marker_symbol_defined={2529,1,1,0},move_caret_inside_view={2401,0,0,0},move_selected_lines_down={2621,0,0,0},move_selected_lines_up={2620,0,0,0},multi_edge_add_line={2694,0,1,3},multi_edge_clear_all={2695,0,0,0},multiple_select_add_each={2689,0,0,0},multiple_select_add_next={2688,0,0,0},name_of_style={4030,1,1,7},new_line={2329,0,0,0},null={2172,0,0,0},page_down={2322,0,0,0},page_down_extend={2323,0,0,0},page_down_rect_extend={2434,0,0,0},page_up={2320,0,0,0},page_up_extend={2321,0,0,0},page_up_rect_extend={2433,0,0,0},para_down={2413,0,0,0},para_down_extend={2414,0,0,0},para_up={2415,0,0,0},para_up_extend={2416,0,0,0},paste={2179,0,0,0},point_x_from_position={2164,1,0,1},point_y_from_position={2165,1,0,1},position_after={2418,1,1,0},position_before={2417,1,1,0},position_from_line={2167,1,1,0},position_from_point={2022,1,1,1},position_from_point_close={2023,1,1,1},position_relative={2670,1,1,1},position_relative_code_units={2716,1,1,1},private_lexer_call={4013,1,1,1},property_names={4014,1,0,7},property_type={4015,1,6,0},redo={2011,0,0,0},register_image={2405,0,1,6},register_rgba_image={2627,0,1,6},release_all_extended_styles={2552,0,0,0},release_document={2377,0,0,1},replace_sel={2170,0,0,6},replace_target={2194,1,2,6},replace_target_re={2195,1,2,6},rotate_selection={2606,0,0,0},scroll_caret={2169,0,0,0},scroll_range={2569,0,1,1},scroll_to_end={2629,0,0,0},scroll_to_start={2628,0,0,0},search_anchor={2366,0,0,0},search_in_target={2197,1,2,6},search_next={2367,1,1,6},search_prev={2368,1,1,6},select_all={2013,0,0,0},selection_duplicate={2469,0,0,0},set_chars_default={2444,0,0,0},set_default_fold_display_text={2722,0,0,6},set_empty_selection={2556,0,1,0},set_fold_margin_colour={2290,0,4,3},set_fold_margin_hi_colour={2291,0,4,3},set_hotspot_active_back={2411,0,4,3},set_hotspot_active_fore={2410,0,4,3},set_length_for_encode={2448,0,1,0},set_save_point={2014,0,0,0},set_sel={2160,0,1,1},set_sel_back={2068,0,4,3},set_sel_fore={2067,0,4,3},set_selection={2572,0,1,1},set_styling={2033,0,2,1},set_styling_ex={2073,0,2,6},set_target_range={2686,0,1,1},set_text={2181,0,0,6},set_visible_policy={2394,0,1,1},set_whitespace_back={2085,0,4,3},set_whitespace_fore={2084,0,4,3},set_x_caret_policy={2402,0,1,1},set_y_caret_policy={2403,0,1,1},show_lines={2226,0,1,1},start_record={3001,0,0,0},start_styling={2032,0,1,1},stop_record={3002,0,0,0},stuttered_page_down={2437,0,0,0},stuttered_page_down_extend={2438,0,0,0},stuttered_page_up={2435,0,0,0},stuttered_page_up_extend={2436,0,0,0},style_clear_all={2050,0,0,0},style_reset_default={2058,0,0,0},swap_main_anchor_caret={2607,0,0,0},tab={2327,0,0,0},tags_of_style={4031,1,1,7},target_as_utf8={2447,1,0,7},target_from_selection={2287,0,0,0},target_whole_document={2690,0,0,0},text_height={2279,1,1,0},text_width={2276,1,1,6},toggle_caret_sticky={2459,0,0,0},toggle_fold={2231,0,1,0},toggle_fold_show_text={2700,0,1,6},undo={2176,0,0,0},upper_case={2341,0,0,0},use_pop_up={2371,0,1,0},user_list_show={2117,0,1,6},vc_home={2331,0,0,0},vc_home_display={2652,0,0,0},vc_home_display_extend={2653,0,0,0},vc_home_extend={2332,0,0,0},vc_home_rect_extend={2431,0,0,0},vc_home_wrap={2453,0,0,0},vc_home_wrap_extend={2454,0,0,0},vertical_centre_caret={2619,0,0,0},visible_from_doc_line={2220,1,1,0},word_end_position={2267,1,1,4},word_left={2308,0,0,0},word_left_end={2439,0,0,0},word_left_end_extend={2440,0,0,0},word_left_extend={2309,0,0,0},word_part_left={2390,0,0,0},word_part_left_extend={2391,0,0,0},word_part_right={2392,0,0,0},word_part_right_extend={2393,0,0,0},word_right={2310,0,0,0},word_right_end={2441,0,0,0},word_right_end_extend={2442,0,0,0},word_right_extend={2311,0,0,0},word_start_position={2266,1,1,4},wrap_count={2235,1,1,0},zoom_in={2333,0,0,0},zoom_out={2334,0,0,0},}
+M.functions = {add_ref_document={2376,0,0,1},add_selection={2573,0,3,3},add_styled_text={2002,0,2,9},add_tab_stop={2676,0,3,1},add_text={2001,0,2,7},add_undo_action={2560,0,1,1},allocate={2446,0,3,0},allocate_extended_styles={2553,1,1,0},allocate_sub_styles={4020,1,1,1},annotation_clear_all={2547,0,0,0},append_text={2282,0,2,7},assign_cmd_key={2070,0,6,1},auto_c_active={2102,5,0,0},auto_c_cancel={2101,0,0,0},auto_c_complete={2104,0,0,0},auto_c_pos_start={2103,3,0,0},auto_c_select={2108,0,0,7},auto_c_show={2100,0,1,7},auto_c_stops={2105,0,0,7},back_tab={2328,0,0,0},begin_undo_action={2078,0,0,0},brace_bad_light={2352,0,3,0},brace_bad_light_indicator={2499,0,5,3},brace_highlight={2351,0,3,3},brace_highlight_indicator={2498,0,5,3},brace_match={2353,3,3,1},call_tip_active={2202,5,0,0},call_tip_cancel={2201,0,0,0},call_tip_pos_start={2203,3,0,0},call_tip_set_hlt={2204,0,3,3},call_tip_show={2200,0,3,7},can_paste={2173,5,0,0},can_redo={2016,5,0,0},can_undo={2174,5,0,0},cancel={2325,0,0,0},change_insertion={2672,0,2,7},change_lexer_state={2617,1,3,3},char_left={2304,0,0,0},char_left_extend={2305,0,0,0},char_left_rect_extend={2428,0,0,0},char_position_from_point={2561,3,1,1},char_position_from_point_close={2562,3,1,1},char_right={2306,0,0,0},char_right_extend={2307,0,0,0},char_right_rect_extend={2429,0,0,0},choose_caret_x={2399,0,0,0},clear={2180,0,0,0},clear_all={2004,0,0,0},clear_all_cmd_keys={2072,0,0,0},clear_cmd_key={2071,0,6,0},clear_document_style={2005,0,0,0},clear_registered_images={2408,0,0,0},clear_representation={2667,0,7,0},clear_selections={2571,0,0,0},clear_tab_stops={2675,0,3,0},colourise={4003,0,3,3},contracted_fold_next={2618,3,3,0},convert_eols={2029,0,1,0},copy={2178,0,0,0},copy_allow_line={2519,0,0,0},copy_range={2419,0,3,3},copy_text={2420,0,2,7},count_characters={2633,1,3,3},count_code_units={2715,1,3,3},create_document={2375,1,3,1},create_loader={2632,1,3,1},cut={2177,0,0,0},del_line_left={2395,0,0,0},del_line_right={2396,0,0,0},del_word_left={2335,0,0,0},del_word_right={2336,0,0,0},del_word_right_end={2518,0,0,0},delete_back={2326,0,0,0},delete_back_not_line={2344,0,0,0},delete_range={2645,0,3,2},describe_key_word_sets={4017,0,0,8},describe_property={4016,0,7,8},description_of_style={4032,0,3,8},doc_line_from_visible={2221,3,3,0},document_end={2318,0,0,0},document_end_extend={2319,0,0,0},document_start={2316,0,0,0},document_start_extend={2317,0,0,0},drop_selection_n={2671,0,3,0},edit_toggle_overtype={2324,0,0,0},empty_undo_buffer={2175,0,0,0},encoded_from_utf8={2449,0,7,8},end_undo_action={2079,0,0,0},ensure_visible={2232,0,3,0},ensure_visible_enforce_policy={2234,0,3,0},expand_children={2239,0,3,1},find_column={2456,3,3,3},find_indicator_flash={2641,0,3,3},find_indicator_hide={2642,0,0,0},find_indicator_show={2640,0,3,3},find_text={2150,3,1,11},fold_all={2662,0,1,0},fold_children={2238,0,3,1},fold_line={2237,0,3,1},form_feed={2330,0,0,0},format_range={2151,3,5,12},free_sub_styles={4023,0,0,0},get_cur_line={2027,3,2,8},get_default_fold_display_text={2723,0,0,8},get_hotspot_active_back={2495,4,0,0},get_hotspot_active_fore={2494,4,0,0},get_line={2153,0,3,8},get_line_sel_end_position={2425,3,3,0},get_line_sel_start_position={2424,3,3,0},get_next_tab_stop={2677,1,3,1},get_sel_text={2161,0,0,8},get_styled_text={2015,3,0,10},get_text={2182,0,2,8},get_text_range={2162,3,0,10},goto_line={2024,0,3,0},goto_pos={2025,0,3,0},grab_focus={2400,0,0,0},hide_lines={2227,0,3,3},hide_selection={2163,0,5,0},home={2312,0,0,0},home_display={2345,0,0,0},home_display_extend={2346,0,0,0},home_extend={2313,0,0,0},home_rect_extend={2430,0,0,0},home_wrap={2349,0,0,0},home_wrap_extend={2450,0,0,0},indicator_all_on_for={2506,1,3,0},indicator_clear_range={2505,0,3,2},indicator_end={2509,3,3,3},indicator_fill_range={2504,0,3,2},indicator_start={2508,3,3,3},indicator_value_at={2507,1,3,3},insert_text={2003,0,3,7},is_range_word={2691,5,3,3},line_copy={2455,0,0,0},line_cut={2337,0,0,0},line_delete={2338,0,0,0},line_down={2300,0,0,0},line_down_extend={2301,0,0,0},line_down_rect_extend={2426,0,0,0},line_duplicate={2404,0,0,0},line_end={2314,0,0,0},line_end_display={2347,0,0,0},line_end_display_extend={2348,0,0,0},line_end_extend={2315,0,0,0},line_end_rect_extend={2432,0,0,0},line_end_wrap={2451,0,0,0},line_end_wrap_extend={2452,0,0,0},line_from_position={2166,3,3,0},line_length={2350,1,3,0},line_reverse={2354,0,0,0},line_scroll={2168,0,1,1},line_scroll_down={2342,0,0,0},line_scroll_up={2343,0,0,0},line_transpose={2339,0,0,0},line_up={2302,0,0,0},line_up_extend={2303,0,0,0},line_up_rect_extend={2427,0,0,0},lines_join={2288,0,0,0},lines_split={2289,0,1,0},load_lexer_library={4007,0,0,7},lower_case={2340,0,0,0},margin_text_clear_all={2536,0,0,0},marker_add={2043,1,3,3},marker_add_set={2466,0,3,1},marker_define={2040,0,3,1},marker_define_pixmap={2049,0,3,7},marker_define_rgba_image={2626,0,3,7},marker_delete={2044,0,3,3},marker_delete_all={2045,0,3,0},marker_delete_handle={2018,0,1,0},marker_enable_highlight={2293,0,5,0},marker_get={2046,1,3,0},marker_line_from_handle={2017,3,1,0},marker_next={2047,3,3,1},marker_previous={2048,3,3,1},marker_symbol_defined={2529,1,3,0},move_caret_inside_view={2401,0,0,0},move_selected_lines_down={2621,0,0,0},move_selected_lines_up={2620,0,0,0},multi_edge_add_line={2694,0,1,4},multi_edge_clear_all={2695,0,0,0},multiple_select_add_each={2689,0,0,0},multiple_select_add_next={2688,0,0,0},name_of_style={4030,0,3,8},new_line={2329,0,0,0},null={2172,0,0,0},page_down={2322,0,0,0},page_down_extend={2323,0,0,0},page_down_rect_extend={2434,0,0,0},page_up={2320,0,0,0},page_up_extend={2321,0,0,0},page_up_rect_extend={2433,0,0,0},para_down={2413,0,0,0},para_down_extend={2414,0,0,0},para_up={2415,0,0,0},para_up_extend={2416,0,0,0},paste={2179,0,0,0},point_x_from_position={2164,1,0,3},point_y_from_position={2165,1,0,3},position_after={2418,3,3,0},position_before={2417,3,3,0},position_from_line={2167,3,3,0},position_from_point={2022,3,1,1},position_from_point_close={2023,3,1,1},position_relative={2670,3,3,1},position_relative_code_units={2716,3,3,3},private_lexer_call={4013,1,1,1},property_names={4014,0,0,8},property_type={4015,1,7,0},redo={2011,0,0,0},register_image={2405,0,1,7},register_rgba_image={2627,0,1,7},release_all_extended_styles={2552,0,0,0},release_document={2377,0,0,1},replace_sel={2170,0,0,7},replace_target={2194,1,2,7},replace_target_re={2195,1,2,7},rotate_selection={2606,0,0,0},scroll_caret={2169,0,0,0},scroll_range={2569,0,3,3},scroll_to_end={2629,0,0,0},scroll_to_start={2628,0,0,0},search_anchor={2366,0,0,0},search_in_target={2197,3,2,7},search_next={2367,3,1,7},search_prev={2368,3,1,7},select_all={2013,0,0,0},selection_duplicate={2469,0,0,0},set_chars_default={2444,0,0,0},set_default_fold_display_text={2722,0,0,7},set_empty_selection={2556,0,3,0},set_fold_margin_colour={2290,0,5,4},set_fold_margin_hi_colour={2291,0,5,4},set_hotspot_active_back={2411,0,5,4},set_hotspot_active_fore={2410,0,5,4},set_length_for_encode={2448,0,3,0},set_save_point={2014,0,0,0},set_sel={2160,0,3,3},set_sel_back={2068,0,5,4},set_sel_fore={2067,0,5,4},set_selection={2572,0,3,3},set_styling={2033,0,2,3},set_styling_ex={2073,0,2,7},set_target_range={2686,0,3,3},set_text={2181,0,0,7},set_visible_policy={2394,0,1,1},set_whitespace_back={2085,0,5,4},set_whitespace_fore={2084,0,5,4},set_x_caret_policy={2402,0,1,1},set_y_caret_policy={2403,0,1,1},show_lines={2226,0,3,3},start_record={3001,0,0,0},start_styling={2032,0,3,1},stop_record={3002,0,0,0},stuttered_page_down={2437,0,0,0},stuttered_page_down_extend={2438,0,0,0},stuttered_page_up={2435,0,0,0},stuttered_page_up_extend={2436,0,0,0},style_clear_all={2050,0,0,0},style_reset_default={2058,0,0,0},swap_main_anchor_caret={2607,0,0,0},tab={2327,0,0,0},tags_of_style={4031,0,3,8},target_as_utf8={2447,0,0,8},target_from_selection={2287,0,0,0},target_whole_document={2690,0,0,0},text_height={2279,1,3,0},text_width={2276,1,3,7},toggle_caret_sticky={2459,0,0,0},toggle_fold={2231,0,3,0},toggle_fold_show_text={2700,0,3,7},undo={2176,0,0,0},upper_case={2341,0,0,0},use_pop_up={2371,0,1,0},user_list_show={2117,0,1,7},vc_home={2331,0,0,0},vc_home_display={2652,0,0,0},vc_home_display_extend={2653,0,0,0},vc_home_extend={2332,0,0,0},vc_home_rect_extend={2431,0,0,0},vc_home_wrap={2453,0,0,0},vc_home_wrap_extend={2454,0,0,0},vertical_centre_caret={2619,0,0,0},visible_from_doc_line={2220,3,3,0},word_end_position={2267,3,3,5},word_left={2308,0,0,0},word_left_end={2439,0,0,0},word_left_end_extend={2440,0,0,0},word_left_extend={2309,0,0,0},word_part_left={2390,0,0,0},word_part_left_extend={2391,0,0,0},word_part_right={2392,0,0,0},word_part_right_extend={2393,0,0,0},word_right={2310,0,0,0},word_right_end={2441,0,0,0},word_right_end_extend={2442,0,0,0},word_right_extend={2311,0,0,0},word_start_position={2266,3,3,5},wrap_count={2235,1,3,0},zoom_in={2333,0,0,0},zoom_out={2334,0,0,0},}
---
-- Map of Scintilla property names to table values containing their "get"
@@ -41,15 +41,15 @@ M.functions = {add_ref_document={2376,0,0,1},add_selection={2573,0,1,1},add_styl
-- @see functions
-- @class table
-- @name properties
-M.properties = {accessibility={2703,2702,1,0},additional_caret_fore={2605,2604,3,0},additional_carets_blink={2568,2567,4,0},additional_carets_visible={2609,2608,4,0},additional_sel_alpha={2603,2602,1,0},additional_sel_back={0,2601,3,0},additional_sel_fore={0,2600,3,0},additional_selection_typing={2566,2565,4,0},all_lines_visible={2236,0,4,0},anchor={2009,2026,1,0},annotation_lines={2546,0,1,1},annotation_style={2543,2542,1,1},annotation_style_offset={2551,2550,1,0},annotation_styles={2545,2544,7,1},annotation_text={2541,2540,7,1},annotation_visible={2549,2548,1,0},auto_c_auto_hide={2119,2118,4,0},auto_c_cancel_at_start={2111,2110,4,0},auto_c_case_insensitive_behaviour={2635,2634,1,0},auto_c_choose_single={2114,2113,4,0},auto_c_current={2445,0,1,0},auto_c_current_text={2610,0,7,0},auto_c_drop_rest_of_word={2271,2270,4,0},auto_c_fill_ups={0,2112,6,0},auto_c_ignore_case={2116,2115,4,0},auto_c_max_height={2211,2210,1,0},auto_c_max_width={2209,2208,1,0},auto_c_multi={2637,2636,1,0},auto_c_order={2661,2660,1,0},auto_c_separator={2107,2106,1,0},auto_c_type_separator={2285,2286,1,0},automatic_fold={2664,2663,1,0},back_space_un_indents={2263,2262,4,0},buffered_draw={2034,2035,4,0},call_tip_back={0,2205,3,0},call_tip_fore={0,2206,3,0},call_tip_fore_hlt={0,2207,3,0},call_tip_pos_start={0,2214,1,0},call_tip_position={0,2213,4,0},call_tip_use_style={0,2212,1,0},caret_fore={2138,2069,3,0},caret_line_back={2097,2098,3,0},caret_line_back_alpha={2471,2470,1,0},caret_line_frame={2704,2705,1,0},caret_line_visible={2095,2096,4,0},caret_line_visible_always={2654,2655,4,0},caret_period={2075,2076,1,0},caret_sticky={2457,2458,1,0},caret_style={2513,2512,1,0},caret_width={2189,2188,1,0},char_at={2007,0,1,1},character_category_optimization={2721,2720,1,0},character_pointer={2520,0,1,0},code_page={2137,2037,1,0},column={2129,0,1,1},command_events={2718,2717,4,0},control_char_symbol={2389,2388,1,0},current_pos={2008,2141,1,0},cursor={2387,2386,1,0},direct_function={2184,0,1,0},direct_pointer={2185,0,1,0},distance_to_secondary_styles={4025,0,1,0},doc_pointer={2357,2358,1,0},document_options={2379,0,1,0},edge_colour={2364,2365,3,0},edge_column={2360,2361,1,0},edge_mode={2362,2363,1,0},end_at_last_line={2278,2277,4,0},end_styled={2028,0,1,0},eol_mode={2030,2031,1,0},extra_ascent={2526,2525,1,0},extra_descent={2528,2527,1,0},first_visible_line={2152,2613,1,0},focus={2381,2380,4,0},fold_display_text_style={2707,2701,1,0},fold_expanded={2230,2229,4,1},fold_flags={0,2233,1,0},fold_level={2223,2222,1,1},fold_parent={2225,0,1,1},font_quality={2612,2611,1,0},gap_position={2644,0,1,0},h_scroll_bar={2131,2130,4,0},highlight_guide={2135,2134,1,0},hotspot_active_underline={2496,2412,4,0},hotspot_single_line={2497,2421,4,0},identifier={2623,2622,1,0},identifiers={0,4024,6,1},idle_styling={2693,2692,1,0},ime_interaction={2678,2679,1,0},indent={2123,2122,1,0},indentation_guides={2133,2132,1,0},indic_alpha={2524,2523,1,1},indic_flags={2685,2684,1,1},indic_fore={2083,2082,3,1},indic_hover_fore={2683,2682,3,1},indic_hover_style={2681,2680,1,1},indic_outline_alpha={2559,2558,1,1},indic_style={2081,2080,1,1},indic_under={2511,2510,4,1},indicator_current={2501,2500,1,0},indicator_value={2503,2502,1,0},key_words={0,4005,6,1},layout_cache={2273,2272,1,0},length={2006,0,1,0},lexer={4002,4001,1,0},lexer_language={4012,4006,7,0},line_count={2154,0,1,0},line_end_position={2136,0,1,1},line_end_types_active={2658,0,1,0},line_end_types_allowed={2657,2656,1,0},line_end_types_supported={4018,0,1,0},line_indent_position={2128,0,1,1},line_indentation={2127,2126,1,1},line_state={2093,2092,1,1},line_visible={2228,0,4,1},lines_on_screen={2370,0,1,0},main_selection={2575,2574,1,0},margin_back_n={2251,2250,3,1},margin_cursor_n={2249,2248,1,1},margin_left={2156,2155,1,0},margin_mask_n={2245,2244,1,1},margin_options={2557,2539,1,0},margin_right={2158,2157,1,0},margin_sensitive_n={2247,2246,4,1},margin_style={2533,2532,1,1},margin_style_offset={2538,2537,1,0},margin_styles={2535,2534,7,1},margin_text={2531,2530,7,1},margin_type_n={2241,2240,1,1},margin_width_n={2243,2242,1,1},margins={2253,2252,1,0},marker_alpha={0,2476,1,1},marker_back={0,2042,3,1},marker_back_selected={0,2292,3,1},marker_fore={0,2041,3,1},max_line_state={2094,0,1,0},mod_event_mask={2378,2359,1,0},modify={2159,0,4,0},mouse_down_captures={2385,2384,4,0},mouse_dwell_time={2265,2264,1,0},mouse_selection_rectangular_switch={2669,2668,4,0},mouse_wheel_captures={2697,2696,4,0},move_extends_selection={2706,0,4,0},multi_paste={2615,2614,1,0},multiple_selection={2564,2563,4,0},named_styles={4029,0,1,0},overtype={2187,2186,4,0},paste_convert_endings={2468,2467,4,0},phases_draw={2673,2674,1,0},position_cache={2515,2514,1,0},primary_style_from_style={4028,0,1,1},print_colour_mode={2149,2148,1,0},print_magnification={2147,2146,1,0},print_wrap_mode={2407,2406,1,0},property={4008,4004,7,6},property_expanded={4009,0,7,6},property_int={4010,0,1,6},punctuation_chars={2649,2648,7,0},read_only={2140,2171,4,0},rectangular_selection_anchor={2591,2590,1,0},rectangular_selection_anchor_virtual_space={2595,2594,1,0},rectangular_selection_caret={2589,2588,1,0},rectangular_selection_caret_virtual_space={2593,2592,1,0},rectangular_selection_modifier={2599,2598,1,0},representation={2666,2665,7,6},rgba_image_height={0,2625,1,0},rgba_image_scale={0,2651,1,0},rgba_image_width={0,2624,1,0},scroll_width={2275,2274,1,0},scroll_width_tracking={2517,2516,4,0},search_flags={2199,2198,1,0},sel_alpha={2477,2478,1,0},sel_eol_filled={2479,2480,4,0},selection_empty={2650,0,4,0},selection_end={2145,2144,1,0},selection_is_rectangle={2372,0,4,0},selection_mode={2423,2422,1,0},selection_n_anchor={2579,2578,1,1},selection_n_anchor_virtual_space={2583,2582,1,1},selection_n_caret={2577,2576,1,1},selection_n_caret_virtual_space={2581,2580,1,1},selection_n_end={2587,2586,1,1},selection_n_end_virtual_space={2727,0,1,1},selection_n_start={2585,2584,1,1},selection_n_start_virtual_space={2726,0,1,1},selection_start={2143,2142,1,0},selections={2570,0,1,0},status={2383,2382,1,0},style_at={2010,0,1,1},style_back={2482,2052,3,1},style_bold={2483,2053,4,1},style_case={2489,2060,1,1},style_changeable={2492,2099,4,1},style_character_set={2490,2066,1,1},style_eol_filled={2487,2057,4,1},style_font={2486,2056,7,1},style_fore={2481,2051,3,1},style_from_sub_style={4027,0,1,1},style_hot_spot={2493,2409,4,1},style_italic={2484,2054,4,1},style_size={2485,2055,1,1},style_size_fractional={2062,2061,1,1},style_underline={2488,2059,4,1},style_visible={2491,2074,4,1},style_weight={2064,2063,1,1},sub_style_bases={4026,0,7,0},sub_styles_length={4022,0,1,1},sub_styles_start={4021,0,1,1},tab_draw_mode={2698,2699,1,0},tab_indents={2261,2260,4,0},tab_minimum_width={2725,2724,1,0},tab_width={2121,2036,1,0},tag={2616,0,7,1},target_end={2193,2192,1,0},target_end_virtual_space={2731,2730,1,0},target_start={2191,2190,1,0},target_start_virtual_space={2729,2728,1,0},target_text={2687,0,7,0},technology={2631,2630,1,0},text_length={2183,0,1,0},two_phase_draw={2283,2284,4,0},undo_collection={2019,2012,4,0},use_tabs={2125,2124,4,0},v_scroll_bar={2281,2280,4,0},view_eol={2355,2356,4,0},view_ws={2020,2021,1,0},virtual_space_options={2597,2596,1,0},whitespace_chars={2647,2443,7,0},whitespace_size={2087,2086,1,0},word_chars={2646,2077,7,0},wrap_indent_mode={2473,2472,1,0},wrap_mode={2269,2268,1,0},wrap_start_indent={2465,2464,1,0},wrap_visual_flags={2461,2460,1,0},wrap_visual_flags_location={2463,2462,1,0},x_offset={2398,2397,1,0},zoom={2374,2373,1,0},}
+M.properties = {accessibility={2703,2702,1,0},additional_caret_fore={2605,2604,4,0},additional_carets_blink={2568,2567,5,0},additional_carets_visible={2609,2608,5,0},additional_sel_alpha={2603,2602,1,0},additional_sel_back={0,2601,4,0},additional_sel_fore={0,2600,4,0},additional_selection_typing={2566,2565,5,0},all_lines_visible={2236,0,5,0},anchor={2009,2026,3,0},annotation_lines={2546,0,1,3},annotation_style={2543,2542,3,3},annotation_style_offset={2551,2550,3,0},annotation_styles={2545,2544,8,3},annotation_text={2541,2540,8,3},annotation_visible={2549,2548,1,0},auto_c_auto_hide={2119,2118,5,0},auto_c_cancel_at_start={2111,2110,5,0},auto_c_case_insensitive_behaviour={2635,2634,1,0},auto_c_choose_single={2114,2113,5,0},auto_c_current={2445,0,3,0},auto_c_current_text={2610,0,8,0},auto_c_drop_rest_of_word={2271,2270,5,0},auto_c_fill_ups={0,2112,7,0},auto_c_ignore_case={2116,2115,5,0},auto_c_max_height={2211,2210,1,0},auto_c_max_width={2209,2208,1,0},auto_c_multi={2637,2636,1,0},auto_c_order={2661,2660,1,0},auto_c_separator={2107,2106,1,0},auto_c_type_separator={2285,2286,1,0},automatic_fold={2664,2663,1,0},back_space_un_indents={2263,2262,5,0},buffered_draw={2034,2035,5,0},call_tip_back={0,2205,4,0},call_tip_fore={0,2206,4,0},call_tip_fore_hlt={0,2207,4,0},call_tip_pos_start={0,2214,3,0},call_tip_position={0,2213,5,0},call_tip_use_style={0,2212,1,0},caret_fore={2138,2069,4,0},caret_line_back={2097,2098,4,0},caret_line_back_alpha={2471,2470,1,0},caret_line_frame={2704,2705,1,0},caret_line_visible={2095,2096,5,0},caret_line_visible_always={2654,2655,5,0},caret_period={2075,2076,1,0},caret_sticky={2457,2458,1,0},caret_style={2513,2512,1,0},caret_width={2189,2188,1,0},char_at={2007,0,1,3},character_category_optimization={2721,2720,1,0},character_pointer={2520,0,1,0},code_page={2137,2037,1,0},column={2129,0,3,3},command_events={2718,2717,5,0},control_char_symbol={2389,2388,1,0},current_pos={2008,2141,3,0},cursor={2387,2386,1,0},direct_function={2184,0,1,0},direct_pointer={2185,0,1,0},distance_to_secondary_styles={4025,0,1,0},doc_pointer={2357,2358,1,0},document_options={2379,0,1,0},edge_colour={2364,2365,4,0},edge_column={2360,2361,1,0},edge_mode={2362,2363,1,0},end_at_last_line={2278,2277,5,0},end_styled={2028,0,3,0},eol_mode={2030,2031,1,0},extra_ascent={2526,2525,1,0},extra_descent={2528,2527,1,0},first_visible_line={2152,2613,3,0},focus={2381,2380,5,0},fold_display_text_style={2707,2701,1,0},fold_expanded={2230,2229,5,3},fold_flags={0,2233,1,0},fold_level={2223,2222,1,3},fold_parent={2225,0,3,3},font_quality={2612,2611,1,0},gap_position={2644,0,3,0},h_scroll_bar={2131,2130,5,0},highlight_guide={2135,2134,3,0},hotspot_active_underline={2496,2412,5,0},hotspot_single_line={2497,2421,5,0},identifier={2623,2622,1,0},identifiers={0,4024,7,3},idle_styling={2693,2692,1,0},ime_interaction={2678,2679,1,0},indent={2123,2122,1,0},indentation_guides={2133,2132,1,0},indic_alpha={2524,2523,1,3},indic_flags={2685,2684,1,3},indic_fore={2083,2082,4,3},indic_hover_fore={2683,2682,4,3},indic_hover_style={2681,2680,1,3},indic_outline_alpha={2559,2558,1,3},indic_style={2081,2080,1,3},indic_under={2511,2510,5,3},indicator_current={2501,2500,3,0},indicator_value={2503,2502,1,0},key_words={0,4005,7,1},last_child={2224,0,3,3},layout_cache={2273,2272,1,0},length={2006,0,1,0},lexer={4002,4001,1,0},lexer_language={4012,4006,8,0},line_count={2154,0,1,0},line_end_position={2136,0,3,3},line_end_types_active={2658,0,1,0},line_end_types_allowed={2657,2656,1,0},line_end_types_supported={4018,0,1,0},line_indent_position={2128,0,3,3},line_indentation={2127,2126,1,3},line_state={2093,2092,1,3},line_visible={2228,0,5,3},lines_on_screen={2370,0,1,0},main_selection={2575,2574,3,0},margin_back_n={2251,2250,4,3},margin_cursor_n={2249,2248,1,3},margin_left={2156,2155,1,0},margin_mask_n={2245,2244,1,3},margin_options={2557,2539,1,0},margin_right={2158,2157,1,0},margin_sensitive_n={2247,2246,5,3},margin_style={2533,2532,3,3},margin_style_offset={2538,2537,3,0},margin_styles={2535,2534,8,3},margin_text={2531,2530,8,3},margin_type_n={2241,2240,1,3},margin_width_n={2243,2242,1,3},margins={2253,2252,1,0},marker_alpha={0,2476,1,3},marker_back={0,2042,4,3},marker_back_selected={0,2292,4,3},marker_fore={0,2041,4,3},max_line_state={2094,0,1,0},mod_event_mask={2378,2359,1,0},modify={2159,0,5,0},mouse_down_captures={2385,2384,5,0},mouse_dwell_time={2265,2264,1,0},mouse_selection_rectangular_switch={2669,2668,5,0},mouse_wheel_captures={2697,2696,5,0},move_extends_selection={2706,0,5,0},multi_paste={2615,2614,1,0},multiple_selection={2564,2563,5,0},named_styles={4029,0,1,0},overtype={2187,2186,5,0},paste_convert_endings={2468,2467,5,0},phases_draw={2673,2674,1,0},position_cache={2515,2514,1,0},primary_style_from_style={4028,0,1,3},print_colour_mode={2149,2148,1,0},print_magnification={2147,2146,1,0},print_wrap_mode={2407,2406,1,0},property={4008,4004,8,7},property_expanded={4009,0,8,7},property_int={4010,0,1,7},punctuation_chars={2649,2648,8,0},range_pointer={2643,0,1,3},read_only={2140,2171,5,0},rectangular_selection_anchor={2591,2590,3,0},rectangular_selection_anchor_virtual_space={2595,2594,3,0},rectangular_selection_caret={2589,2588,3,0},rectangular_selection_caret_virtual_space={2593,2592,3,0},rectangular_selection_modifier={2599,2598,1,0},representation={2666,2665,8,7},rgba_image_height={0,2625,1,0},rgba_image_scale={0,2651,1,0},rgba_image_width={0,2624,1,0},scroll_width={2275,2274,1,0},scroll_width_tracking={2517,2516,5,0},search_flags={2199,2198,1,0},sel_alpha={2477,2478,1,0},sel_eol_filled={2479,2480,5,0},selection_empty={2650,0,5,0},selection_end={2145,2144,3,0},selection_is_rectangle={2372,0,5,0},selection_mode={2423,2422,1,0},selection_n_anchor={2579,2578,3,3},selection_n_anchor_virtual_space={2583,2582,3,3},selection_n_caret={2577,2576,3,3},selection_n_caret_virtual_space={2581,2580,3,3},selection_n_end={2587,2586,3,3},selection_n_end_virtual_space={2727,0,3,3},selection_n_start={2585,2584,3,3},selection_n_start_virtual_space={2726,0,3,3},selection_start={2143,2142,3,0},selections={2570,0,1,0},status={2383,2382,1,0},style_at={2010,0,3,3},style_back={2482,2052,4,3},style_bold={2483,2053,5,3},style_case={2489,2060,1,3},style_changeable={2492,2099,5,3},style_character_set={2490,2066,1,3},style_eol_filled={2487,2057,5,3},style_font={2486,2056,8,3},style_fore={2481,2051,4,3},style_from_sub_style={4027,0,1,1},style_hot_spot={2493,2409,5,3},style_italic={2484,2054,5,3},style_size={2485,2055,1,3},style_size_fractional={2062,2061,1,3},style_underline={2488,2059,5,3},style_visible={2491,2074,5,3},style_weight={2064,2063,1,3},sub_style_bases={4026,0,8,0},sub_styles_length={4022,0,1,1},sub_styles_start={4021,0,1,1},tab_draw_mode={2698,2699,1,0},tab_indents={2261,2260,5,0},tab_minimum_width={2725,2724,1,0},tab_width={2121,2036,1,0},tag={2616,0,8,1},target_end={2193,2192,3,0},target_end_virtual_space={2731,2730,3,0},target_start={2191,2190,3,0},target_start_virtual_space={2729,2728,3,0},target_text={2687,0,8,0},technology={2631,2630,1,0},text_length={2183,0,1,0},two_phase_draw={2283,2284,5,0},undo_collection={2019,2012,5,0},use_tabs={2125,2124,5,0},v_scroll_bar={2281,2280,5,0},view_eol={2355,2356,5,0},view_ws={2020,2021,1,0},virtual_space_options={2597,2596,1,0},whitespace_chars={2647,2443,8,0},whitespace_size={2087,2086,1,0},word_chars={2646,2077,8,0},wrap_indent_mode={2473,2472,1,0},wrap_mode={2269,2268,1,0},wrap_start_indent={2465,2464,1,0},wrap_visual_flags={2461,2460,1,0},wrap_visual_flags_location={2463,2462,1,0},x_offset={2398,2397,1,0},zoom={2374,2373,1,0},}
---
-- Map of Scintilla event IDs to tables of event names and event parameters.
-- @class table
-- @name events
-M.events = {[2000]={"style_needed","position"},[2001]={"char_added","ch","character_source"},[2002]={"save_point_reached"},[2003]={"save_point_left"},[2004]={"modify_attempt_ro"},[2005]={"key","ch","modifiers"},[2006]={"double_click","position","line","modifiers"},[2007]={"update_ui","updated"},[2008]={"modified","position","modification_type","text","length","lines_added","line","fold_level_now","fold_level_prev","token","annotation_lines_added"},[2009]={"macro_record","message","w_param","l_param"},[2010]={"margin_click","position","margin","modifiers"},[2011]={"need_shown","position","length"},[2013]={"painted"},[2014]={"user_list_selection","list_type","text","position","ch","list_completion_method"},[2015]={"uri_dropped","text"},[2016]={"dwell_start","position","x","y"},[2017]={"dwell_end","position","x","y"},[2018]={"zoom"},[2019]={"hot_spot_click","position","modifiers"},[2020]={"hot_spot_double_click","position","modifiers"},[2021]={"call_tip_click","position"},[2022]={"auto_c_selection","text","position","ch","list_completion_method"},[2023]={"indicator_click","position","modifiers"},[2024]={"indicator_release","position","modifiers"},[2025]={"auto_c_cancelled"},[2026]={"auto_c_char_deleted"},[2027]={"hot_spot_release_click","position","modifiers"},[2028]={"focus_in"},[2029]={"focus_out"},[2030]={"auto_c_completed","text","position","ch","list_completion_method"},[2031]={"margin_right_click","position","margin","modifiers"},[2032]={"auto_c_selection_change","list_type","text","position"},}
+M.events = {[2000]={"style_needed","position"},[2001]={"char_added","ch","character_source"},[2002]={"save_point_reached"},[2003]={"save_point_left"},[2004]={"modify_attempt_ro"},[2005]={"key","ch","modifiers"},[2006]={"double_click","position","line","modifiers"},[2007]={"update_ui","updated"},[2008]={"modified","position","modification_type","text","length","lines_added","line","fold_level_now","fold_level_prev","token","annotation_lines_added"},[2009]={"macro_record","message","w_param","l_param"},[2010]={"margin_click","margin","position","modifiers"},[2011]={"need_shown","position","length"},[2013]={"painted"},[2014]={"user_list_selection","list_type","text","position","ch","list_completion_method"},[2015]={"uri_dropped","text"},[2016]={"dwell_start","position","x","y"},[2017]={"dwell_end","position","x","y"},[2018]={"zoom"},[2019]={"hot_spot_click","position","modifiers"},[2020]={"hot_spot_double_click","position","modifiers"},[2021]={"call_tip_click","position"},[2022]={"auto_c_selection","text","position","ch","list_completion_method"},[2023]={"indicator_click","position","modifiers"},[2024]={"indicator_release","position","modifiers"},[2025]={"auto_c_cancelled"},[2026]={"auto_c_char_deleted"},[2027]={"hot_spot_release_click","position","modifiers"},[2028]={"focus_in"},[2029]={"focus_out"},[2030]={"auto_c_completed","text","position","ch","list_completion_method"},[2031]={"margin_right_click","margin","position","modifiers"},[2032]={"auto_c_selection_change","list_type","text","position"},}
-local marker_number, indic_number, list_type, image_type = -1, -1, 0, 0
+local marker_number, indic_number, list_type, image_type = 0, 0, 0, 0
---
-- Returns a unique marker number for use with `buffer.marker_define()`.
diff --git a/core/init.lua b/core/init.lua
index 8b4f3d48..ffa7bbe3 100644
--- a/core/init.lua
+++ b/core/init.lua
@@ -47,8 +47,8 @@ local function text_range(buffer, start_pos, end_pos)
assert_type(start_pos, 'number', 2)
assert_type(end_pos, 'number', 3)
local target_start, target_end = buffer.target_start, buffer.target_end
- if start_pos < 0 then start_pos = 0 end
- if end_pos > buffer.length then end_pos = buffer.length end
+ if start_pos < 1 then start_pos = 1 end
+ if end_pos > buffer.length + 1 then end_pos = buffer.length + 1 end
buffer:set_target_range(start_pos, end_pos)
local text = buffer.target_text
buffer:set_target_range(target_start, target_end) -- restore
diff --git a/core/ui.lua b/core/ui.lua
index 8e0900fa..b21c49d0 100644
--- a/core/ui.lua
+++ b/core/ui.lua
@@ -59,7 +59,7 @@ local function _print(buffer_type, ...)
for i = 1, n do args[i] = tostring(args[i]) end
print_buffer:append_text(table.concat(args, '\t'))
print_buffer:append_text('\n')
- print_buffer:goto_pos(buffer.length)
+ print_buffer:goto_pos(buffer.length + 1)
print_buffer:set_save_point()
end
---
@@ -329,8 +329,8 @@ events_connect(events.UPDATE_UI, function(updated)
local text = not CURSES and '%s %d/%d %s %d %s %s %s %s' or
'%s %d/%d %s %d %s %s %s %s'
local pos = buffer.selection_n_caret[buffer.main_selection]
- local line, max = buffer:line_from_position(pos) + 1, buffer.line_count
- local col = buffer.column[pos] + 1
+ local line, max = buffer:line_from_position(pos), buffer.line_count
+ local col = buffer.column[pos]
local lexer = buffer:get_lexer()
local eol = buffer.eol_mode == buffer.EOL_CRLF and _L['CRLF'] or _L['LF']
local tabs = string.format(
@@ -351,8 +351,8 @@ events_connect(events.BUFFER_BEFORE_SWITCH, function()
buffer._top_line = buffer:doc_line_from_visible(buffer.first_visible_line)
buffer._x_offset = buffer.x_offset
-- Save fold state.
- local folds, i = {}, buffer:contracted_fold_next(0)
- while i ~= -1 do
+ local folds, i = {}, buffer:contracted_fold_next(1)
+ while i >= 1 do
folds[#folds + 1], i = i, buffer:contracted_fold_next(i + 1)
end
buffer._folds = folds
@@ -366,8 +366,8 @@ events_connect(events.BUFFER_AFTER_SWITCH, function()
for i = 1, #buffer._folds do buffer:toggle_fold(buffer._folds[i]) end
-- Restore view state.
buffer:set_sel(buffer._anchor, buffer._current_pos)
- buffer.selection_n_anchor_virtual_space[0] = buffer._anchor_virtual_space
- buffer.selection_n_caret_virtual_space[0] = buffer._caret_virtual_space
+ buffer.selection_n_anchor_virtual_space[1] = buffer._anchor_virtual_space
+ buffer.selection_n_caret_virtual_space[1] = buffer._caret_virtual_space
buffer:choose_caret_x()
local _top_line, top_line = buffer._top_line, buffer.first_visible_line
buffer:line_scroll(0, buffer:visible_from_doc_line(_top_line) - top_line)
@@ -389,7 +389,7 @@ local function save_view_state()
buffer._view_eol, buffer._view_ws = buffer.view_eol, buffer.view_ws
buffer._wrap_mode = buffer.wrap_mode
buffer._margin_type_n, buffer._margin_width_n = {}, {}
- for i = 0, buffer.margins - 1 do
+ for i = 1, buffer.margins do
buffer._margin_type_n[i] = buffer.margin_type_n[i]
buffer._margin_width_n[i] = buffer.margin_width_n[i]
end
@@ -403,7 +403,7 @@ local function restore_view_state()
if not buffer._margin_type_n then return end
buffer.view_eol, buffer.view_ws = buffer._view_eol, buffer._view_ws
buffer.wrap_mode = buffer._wrap_mode
- for i = 0, buffer.margins - 1 do
+ for i = 1, buffer.margins do
buffer.margin_type_n[i] = buffer._margin_type_n[i]
buffer.margin_width_n[i] = buffer._margin_width_n[i]
end
diff --git a/doc/manual.md b/doc/manual.md
index 96f588ff..bbba4540 100644
--- a/doc/manual.md
+++ b/doc/manual.md
@@ -2045,6 +2045,46 @@ find\_in\_files\_timeout|Removed |N/A
[select()]: api.html#textadept.snippets.select
[paths]: api.html#textadept.snippets.paths
+#### Buffer Indexing Changes
+
+All buffer positions, lines, and countable entities now start from `1` instead
+of `0`. For example, `buffer:get_line(1)` now returns the contents of the first
+line instead of `buffer:get_line(0)`, and marker and indicator numbers now count
+from 1 instead of 0.
+
+While this change may seem daunting for migrating user scripts, in practice it
+is not, since most usage is internal, and an offset of 1 or 0 does not matter.
+In migrating Textadept's internals, the following changes were made:
+
+* Themes that loop through marker numbers will need to be updated from something
+ like `for i = 25, 31 do ... end` to either `for i = 26, 32 do ... end` or
+ `for i = buffer.MARKNUM_FOLDEREND, buffer.MARKNUM_FOLDEROPEN do ... end`.
+* Most references of `buffer.length` will need to be changed to
+ `buffer.length + 1`. For example, something like
+ `buffer:goto_pos(buffer.length)` needs to be
+ `buffer:goto_pos(buffer.length + 1)`. The exceptions are when `buffer.length`
+ is not used as a position, as in
+ `buffer:indicator_clear_range(1, buffer.length)`, which is still valid.
+* Any `buffer` function calls and property indexing with bare numbers should be
+ changed to calls or indexes with those numbers plus 1. For example,
+ `buffer:contracted_fold_next(0)` changes to `buffer:contracted_fold_next(1)`,
+ and `buffer.margin_n_width[1] = ...` changes to
+ `buffer.margin_n_width[2] = ...`.
+* Any looping through lines, margins, and selections via
+ `for i = 0, buffer.{line_count,margins,selections} - 1 do ... end` needs to be
+ `for i = 1, buffer.{line_count,margins,selections} do ... end`.
+* Similarly, any language modules that loop back through lines (e.g. to
+ determine types for autocompletion) via
+ `for i = current_line, 0, -1 do ... end` needs to be
+ `for i = current_line, 1, -1 do ... end`.
+* Marker or indicator masks are produced by subtracting 1 from marker or
+ indicator numbers. For example, `1 << textadept.bookmarks.MARK_BOOKMARK`
+ changes to `1 << textadept.bookmarks.MARK_BOOKMARK - 1`.
+
+I found it helpful to quickly scan source files for syntax-highlighted numbers
+and then seeing if those numbers needed to be changed. Searching for "- 1",
+"+ 1", "buffer.length", etc. was also helpful.
+
#### Localization Changes
GUI mnemonics in localization keys have been removed. For example, `_L['_New']`
diff --git a/init.lua b/init.lua
index a7352cba..050c55d6 100644
--- a/init.lua
+++ b/init.lua
@@ -142,28 +142,28 @@ buffer.caret_line_visible = not CURSES
--buffer.margin_left =
--buffer.margin_right =
-- Line Number Margin.
-buffer.margin_type_n[0] = buffer.MARGIN_NUMBER
+buffer.margin_type_n[1] = buffer.MARGIN_NUMBER
local function resize_line_number_margin()
-- This needs to be evaluated dynamically since themes/styles can change.
local buffer = _G.buffer
local width = math.max(4, #tostring(buffer.line_count)) *
buffer:text_width(buffer.STYLE_LINENUMBER, '9') + (not CURSES and 4 or 0)
- buffer.margin_width_n[0] = math.max(buffer.margin_width_n[0], width)
+ buffer.margin_width_n[1] = math.max(buffer.margin_width_n[1], width)
end
events.connect(events.BUFFER_NEW, resize_line_number_margin)
events.connect(events.VIEW_NEW, resize_line_number_margin)
events.connect(events.FILE_OPENED, resize_line_number_margin)
-- Marker Margin.
-buffer.margin_width_n[1] = not CURSES and 4 or 1
+buffer.margin_width_n[2] = not CURSES and 4 or 1
-- Fold Margin.
-buffer.margin_width_n[2] = not CURSES and 12 or 1
-buffer.margin_mask_n[2] = buffer.MASK_FOLDERS
+buffer.margin_width_n[3] = not CURSES and 12 or 1
+buffer.margin_mask_n[3] = buffer.MASK_FOLDERS
-- Other Margins.
-for i = 1, buffer.margins - 1 do
+for i = 2, buffer.margins do
buffer.margin_type_n[i] = buffer.MARGIN_SYMBOL
buffer.margin_sensitive_n[i] = true
buffer.margin_cursor_n[i] = buffer.CURSORARROW
- if i > 2 then buffer.margin_width_n[i] = 0 end
+ if i > 3 then buffer.margin_width_n[i] = 0 end
end
-- Annotations.
diff --git a/modules/ansi_c/init.lua b/modules/ansi_c/init.lua
index e4be3710..688b81c3 100644
--- a/modules/ansi_c/init.lua
+++ b/modules/ansi_c/init.lua
@@ -41,7 +41,7 @@ textadept.editing.autocompleters.ansi_c = function()
-- Attempt to identify the symbol type.
if symbol ~= '' then
local decl = '([%w_]+)[%s%*&]+' .. symbol:gsub('%p', '%%%0') .. '[^%w_]'
- for i = buffer:line_from_position(buffer.current_pos) - 1, 0, -1 do
+ for i = buffer:line_from_position(buffer.current_pos) - 1, 1, -1 do
local class = buffer:get_line(i):match(decl)
if class then symbol = class break end
end
diff --git a/modules/lua/init.lua b/modules/lua/init.lua
index b9cf16bf..7a06b302 100644
--- a/modules/lua/init.lua
+++ b/modules/lua/init.lua
@@ -70,7 +70,7 @@ textadept.editing.autocompleters.lua = function()
symbol, part = symbol:gsub('^_G%.?', ''), part ~= '_G' and part or ''
-- Attempt to identify string type and file type symbols.
local assignment = '%f[%w_]' .. symbol:gsub('(%p)', '%%%1') .. '%s*=%s*(.*)$'
- for i = buffer:line_from_position(buffer.current_pos) - 1, 0, -1 do
+ for i = buffer:line_from_position(buffer.current_pos) - 1, 1, -1 do
local expr = buffer:get_line(i):match(assignment)
if expr then
for patt, type in pairs(M.expr_types) do
diff --git a/modules/textadept/bookmarks.lua b/modules/textadept/bookmarks.lua
index adf283c7..a065baff 100644
--- a/modules/textadept/bookmarks.lua
+++ b/modules/textadept/bookmarks.lua
@@ -16,7 +16,7 @@ M.MARK_BOOKMARK = _SCINTILLA.next_marker_number()
-- @name toggle
function M.toggle()
local line = buffer:line_from_position(buffer.current_pos)
- local has_mark = buffer:marker_get(line) & 1 << M.MARK_BOOKMARK > 0
+ local has_mark = buffer:marker_get(line) & 1 << M.MARK_BOOKMARK - 1 > 0
local f = has_mark and buffer.marker_delete or buffer.marker_add
f(buffer, line, M.MARK_BOOKMARK)
end
@@ -36,15 +36,15 @@ function M.clear() buffer:marker_delete_all(M.MARK_BOOKMARK) end
-- prompting the user for a bookmarked line to go to.
-- @name goto_mark
function M.goto_mark(next)
+ local BOOKMARK_BIT = 1 << M.MARK_BOOKMARK - 1
if next ~= nil then
local f = next and buffer.marker_next or buffer.marker_previous
local current_line = buffer:line_from_position(buffer.current_pos)
- local line = f(
- buffer, current_line + (next and 1 or -1), 1 << M.MARK_BOOKMARK)
+ local line = f(buffer, current_line + (next and 1 or -1), BOOKMARK_BIT)
if line == -1 then
- line = f(buffer, (next and 0 or buffer.line_count), 1 << M.MARK_BOOKMARK)
+ line = f(buffer, (next and 1 or buffer.line_count), BOOKMARK_BIT)
end
- if line >= 0 then textadept.editing.goto_line(line) end
+ if line >= 1 then textadept.editing.goto_line(line) end
return
end
local scan_this_buffer, utf8_list, buffers = true, {}, {}
@@ -55,13 +55,12 @@ function M.goto_mark(next)
local filename = buffer.filename or buffer._type or _L['Untitled']
if buffer.filename then filename = filename:iconv('UTF-8', _CHARSET) end
local basename = buffer.filename and filename:match('[^/\\]+$') or filename
- local line = buffer:marker_next(0, 1 << M.MARK_BOOKMARK)
- while line >= 0 do
+ local line = buffer:marker_next(1, BOOKMARK_BIT)
+ while line >= 1 do
utf8_list[#utf8_list + 1] = string.format(
- '%s:%d: %s', basename, line + 1,
- buffer:get_line(line):match('^[^\r\n]*'))
+ '%s:%d: %s', basename, line, buffer:get_line(line):match('^[^\r\n]*'))
buffers[#buffers + 1] = buffer
- line = buffer:marker_next(line + 1, 1 << M.MARK_BOOKMARK)
+ line = buffer:marker_next(line + 1, BOOKMARK_BIT)
end
::continue::
end
@@ -73,7 +72,7 @@ function M.goto_mark(next)
}
if button ~= 1 or not i then return end
view:goto_buffer(buffers[i])
- textadept.editing.goto_line(utf8_list[i]:match('^[^:]+:(%d+):') - 1)
+ textadept.editing.goto_line(tonumber(utf8_list[i]:match('^[^:]+:(%d+):')))
end
return M
diff --git a/modules/textadept/command_entry.lua b/modules/textadept/command_entry.lua
index 8665e3fd..540c2510 100644
--- a/modules/textadept/command_entry.lua
+++ b/modules/textadept/command_entry.lua
@@ -216,7 +216,7 @@ function M.run(f, keys, lexer, height)
M:set_text('')
M.focus()
M:set_lexer(lexer or 'text')
- M.height = M:text_height(0) * (height or 1)
+ M.height = M:text_height(1) * (height or 1)
_G.keys._command_entry, _G.keys.mode = keys, '_command_entry'
end
@@ -232,7 +232,7 @@ end
-- it to show Lua documentation in the Lua command entry.
events.connect(events.INITIALIZED, function()
M.h_scroll_bar, M.v_scroll_bar = false, false
- for i = 0, M.margins - 1 do M.margin_width_n[i] = 0 end
+ for i = 1, M.margins do M.margin_width_n[i] = 0 end
M.call_tip_position = true
for key, f in pairs(keys) do
if f == textadept.editing.show_documentation then
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua
index 3b45cee9..7c2551ac 100644
--- a/modules/textadept/editing.lua
+++ b/modules/textadept/editing.lua
@@ -130,7 +130,7 @@ end})
events.connect(events.CHAR_ADDED, function(code)
if M.auto_pairs and M.auto_pairs[code] then
buffer:begin_undo_action()
- for i = 0, buffer.selections - 1 do
+ for i = 1, buffer.selections do
local pos = buffer.selection_n_caret[i]
buffer:set_target_range(pos, pos)
buffer:replace_target(M.auto_pairs[code])
@@ -143,7 +143,7 @@ end)
events.connect(events.KEYPRESS, function(code)
if not M.auto_pairs or keys.KEYSYMS[code] ~= '\b' then return end
buffer:begin_undo_action()
- for i = 0, buffer.selections - 1 do
+ for i = 1, buffer.selections do
local pos = buffer.selection_n_caret[i]
local complement = M.auto_pairs[buffer.char_at[pos - 1]]
if complement and buffer.char_at[pos] == string.byte(complement) then
@@ -172,7 +172,7 @@ end)
events.connect(events.KEYPRESS, function(code)
if M.typeover_chars and M.typeover_chars[code] then
local handled = false
- for i = 0, buffer.selections - 1 do
+ for i = 1, buffer.selections do
local s, e = buffer.selection_n_start[i], buffer.selection_n_end[i]
if s == e and buffer.char_at[s] == code then
buffer.selection_n_start[i], buffer.selection_n_end[i] = s + 1, s + 1
@@ -187,13 +187,13 @@ end)
events.connect(events.CHAR_ADDED, function(code)
if not M.auto_indent or code ~= string.byte('\n') then return end
local line = buffer:line_from_position(buffer.current_pos)
- if line > 0 and buffer:get_line(line - 1):find('^[\r\n]+$') and
+ if line > 1 and buffer:get_line(line - 1):find('^[\r\n]+$') and
buffer:get_line(line):find('^[^\r\n]') then
return -- do not auto-indent when pressing enter from start of previous line
end
local i = line - 1
- while i >= 0 and buffer:get_line(i):find('^[\r\n]+$') do i = i - 1 end
- if i >= 0 then
+ while i >= 1 and buffer:get_line(i):find('^[\r\n]+$') do i = i - 1 end
+ if i >= 1 then
buffer.line_indentation[line] = buffer.line_indentation[i]
buffer:vc_home()
end
@@ -227,7 +227,7 @@ events.connect(events.FILE_BEFORE_SAVE, function()
if not M.strip_trailing_spaces then return end
buffer:begin_undo_action()
-- Strip trailing whitespace.
- for line = 0, buffer.line_count - 1 do
+ for line = 1, buffer.line_count do
local s, e = buffer:position_from_line(line), buffer.line_end_position[line]
local i, byte = e - 1, buffer.char_at[e - 1]
while i >= s and (byte == 9 or byte == 32) do -- '\t' or ' '
@@ -236,7 +236,7 @@ events.connect(events.FILE_BEFORE_SAVE, function()
if i < e - 1 then buffer:delete_range(i + 1, e - i - 1) end
end
-- Ensure final newline.
- if buffer.char_at[buffer.length - 1] ~= 10 then buffer:append_text('\n') end
+ if buffer.char_at[buffer.length] ~= 10 then buffer:append_text('\n') end
-- Convert non-consistent EOLs
buffer:convert_eols(buffer.eol_mode)
buffer:end_undo_action()
@@ -275,8 +275,8 @@ function M.paste_reindent()
-- higher indentation amount. However, if the preceding line is a fold header,
-- indent by an extra level.
local i = line - 1
- while i >= 0 and buffer:get_line(i):find('^[\r\n]+$') do i = i - 1 end
- if i < 0 or buffer.line_indentation[i] < buffer.line_indentation[line] then
+ while i >= 1 and buffer:get_line(i):find('^[\r\n]+$') do i = i - 1 end
+ if i < 1 or buffer.line_indentation[i] < buffer.line_indentation[line] then
i = line
end
local indentation = buffer:text_range(
@@ -318,7 +318,7 @@ function M.block_comment()
local anchor, pos = buffer.selection_start, buffer.selection_end
local s, e = buffer:line_from_position(anchor), buffer:line_from_position(pos)
local ignore_last_line = s ~= e and pos == buffer:position_from_line(e)
- anchor, pos = buffer.line_end_position[s] - anchor, buffer.length - pos
+ anchor, pos = buffer.line_end_position[s] - anchor, buffer.length + 1 - pos
local column = math.huge
buffer:begin_undo_action()
for line = s, not ignore_last_line and e or e - 1 do
@@ -342,7 +342,7 @@ function M.block_comment()
if line == e then pos = pos + #suffix * (uncomment and -1 or 1) end
end
buffer:end_undo_action()
- anchor, pos = buffer.line_end_position[s] - anchor, buffer.length - pos
+ anchor, pos = buffer.line_end_position[s] - anchor, buffer.length + 1 - pos
-- Keep the anchor and caret on the first line as necessary.
local start_pos = buffer:position_from_line(s)
anchor, pos = math.max(anchor, start_pos), math.max(pos, start_pos)
@@ -363,13 +363,12 @@ function M.goto_line(line)
}
line = tonumber(value)
if button ~= 1 or not line then return end
- line = line - 1
end
buffer:ensure_visible_enforce_policy(line)
buffer:goto_line(line)
end
args.register(
- '-l', '--line', 1, function(line) M.goto_line(line - 1) end, 'Go to line')
+ '-l', '--line', 1, function(line) M.goto_line(line) end, 'Go to line')
---
-- Transposes characters intelligently.
@@ -377,7 +376,7 @@ args.register(
-- the caret. Otherwise, the characters to the left and right are.
-- @name transpose_chars
function M.transpose_chars()
- if buffer.current_pos == 0 then return end
+ if buffer.current_pos == 1 then return end
local pos = buffer.current_pos
local line_end = buffer.line_end_position[buffer:line_from_position(pos)]
if pos == line_end then pos = buffer:position_before(pos) end
@@ -414,7 +413,7 @@ function M.enclose(left, right)
assert_type(left, 'string', 1)
assert_type(right, 'string', 2)
buffer:begin_undo_action()
- for i = 0, buffer.selections - 1 do
+ for i = 1, buffer.selections do
local s, e = buffer.selection_n_start[i], buffer.selection_n_end[i]
if s == e then
s = buffer:word_start_position(s, true)
@@ -447,7 +446,7 @@ function M.select_enclosed(left, right)
s, e = buffer:search_prev(0, left), buffer:search_next(0, right)
elseif M.auto_pairs then
s = buffer.selection_start
- while s >= 0 do
+ while s >= 1 do
local match = M.auto_pairs[buffer.char_at[s]]
if not match then goto continue end
left, right = string.char(buffer.char_at[s]), match
@@ -457,7 +456,7 @@ function M.select_enclosed(left, right)
elseif M.brace_matches[buffer.char_at[s]] or
buffer.style_at[s] == buffer.style_at[buffer.selection_start] then
buffer.search_flags = 0
- buffer:set_target_range(s + 1, buffer.length)
+ buffer:set_target_range(s + 1, buffer.length + 1)
if buffer:search_in_target(match) >= buffer.selection_end - 1 then
e = buffer.target_end - 1
break
@@ -467,7 +466,7 @@ function M.select_enclosed(left, right)
s = s - 1
end
end
- if s >= 0 and e >= 0 then
+ if s >= 1 and e >= 1 then
if s + #left == anchor and e == pos then s, e = s - #left, e + #right end
buffer:set_sel(s + #left, e)
end
@@ -520,7 +519,7 @@ end
-- @name convert_indentation
function M.convert_indentation()
buffer:begin_undo_action()
- for line = 0, buffer.line_count - 1 do
+ for line = 1, buffer.line_count do
local s = buffer:position_from_line(line)
local indent = buffer.line_indentation[line]
local e = buffer.line_indent_position[line]
@@ -543,7 +542,7 @@ end
-- Clears highlighted word indicators and markers.
local function clear_highlighted_words()
buffer.indicator_current = M.INDIC_HIGHLIGHT
- buffer:indicator_clear_range(0, buffer.length)
+ buffer:indicator_clear_range(1, buffer.length)
end
events.connect(events.KEYPRESS, function(code)
if keys.KEYSYMS[code] == 'esc' then clear_highlighted_words() end
@@ -566,10 +565,10 @@ function M.highlight_word()
local word = buffer:text_range(s, e)
buffer.search_flags = buffer.FIND_WHOLEWORD + buffer.FIND_MATCHCASE
buffer:target_whole_document()
- while buffer:search_in_target(word) > -1 do
+ while buffer:search_in_target(word) ~= -1 do
buffer:indicator_fill_range(
buffer.target_start, buffer.target_end - buffer.target_start)
- buffer:set_target_range(buffer.target_end, buffer.length)
+ buffer:set_target_range(buffer.target_end, buffer.length + 1)
end
end
@@ -601,7 +600,7 @@ function M.filter_through(command)
local i, j = buffer:line_from_position(s), buffer:line_from_position(e)
if i < j then
s = buffer:position_from_line(i)
- if buffer.column[e] > 0 then e = buffer:position_from_line(j + 1) end
+ if buffer.column[e] > 1 then e = buffer:position_from_line(j + 1) end
end
buffer:set_target_range(s, e)
end
@@ -659,13 +658,13 @@ M.autocompleters.word = function()
if buffer == _G.buffer or M.autocomplete_all_words then
buffer.search_flags = buffer.FIND_WORDSTART + buffer.FIND_MATCHCASE
buffer:target_whole_document()
- while buffer:search_in_target(word_part) > -1 do
+ while buffer:search_in_target(word_part) ~= -1 do
local e = buffer:word_end_position(buffer.target_end, true)
local match = buffer:text_range(buffer.target_start, e)
if #match > #word_part and not matches[match] then
list[#list + 1], matches[match] = match, true
end
- buffer:set_target_range(e, buffer.length)
+ buffer:set_target_range(e, buffer.length + 1)
end
end
end
@@ -717,9 +716,9 @@ function M.show_documentation(pos, case_insensitive)
end
-- Search backwards for an open function call and show API documentation for
-- that function as well.
- while s > 0 and buffer.char_at[s] ~= 40 do s = s - 1 end -- '('
+ while s > 1 and buffer.char_at[s] ~= 40 do s = s - 1 end -- '('
e = buffer:brace_match(s, 0)
- if s > 0 and (e == -1 or e >= pos) then
+ if s > 1 and (e == -1 or e >= pos) then
s, e = buffer:word_start_position(s - 1, true), s - 1
symbol = buffer:text_range(s, e + 1)
goto lookup
diff --git a/modules/textadept/file_types.lua b/modules/textadept/file_types.lua
index 21261093..2889734c 100644
--- a/modules/textadept/file_types.lua
+++ b/modules/textadept/file_types.lua
@@ -44,7 +44,7 @@ end
-- @param buffer The buffer to detect the language of.
-- @return lexer language or nil
local function detect_language(buffer)
- local line = buffer:get_line(0)
+ local line = buffer:get_line(1)
-- Detect from first line.
for patt, lexer in pairs(M.patterns) do
if line:find(patt) then return lexer end
@@ -71,7 +71,7 @@ local function set_lexer(buffer, lang)
if package.searchpath(lang, package.path) then _M[lang] = require(lang) end
if buffer ~= ui.command_entry then events.emit(events.LEXER_LOADED, lang) end
local last_line = buffer.first_visible_line + buffer.lines_on_screen
- buffer:colourise(0, buffer:position_from_line(last_line + 1)) -- refresh
+ buffer:colourise(1, buffer:position_from_line(last_line + 1)) -- refresh
end
-- Gives new buffers lexer-specific functions.
diff --git a/modules/textadept/find.lua b/modules/textadept/find.lua
index 113a32bb..d15558fb 100644
--- a/modules/textadept/find.lua
+++ b/modules/textadept/find.lua
@@ -100,9 +100,9 @@ local find_text, found_text
-- The "Find in Files" flag is unused by Scintilla, but used by Textadept.
-- @return search flag bit-mask
local function get_flags()
- return (M.match_case and buffer.FIND_MATCHCASE or 0) +
- (M.whole_word and buffer.FIND_WHOLEWORD or 0) +
- (M.regex and buffer.FIND_REGEXP or 0) + (M.in_files and 1 << 31 or 0)
+ return (M.match_case and buffer.FIND_MATCHCASE or 0) |
+ (M.whole_word and buffer.FIND_WHOLEWORD or 0) |
+ (M.regex and buffer.FIND_REGEXP or 0) | (M.in_files and 1 << 31 or 0)
end
-- Finds and selects text in the current buffer.
@@ -139,7 +139,7 @@ local function find(text, next, flags, no_wrap, wrapped)
-- If nothing was found, wrap the search.
if pos == -1 and not no_wrap then
local anchor = buffer.anchor
- buffer:goto_pos(next and 0 or buffer.length)
+ buffer:goto_pos(next and 1 or buffer.length + 1)
events.emit(events.FIND_WRAPPED)
pos = find(text, next, flags, true, true)
if pos == -1 then
@@ -171,7 +171,7 @@ local function find_incremental(text, next, anchor)
if anchor then
incremental_start = buffer:position_relative(orig_pos, next and 1 or -1)
end
- buffer:goto_pos(incremental_start or 0)
+ buffer:goto_pos(incremental_start or 1)
-- Note: even though `events.FIND` does not support a flags parameter, the
-- default handler has one, so make use of it.
events.emit(
@@ -213,8 +213,8 @@ M.find_incremental_keys = setmetatable({
M.find_incremental(ui.command_entry:get_text(), true, true)
end,
['\b'] = function()
- local e = ui.command_entry:position_before(ui.command_entry.length)
- M.find_incremental(ui.command_entry:text_range(0, e), true)
+ local e = ui.command_entry:position_before(ui.command_entry.length + 1)
+ M.find_incremental(ui.command_entry:text_range(1, e), true)
return false -- propagate
end
}, {__index = function(_, k)
@@ -285,9 +285,9 @@ function M.find_in_files(dir, filter)
f:close()
local binary = nil -- determine lazily for performance reasons
buffer:target_whole_document()
- while buffer:search_in_target(text) > -1 do
+ while buffer:search_in_target(text) ~= -1 do
found = true
- if binary == nil then binary = buffer:text_range(0, 65536):find('\0') end
+ if binary == nil then binary = buffer:text_range(1, 65536):find('\0') end
if binary then
_G.buffer:append_text(string.format(
'%s:1:%s\n', utf8_filenames[i], _L['Binary file matches.']))
@@ -296,17 +296,17 @@ function M.find_in_files(dir, filter)
local line_num = buffer:line_from_position(buffer.target_start)
local line = buffer:get_line(line_num)
_G.buffer:append_text(
- string.format('%s:%d:%s', utf8_filenames[i], line_num + 1, line))
- local pos = _G.buffer.length - #line +
+ string.format('%s:%d:%s', utf8_filenames[i], line_num, line))
+ local pos = _G.buffer.length + 1 - #line +
buffer.target_start - buffer:position_from_line(line_num)
_G.buffer:indicator_fill_range(
pos, buffer.target_end - buffer.target_start)
if not line:find('\n$') then _G.buffer:append_text('\n') end
- buffer:set_target_range(buffer.target_end, buffer.length)
+ buffer:set_target_range(buffer.target_end, buffer.length + 1)
end
buffer:clear_all()
buffer:empty_undo_buffer()
- _G.buffer:goto_pos(_G.buffer.length) -- [Files Found Buffer]
+ _G.buffer:goto_pos(_G.buffer.length + 1) -- [Files Found Buffer]
i = i + 1
if i > #filenames then return nil end
return i * 100 / #filenames, utf8_filenames[i]
@@ -352,28 +352,28 @@ events.connect(events.REPLACE_ALL, function(ftext, rtext)
buffer.indicator_current = INDIC_REPLACE
buffer:indicator_fill_range(e, 1)
end
- local EOF = replace_in_sel and e == buffer.length -- no indicator at EOF
+ local EOF = replace_in_sel and e == buffer.length + 1 -- no indicator at EOF
local f = not M.regex and buffer.replace_target or buffer.replace_target_re
rtext = unescape(rtext)
-- Perform the search and replace.
buffer:begin_undo_action()
buffer.search_flags = get_flags()
- buffer:set_target_range(not replace_in_sel and 0 or s, buffer.length)
+ buffer:set_target_range(not replace_in_sel and 1 or s, buffer.length + 1)
while buffer:search_in_target(ftext) ~= -1 and (not replace_in_sel or
buffer.target_end <= buffer:indicator_end(INDIC_REPLACE, s) or EOF) do
if buffer.target_start == buffer.target_end then break end -- prevent loops
f(buffer, rtext)
count = count + 1
- buffer:set_target_range(buffer.target_end, buffer.length)
+ buffer:set_target_range(buffer.target_end, buffer.length + 1)
end
buffer:end_undo_action()
-- Restore any original selection and report the number of replacements made.
if replace_in_sel then
e = buffer:indicator_end(INDIC_REPLACE, s)
- buffer:set_sel(s, e > 0 and e or buffer.length)
- if e > 0 then buffer:indicator_clear_range(e, 1) end
+ buffer:set_sel(s, e > 1 and e or buffer.length + 1)
+ if e > 1 then buffer:indicator_clear_range(e, 1) end
end
ui.statusbar_text = string.format('%d %s', count, _L['replacement(s) made'])
end)
@@ -408,7 +408,7 @@ function M.goto_file_found(line_num, next)
local f = next and buffer.search_next or buffer.search_prev
local pos = f(buffer, buffer.FIND_REGEXP, '^.+:\\d+:.+$')
if pos == -1 then
- buffer:goto_line(next and 0 or buffer.line_count)
+ buffer:goto_line(next and 1 or buffer.line_count)
buffer:search_anchor()
pos = f(buffer, buffer.FIND_REGEXP, '^.+:\\d+:.+$')
end
@@ -422,9 +422,10 @@ function M.goto_file_found(line_num, next)
local utf8_filename, pos
utf8_filename, line_num, pos = line:match('^(.+):(%d+):()')
if not utf8_filename then return end
+ line_num = tonumber(line_num)
textadept.editing.select_line()
pos = buffer.selection_start + pos - 1 -- absolute pos of result text on line
- local s = buffer:indicator_end(M.INDIC_FIND, pos - 1)
+ local s = buffer:indicator_end(M.INDIC_FIND, buffer.selection_start)
local e = buffer:indicator_end(M.INDIC_FIND, s + 1)
if buffer:line_from_position(s) == buffer:line_from_position(pos) then
s, e = s - pos, e - pos -- relative to line start
@@ -432,8 +433,8 @@ function M.goto_file_found(line_num, next)
s, e = 0, 0 -- binary file notice, or highlighting was somehow removed
end
ui.goto_file(utf8_filename:iconv(_CHARSET, 'UTF-8'), true, preferred_view)
- textadept.editing.goto_line(line_num - 1)
- if buffer:line_from_position(buffer.current_pos + s) == line_num - 1 then
+ textadept.editing.goto_line(line_num)
+ if buffer:line_from_position(buffer.current_pos + s) == line_num then
buffer:set_sel(buffer.current_pos + e, buffer.current_pos + s)
end
end
diff --git a/modules/textadept/menu.lua b/modules/textadept/menu.lua
index 153e25b9..a92c2498 100644
--- a/modules/textadept/menu.lua
+++ b/modules/textadept/menu.lua
@@ -306,7 +306,7 @@ local default_menubar = {
end},
SEPARATOR,
{_L['Select Lexer...'], textadept.file_types.select_lexer},
- {_L['Refresh Syntax Highlighting'], function() buffer:colourise(0, -1) end}
+ {_L['Refresh Syntax Highlighting'], function() buffer:colourise(1, -1) end}
},
{
title = _L['View'],
@@ -318,10 +318,10 @@ local default_menubar = {
{_L['Unsplit View'], function() view:unsplit() end},
{_L['Unsplit All Views'], function() while view:unsplit() do end end},
{_L['Grow View'], function()
- if view.size then view.size = view.size + buffer:text_height(0) end
+ if view.size then view.size = view.size + buffer:text_height(1) end
end},
{_L['Shrink View'], function()
- if view.size then view.size = view.size - buffer:text_height(0) end
+ if view.size then view.size = view.size - buffer:text_height(1) end
end},
SEPARATOR,
{_L['Toggle Current Fold'], function()
diff --git a/modules/textadept/run.lua b/modules/textadept/run.lua
index 91a2e672..6c9bef23 100644
--- a/modules/textadept/run.lua
+++ b/modules/textadept/run.lua
@@ -124,7 +124,7 @@ local function print_line(line, ext_or_lexer)
if error then
-- Current position is one line below the error due to ui.print()'s '\n'.
buffer:marker_add(
- buffer.line_count - 2, error.warning and M.MARK_WARNING or M.MARK_ERROR)
+ buffer.line_count - 1, error.warning and M.MARK_WARNING or M.MARK_ERROR)
end
end
@@ -377,19 +377,20 @@ function M.goto_error(line_num, next)
if not assert_type(line_num, 'number/nil', 1) and next ~= nil then
local f = next and buffer.marker_next or buffer.marker_previous
line_num = buffer:line_from_position(buffer.current_pos)
+ local WARN_BIT, ERROR_BIT = 1 << M.MARK_WARNING - 1, 1 << M.MARK_ERROR - 1
local wrapped = false
::retry::
- local wline = f(buffer, line_num + (next and 1 or -1), 1 << M.MARK_WARNING)
- local eline = f(buffer, line_num + (next and 1 or -1), 1 << M.MARK_ERROR)
+ local wline = f(buffer, line_num + (next and 1 or -1), WARN_BIT)
+ local eline = f(buffer, line_num + (next and 1 or -1), ERROR_BIT)
if wline == -1 and eline == -1 then
- wline = f(buffer, next and 0 or buffer.line_count, 1 << M.MARK_WARNING)
- eline = f(buffer, next and 0 or buffer.line_count, 1 << M.MARK_ERROR)
+ wline = f(buffer, next and 1 or buffer.line_count, WARN_BIT)
+ eline = f(buffer, next and 1 or buffer.line_count, ERROR_BIT)
elseif wline == -1 or eline == -1 then
if wline == -1 then wline = eline else eline = wline end
end
line_num = (next and math.min or math.max)(wline, eline)
if line_num == -1 and not wrapped then
- line_num = next and 0 or buffer.line_count
+ line_num = next and 1 or buffer.line_count
wrapped = true
goto retry
end
@@ -406,14 +407,14 @@ function M.goto_error(line_num, next)
end
local sloppy = not detail.filename:find(not WIN32 and '^/' or '^%a:[/\\]')
ui.goto_file(detail.filename, true, preferred_view, sloppy)
- textadept.editing.goto_line(detail.line - 1)
+ textadept.editing.goto_line(detail.line)
if detail.column then
- buffer:goto_pos(buffer:find_column(detail.line - 1, detail.column - 1))
+ buffer:goto_pos(buffer:find_column(detail.line, detail.column))
end
if detail.message then
- buffer.annotation_text[detail.line - 1] = detail.message
- -- Style number 8 is the error style.
- if not detail.warning then buffer.annotation_style[detail.line - 1] = 8 end
+ buffer.annotation_text[detail.line] = detail.message
+ -- Style number 9 is the error style.
+ if not detail.warning then buffer.annotation_style[detail.line] = 9 end
end
end
events.connect(events.KEYPRESS, function(code)
diff --git a/modules/textadept/session.lua b/modules/textadept/session.lua
index c0e611e5..b446ca54 100644
--- a/modules/textadept/session.lua
+++ b/modules/textadept/session.lua
@@ -168,11 +168,11 @@ function M.save(filename)
top_line = current and buffer.first_visible_line or buffer._top_line,
}
local bookmarks = {}
- local line = buffer:marker_next(0, 1 << textadept.bookmarks.MARK_BOOKMARK)
+ local BOOKMARK_BIT = 1 << textadept.bookmarks.MARK_BOOKMARK - 1
+ local line = buffer:marker_next(1, BOOKMARK_BIT)
while line ~= -1 do
bookmarks[#bookmarks + 1] = line
- line = buffer:marker_next(
- line + 1, 1 << textadept.bookmarks.MARK_BOOKMARK)
+ line = buffer:marker_next(line + 1, BOOKMARK_BIT)
end
session.buffers[#session.buffers].bookmarks = bookmarks
::continue::
diff --git a/modules/textadept/snippets.lua b/modules/textadept/snippets.lua
index 90617a2d..707ab7ca 100644
--- a/modules/textadept/snippets.lua
+++ b/modules/textadept/snippets.lua
@@ -233,9 +233,9 @@ local function new_snippet(text, trigger)
-- snippet. Also account for the marker being at the beginning of the
-- snippet. (If so, pos will point to the correct position.)
local pos = buffer:indicator_end(INDIC_CURRENTPLACEHOLDER, self.start_pos)
- if pos == 0 then pos = self.start_pos end
+ if pos == 1 then pos = self.start_pos end
return buffer:indicator_all_on_for(pos) &
- 1 << INDIC_CURRENTPLACEHOLDER > 0 and pos + 1 or pos
+ 1 << INDIC_CURRENTPLACEHOLDER - 1 > 0 and pos + 1 or pos
else
return snippet_mt[k]
end
@@ -455,7 +455,7 @@ snippet_mt = {
buffer:add_selection(pos, pos + #text)
goto redo -- indicator positions have changed
end
- buffer.main_selection = 0
+ buffer.main_selection = 1
-- Update transforms.
self:update_transforms()
@@ -502,10 +502,11 @@ snippet_mt = {
local snapshot =
self.snapshots[self.index > 0 and self.index - 1 or #self.snapshots]
local i = self.start_pos
+ local PLACEHOLDER_BIT = 1 << M.INDIC_PLACEHOLDER - 1
return function()
local s = buffer:indicator_end(M.INDIC_PLACEHOLDER, i)
- while s > 0 and s <= self.end_pos do
- if buffer:indicator_all_on_for(i) & 1 << M.INDIC_PLACEHOLDER > 0 then
+ while s > 1 and s <= self.end_pos do
+ if buffer:indicator_all_on_for(i) & PLACEHOLDER_BIT > 0 then
-- This next indicator comes directly after the previous one; adjust
-- start and end positions to compensate.
s, i = buffer:indicator_start(M.INDIC_PLACEHOLDER, i), s
diff --git a/scripts/gen_iface.lua b/scripts/gen_iface.lua
index 5737b338..f8386e84 100755
--- a/scripts/gen_iface.lua
+++ b/scripts/gen_iface.lua
@@ -4,11 +4,11 @@
local constants, functions, properties, events = {}, {}, {}, {}
local const_patt = '^val ([%w_]+)=([-%dx%x]+)'
local event_patt = '^evt %a+ ([%w_]+)=(%d+)(%b())'
-local msg_patt = '^(%a+) (%a+) (%w+)=(%d+)%((%a*) ?([^,]*),%s*(%a*)'
+local msg_patt = '^(%a+) (%a+) (%w+)=(%d+)%((%a*)%s*([^,]*),%s*(%a*)%s*([^)]*)'
local types = {
- [''] = 0, void = 0, int = 1, length = 2, position = 1, line = 1, colour = 3,
- bool = 4, keymod = 5, string = 6, stringresult = 7, cells = 8, pointer = 1,
- textrange = 9, findtext = 10, formatrange = 11
+ [''] = 0, void = 0, int = 1, length = 2, index = 3, position = 3, line = 3,
+ colour = 4, bool = 5, keymod = 6, string = 7, stringresult = 8, cells = 9,
+ pointer = 1, textrange = 10, findtext = 11, formatrange = 12
}
local ignores = { -- constants to ignore
'^INDIC[012S]_', '^INVALID_POSITION', '^KEYWORDSET_MAX', '^SC_AC_',
@@ -18,11 +18,24 @@ local ignores = { -- constants to ignore
'^SC_WEIGHT_', '^SCE_', '^SCEN_', '^SCFIND_POSIX', '^SCI_', '^SCK_',
'^SCLEX_', '^UNDO_MAY_COALESCE'
}
+local increments = { -- constants to increment by one
+ 'MARKER_MAX', 'MAX_MARGIN', 'STYLE_MAX', 'INDIC_CONTAINER', 'INDIC_IME',
+ 'INDIC_IME_MAX', 'INDIC_MAX', 'INDICATOR_CONTAINER', 'INDICATOR_IME',
+ 'INDICATOR_IME_MAX', 'INDICATOR_MAX'
+}
+for _, v in ipairs(increments) do increments[v] = true end
local changed_setter = {} -- holds properties changed to setter functions
local function to_lua_name(camel_case)
return camel_case:gsub('([a-z])([A-Z])', '%1_%2'):
gsub('([A-Z])([A-Z][a-z])', '%1_%2'):lower()
end
+local function is_length(ptype, param)
+ return ptype == 'position' and param:find('^length')
+end
+local function is_index(ptype, param)
+ return ptype == 'int' and (param == 'style' or param == 'markerNumber' or
+ param == 'margin' or param == 'indicator' or param == 'selection')
+end
for line in io.lines('../src/scintilla/include/Scintilla.iface') do
if line:find('^val ') then
@@ -32,8 +45,8 @@ for line in io.lines('../src/scintilla/include/Scintilla.iface') do
if name == 'FIND_REGEXP' then
value = tostring(tonumber(value) + 2^23) -- add SCFIND_CXX11REGEX
value = value:gsub('%.0$', '') -- Lua 5.3+ may append this
- elseif name == 'MASK_FOLDERS' then
- value = tostring(-33554432)
+ elseif increments[name] or name:find('^MARKNUM') then
+ value = tonumber(value) + 1
end
constants[#constants + 1] = string.format('%s=%s', name, value)
elseif line:find('^evt ') then
@@ -47,21 +60,36 @@ for line in io.lines('../src/scintilla/include/Scintilla.iface') do
has_modifiers = true
end
end
- if has_modifiers then event[#event + 1] = '"modifiers"' end
+ if name:find('^margin') then
+ event[2], event[3] = event[3], event[2] -- swap position, margin
+ end
+ if has_modifiers then event[#event + 1] = '"modifiers"' end -- prefer at end
events[#events + 1] = value
events[value] = table.concat(event, ',')
elseif line:find('^fun ') then
- local _, rtype, name, id, wtype, param, ltype = line:match(msg_patt)
+ local _, rtype, name, id, wtype, param, ltype, param2 = line:match(msg_patt)
if rtype:find('^%u') then rtype = 'int' end
if wtype:find('^%u') then wtype = 'int' end
if ltype:find('^%u') then ltype = 'int' end
name = to_lua_name(name)
if name == 'convert_eo_ls' then name = 'convert_eols' end
- if types[wtype] == types.int and param == 'length' then wtype = 'length' end
+ if is_length(wtype, param) then
+ wtype = 'length'
+ elseif is_index(wtype, param) then
+ wtype = 'index'
+ end
+ if is_length(ltype, param2) then
+ ltype = 'length'
+ elseif is_index(ltype, param2) then
+ ltype = 'index'
+ elseif ltype == 'stringresult' then
+ rtype = 'void'
+ end
functions[#functions + 1] = name
functions[name] = {id, types[rtype], types[wtype], types[ltype]}
elseif line:find('^get ') or line:find('^set ') then
- local kind, rtype, name, id, wtype, _, ltype = line:match(msg_patt)
+ local kind, rtype, name, id, wtype, param, ltype, param2 =
+ line:match(msg_patt)
if rtype:find('^%u') then rtype = 'int' end
if wtype:find('^%u') then wtype = 'int' end
if ltype:find('^%u') then ltype = 'int' end
@@ -80,6 +108,8 @@ for line in io.lines('../src/scintilla/include/Scintilla.iface') do
properties[#properties + 1] = name
properties[name] = {0, 0, 0, 0}
end
+ if is_index(wtype, param) then wtype = 'index' end
+ if is_index(ltype, param2) then ltype = 'index' end
local prop = properties[name]
if kind == 'get' then
prop[1] = id
@@ -98,6 +128,36 @@ for line in io.lines('../src/scintilla/include/Scintilla.iface') do
::continue::
end
+-- Manually adjust special-case messages that do not quite follow the rules.
+functions['auto_c_show'][3] = types.int -- was interpreted as 'length'
+functions['get_cur_line'][2] = types.position -- was interpreted as 'void'
+
+-- Manually adjust messages whose param or return types would be interpreted as
+-- 1-based numbers, but should not be, or vice-versa.
+properties['length'][3] = types.int
+properties['style_at'][3] = types.index
+functions['count_characters'][2] = types.int
+functions['count_code_units'][2] = types.int
+properties['line_count'][3] = types.int
+functions['line_scroll'][3] = types.int
+functions['line_scroll'][4] = types.int
+properties['text_length'][3] = types.int
+functions['replace_target'][2] = types.int
+functions['replace_target_re'][2] = types.int
+functions['wrap_count'][2] = types.int
+properties['edge_column'][3] = types.int
+functions['multi_edge_add_line'][3] = types.int
+functions['line_length'][2] = types.int
+properties['lines_on_screen'][3] = types.int
+properties['auto_c_current'][3] = types.index
+properties['indicator_current'][3] = types.index
+properties['margin_style'][3] = types.index
+properties['margin_style_offset'][3] = types.index
+properties['annotation_style'][3] = types.index
+properties['annotation_style_offset'][3] = types.index
+properties['main_selection'][3] = types.index
+functions['position_relative'][4] = types.int
+
-- Add mouse events from Scintilla curses manually.
constants[#constants + 1] = 'MOUSE_PRESS=1'
constants[#constants + 1] = 'MOUSE_DRAG=2'
@@ -179,7 +239,7 @@ for _, event in ipairs(events) do
end
f:write('}\n\n')
f:write([[
-local marker_number, indic_number, list_type, image_type = -1, -1, 0, 0
+local marker_number, indic_number, list_type, image_type = 0, 0, 0, 0
---
-- Returns a unique marker number for use with `buffer.marker_define()`.
diff --git a/src/Makefile b/src/Makefile
index 330bacc4..dd310bad 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -374,7 +374,7 @@ else
gtdialog_url = http://foicica.com/hg/gtdialog/archive/tip.zip
endif
-scintilla_zip = 000045872e04.zip
+scintilla_zip = d5675dbd273d.zip
lua_tgz = lua-5.3.5.tar.gz
lpeg_tgz = lpeg-1.0.2.tar.gz
lfs_zip = v1_7_0_2.zip
diff --git a/src/textadept.c b/src/textadept.c
index 0f53fde1..2837a5d1 100644
--- a/src/textadept.c
+++ b/src/textadept.c
@@ -187,7 +187,7 @@ static int quitting;
#endif
static int initing, closing;
static int show_tabs = TRUE, tab_sync;
-enum {SVOID, SINT, SLEN, SCOLOR, SBOOL, SKEYMOD, SSTRING, SSTRINGRET};
+enum {SVOID, SINT, SLEN, SINDEX, SCOLOR, SBOOL, SKEYMOD, SSTRING, SSTRINGRET};
// Forward declarations.
static void new_buffer(sptr_t);
@@ -831,6 +831,21 @@ static int menu(lua_State *L) {
#endif
}
+/** `ui.update()` Lua function. */
+static int update_ui(lua_State *L) {
+#if GTK
+ while (gtk_events_pending()) gtk_main_iteration();
+#elif CURSES
+ struct timeval timeout = {0, 1e5}; // 0.1s
+ int nfds = os_spawn_pushfds(L);
+ fd_set *fds = (fd_set *)lua_touserdata(L, -1);
+ while (select(nfds, fds, NULL, NULL, &timeout) > 0)
+ if (os_spawn_readfds(L) >= 0) refresh_all();
+ lua_pop(L, 1); // fd_set
+#endif
+ return 0;
+}
+
/** `ui.__index` Lua metamethod. */
static int ui_index(lua_State *L) {
const char *key = lua_tostring(L, 2);
@@ -1114,6 +1129,10 @@ static int new_buffer_lua(lua_State *L) {
static sptr_t luaL_checkscintilla(lua_State *L, int *arg, int type) {
if (type == SSTRING) return (sptr_t)luaL_checkstring(L, (*arg)++);
if (type == SBOOL) return lua_toboolean(L, (*arg)++);
+ if (type == SINDEX) {
+ int i = luaL_checkinteger(L, (*arg)++);
+ return i >= 0 ? i - 1 : i; // do not adjust significant values like -1
+ }
if (type >= SINT && type <= SKEYMOD) return luaL_checkinteger(L, (*arg)++);
return 0;
}
@@ -1175,6 +1194,7 @@ static int call_scintilla(
// Send the message to Scintilla and return the appropriate values.
sptr_t result = SS(view, msg, wparam, lparam);
if (string_return) lua_pushlstring(L, text, len), nresults++, free(text);
+ if (rtype == SINDEX && result >= 0) result++;
if (rtype > SVOID && rtype < SBOOL)
lua_pushinteger(L, result), nresults++;
else if (rtype == SBOOL)
@@ -1588,6 +1608,7 @@ static int init_lua(lua_State *L, int argc, char **argv, int reinit) {
lua_pushcfunction(L, get_split_table), lua_setfield(L, -2, "get_split_table");
lua_pushcfunction(L, goto_view), lua_setfield(L, -2, "goto_view");
lua_pushcfunction(L, menu), lua_setfield(L, -2, "menu");
+ lua_pushcfunction(L, update_ui), lua_setfield(L, -2, "update");
set_metatable(L, -1, "ta_ui", ui_index, ui_newindex);
lua_setglobal(L, "ui");
@@ -1888,7 +1909,7 @@ static void tab_changed(GtkNotebook *_, GtkWidget *__, int tab_num, void *L) {
static void emit_notification(lua_State *L, 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->position + 1), 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),
@@ -1902,11 +1923,11 @@ static void emit_notification(lua_State *L, SCNotification *n) {
//lua_pushinteger(L, n->message), lua_setfield(L, -2, "message");
lua_pushinteger(L, n->listType), lua_setfield(L, -2, "list_type");
//lua_pushinteger(L, n->lParam), lua_setfield(L, -2, "lParam");
- lua_pushinteger(L, n->line), lua_setfield(L, -2, "line");
+ lua_pushinteger(L, n->line + 1), 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->margin + 1), 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");
//lua_pushinteger(L, n->token), lua_setfield(L, -2, "token");
@@ -2096,7 +2117,7 @@ static int view_index(lua_State *L) {
if (GTK_IS_PANED(p = gtk_widget_get_parent(lua_toview(L, 1))))
lua_pushinteger(L, gtk_paned_get_position(GTK_PANED(p)));
#elif CURSES
- if (p = get_parent_pane(pane, lua_toview(L, 1)))
+ if ((p = get_parent_pane(pane, lua_toview(L, 1))))
lua_pushinteger(L, p->split_size);
#endif
//} else if (lua_getfield(L, LUA_REGISTRYINDEX, "ta_functions"),
@@ -2126,7 +2147,7 @@ static int view_newindex(lua_State *L) {
if (GTK_IS_PANED(p = gtk_widget_get_parent(lua_toview(L, 1))))
gtk_paned_set_position(GTK_PANED(p), fmax(luaL_checkinteger(L, 3), 0));
#elif CURSES
- if (p = get_parent_pane(pane, lua_toview(L, 1)))
+ if ((p = get_parent_pane(pane, lua_toview(L, 1))))
p->split_size = fmax(luaL_checkinteger(L, 3), 0),
resize_pane(p, p->rows, p->cols, p->y, p->x);
#endif
diff --git a/test/test.lua b/test/test.lua
index 7f270fad..7fc53b75 100644
--- a/test/test.lua
+++ b/test/test.lua
@@ -1,9 +1,10 @@
-- Copyright 2020 Mitchell mitchell.att.foicica.com. See LICENSE.
--- Scintilla uses 0-based indices as opposed to Lua's 1-based indices.
-local function LINE(i) return i - 1 end
-local function POS(i) return i - 1 end
-local function INDEX(i) return i - 1 end
+-- In the past, Scintilla used 0-based indices as opposed to Lua's 1-based
+-- indices, so these conversions were needed. Now, they are vestigal.
+local function LINE(i) return i end
+local function POS(i) return i end
+local function INDEX(i) return i end
local _tostring = tostring
-- Overloads tostring() to print more user-friendly output for `assert_equal()`.
@@ -1047,7 +1048,7 @@ function test_buffer_text_range()
buffer:set_text('foo\nbar\nbaz')
buffer:set_target_range(POS(5), POS(8))
assert_equal(buffer.target_text, 'bar')
- assert_equal(buffer:text_range(POS(1), buffer.length), 'foo\nbar\nbaz')
+ assert_equal(buffer:text_range(POS(1), buffer.length + 1), 'foo\nbar\nbaz')
assert_equal(buffer:text_range(-1, POS(4)), 'foo')
assert_equal(buffer:text_range(POS(9), POS(16)), 'baz')
assert_equal(buffer.target_text, 'bar') -- assert target range is unchanged
@@ -1059,7 +1060,7 @@ end
function test_bookmarks()
local function has_bookmark(line)
- return buffer:marker_get(line) & 1 << textadept.bookmarks.MARK_BOOKMARK > 0
+ return buffer:marker_get(line) & 1 << textadept.bookmarks.MARK_BOOKMARK - 1 > 0
end
buffer.new()
@@ -1166,7 +1167,7 @@ end
local function assert_lua_autocompletion(text, first_item)
ui.command_entry:set_text(text)
- ui.command_entry:goto_pos(ui.command_entry.length)
+ ui.command_entry:goto_pos(ui.command_entry.length + 1)
events.emit(events.KEYPRESS, string.byte('\t'))
assert_equal(ui.command_entry:auto_c_active(), true)
assert_equal(ui.command_entry.auto_c_current_text, first_item)
@@ -1467,7 +1468,7 @@ function test_editing_paste_reindent_tabs_to_spaces()
buffer:add_text('function quux()')
buffer:new_line()
buffer:insert_text(-1, 'end')
- buffer:colourise(INDEX(1), -1) -- first line should be a fold header
+ buffer:colourise(POS(1), -1) -- first line should be a fold header
textadept.editing.paste_reindent()
assert_equal(buffer:get_text(), table.concat({
'function quux()',
@@ -1760,7 +1761,7 @@ function test_editing_highlight_word()
buffer:position_from_line(LINE(4)) + 4,
buffer:position_from_line(LINE(6))
}
- local bit = 1 << textadept.editing.INDIC_HIGHLIGHT
+ local bit = 1 << textadept.editing.INDIC_HIGHLIGHT - 1
for _, pos in ipairs(indics) do
local mask = buffer:indicator_all_on_for(pos)
assert(mask & bit > 0, 'no indicator on line %d', buffer:line_from_position(pos))
@@ -2340,7 +2341,7 @@ function test_run_compile_run()
ui.goto_view(1) -- message buffer
assert_equal(buffer._type, _L['[Message Buffer]'])
assert(buffer:get_sel_text():find("'end' expected"), 'compile error not selected')
- assert(buffer:marker_get(buffer:line_from_position(buffer.current_pos)) & 1 << textadept.run.MARK_ERROR > 0)
+ assert(buffer:marker_get(buffer:line_from_position(buffer.current_pos)) & 1 << textadept.run.MARK_ERROR - 1 > 0)
events.emit(events.KEYPRESS, not CURSES and 0xFF0D or 343) -- \n
assert_equal(buffer.filename, compile_file)
ui.goto_view(1) -- message buffer
@@ -2369,7 +2370,7 @@ function test_run_compile_run()
assert_equal(buffer.filename, run_file)
assert_equal(buffer:line_from_position(buffer.current_pos), LINE(1))
ui.goto_view(1)
- assert(buffer:marker_get(buffer:line_from_position(buffer.current_pos)) & 1 << textadept.run.MARK_WARNING > 0)
+ assert(buffer:marker_get(buffer:line_from_position(buffer.current_pos)) & 1 << textadept.run.MARK_WARNING - 1 > 0)
ui.goto_view(-1)
textadept.run.goto_error(nil, false)
assert_equal(buffer.filename, compile_file)
@@ -2438,7 +2439,7 @@ function test_session_save()
textadept.session.save(session_file)
local session = assert(loadfile(session_file, 't', {}))()
assert_equal(session.buffers[#session.buffers - 1].filename, 'foo.lua')
- assert_equal(session.buffers[#session.buffers - 1].bookmarks, {0})
+ assert_equal(session.buffers[#session.buffers - 1].bookmarks, {1})
assert_equal(session.buffers[#session.buffers].filename, 'bar.lua')
assert_equal(session.ui.maximized, false)
assert_equal(type(session.views[1]), 'table')
diff --git a/themes/dark.lua b/themes/dark.lua
index 1471fe90..d46655d5 100644
--- a/themes/dark.lua
+++ b/themes/dark.lua
@@ -113,7 +113,7 @@ buffer.marker_back[MARK_BOOKMARK] = property_int['color.dark_blue']
buffer.marker_back[textadept.run.MARK_WARNING] = property_int['color.yellow']
--buffer.marker_fore[textadept.run.MARK_ERROR] = property_int['color.black']
buffer.marker_back[textadept.run.MARK_ERROR] = property_int['color.red']
-for i = 25, 31 do -- fold margin markers
+for i = buffer.MARKNUM_FOLDEREND, buffer.MARKNUM_FOLDEROPEN do -- fold margin
buffer.marker_fore[i] = property_int['color.black']
buffer.marker_back[i] = property_int['color.dark_grey']
buffer.marker_back_selected[i] = property_int['color.light_grey']
diff --git a/themes/light.lua b/themes/light.lua
index aab37c73..48c3912a 100644
--- a/themes/light.lua
+++ b/themes/light.lua
@@ -113,7 +113,7 @@ buffer.marker_back[MARK_BOOKMARK] = property_int['color.dark_blue']
buffer.marker_back[t_run.MARK_WARNING] = property_int['color.light_yellow']
--buffer.marker_fore[t_run.MARK_ERROR] = property_int['color.white']
buffer.marker_back[t_run.MARK_ERROR] = property_int['color.light_red']
-for i = 25, 31 do -- fold margin markers
+for i = buffer.MARKNUM_FOLDEREND, buffer.MARKNUM_FOLDEROPEN do -- fold margin
buffer.marker_fore[i] = property_int['color.white']
buffer.marker_back[i] = property_int['color.grey']
buffer.marker_back_selected[i] = property_int['color.grey_black']