Skip to content

Commit

Permalink
Updated to Scintilla 5.0.1 and latest Scintillua and Scinterm.
Browse files Browse the repository at this point in the history
Some of the Scintilla API has changed, and by extension the Scintillua API.
  • Loading branch information
orbitalquark committed Apr 13, 2021
1 parent 19899b5 commit 3d69ae0
Show file tree
Hide file tree
Showing 14 changed files with 146 additions and 46 deletions.
7 changes: 6 additions & 1 deletion core/.buffer.luadoc
Original file line number Diff line number Diff line change
Expand Up @@ -1734,6 +1734,7 @@ function set_lexer(buffer, name) end
-- * annotation_style_offset
-- * annotation_styles
-- * automatic_fold
-- * buffered_draw
-- * call_tip_back
-- * call_tip_fore
-- * character_category_optimization
Expand All @@ -1745,6 +1746,9 @@ function set_lexer(buffer, name) end
-- * direct_pointer
-- * distance_to_secondary_styles
-- * doc_pointer
-- * element_allows_translucent
-- * element_color
-- * element_is_set
-- * eol_annotation_style_offset
-- * focus
-- * font_quality
Expand Down Expand Up @@ -1786,6 +1790,7 @@ function set_lexer(buffer, name) end
-- * sub_style_bases
-- * sub_styles_length
-- * sub_styles_start
-- * supports_feature
-- * tab_minimum_width
-- * technology
-- * two_phase_draw
Expand Down Expand Up @@ -1829,7 +1834,6 @@ function set_lexer(buffer, name) end
-- * allocate_sub_styles
-- * assign_cmd_key
-- * brace_match_next
-- * buffered_draw
-- * can_paste
-- * change_insertion
-- * change_lexer_state
Expand Down Expand Up @@ -1883,6 +1887,7 @@ function set_lexer(buffer, name) end
-- * release_all_extended_styles
-- * release_document
-- * release_line_character_index
-- * reset_element_color
-- * set_hotspot_active_back
-- * set_hotspot_active_fore
-- * set_length_for_encode
Expand Down
39 changes: 37 additions & 2 deletions core/.view.luadoc
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,27 @@
-- Draw EOL annotations no decoration.
-- * `view.EOLANNOTATION_BOXED`
-- Draw EOL annotations outlined with a box.
--
-- The default value is `view.EOLANNOTATION_HIDDEN`.
-- * `view.EOLANNOTATION_STADIUM`
-- Draw EOL annotations outline with curved ends.
-- * `view.EOLANNOTATION_FLAT_CIRCLE`
-- Draw EOL annotations outline with a flat left end and curved right end.
-- * `view.EOLANNOTATION_ANGLE_CIRCLE`
-- Draw EOL annotations outline with an angled left end and curved right end.
-- * `view.EOLANNOTATION_CIRCLE_FLAT`
-- Draw EOL annotations outline with a curved left end and flat right end.
-- * `view.EOLANNOTATION_FLATS`
-- Draw EOL annotations outline with a flat ends.
-- * `view.EOLANNOTATION_ANGLE_FLAT`
-- Draw EOL annotations outline with an angled left end and flat right end.
-- * `view.EOLANNOTATION_CIRCLE_ANGLE`
-- Draw EOL annotations outline with a curved left end and angled right end.
-- * `view.EOLANNOTATION_FLAT_ANGLE`
-- Draw EOL annotations outline with a flat left end and angled right end.
-- * `view.EOLANNOTATION_ANGLES`
-- Draw EOL annotations outline with angled ends.
--
-- All annotations are drawn with the same shape. The default value is
-- `view.EOLANNOTATION_HIDDEN`.
-- @field extra_ascent (number)
-- The amount of pixel padding above lines.
-- The default value is `0`.
Expand Down Expand Up @@ -251,6 +270,12 @@
-- for indicator numbers from `1` to `32` whose styles are either `INDIC_ROUNDBOX`,
-- `INDIC_STRAIGHTBOX`, or `INDIC_DOTBOX`.
-- The default values are `view.ALPHA_NOALPHA`, for no alpha.
-- @field indic_stroke_width (table)
-- Table of stroke widths in hundredths of a pixel for indicator numbers from `1` to `32`
-- whose styles are either `INDIC_PLAIN`, `INDIC_SQUIGGLE`, `INDIC_TT`, `INDIC_DIAGONAL`,
-- `INDIC_STRIKE`, `INDIC_BOX`, `INDIC_ROUNDBOX`, `INDIC_STRAIGHTBOX`, `INDIC_FULLBOX`,
-- `INDIC_DASH`, `INDIC_DOTS`, or `INDIC_SQUIGGLELOW`.
-- The default values are `100`, or 1 pixel.
-- @field indic_style (table)
-- Table of styles for indicator numbers from `1` to `32`.
--
Expand Down Expand Up @@ -391,11 +416,21 @@
-- The default values are `view.ALPHA_NOALPHA`, for no alpha.
-- @field marker_back (table, Write-only)
-- Table of background colors, in "0xBBGGRR" format, of marker numbers from `1` to `32`.
-- @field marker_back_translucent (table, Write-only)
-- Table of background colors, in "0xAABBGGRR" format, of marker numbers from `1` to `32`.
-- @field marker_back_selected (table, Write-only)
-- Table of background colors, in "0xBBGGRR" format, of markers whose folding blocks are
-- selected for marker numbers from `1` to `32`.
-- @field marker_back_selected_translucent (table, Write-only)
-- Table of background colors, in "0xAABBGGRR" format, of markers whose folding blocks are
-- selected for marker numbers from `1` to `32`.
-- @field marker_fore (table, Write-only)
-- Table of foreground colors, in "0xBBGGRR" format, of marker numbers from `1` to `32`.
-- @field marker_fore_translucent (table, Write-only)
-- Table of foreground colors, in "0xAABBGGRR" format, of marker numbers from `1` to `32`.
-- @field marker_stroke_width (table, Write-only)
-- Table of stroke widths in hundredths of a pixel for marker numbers from `1` to `32`.
-- The default values are `100`, or 1 pixel.
-- @field mouse_dwell_time (number)
-- The number of milliseconds the mouse must idle before generating a `DWELL_START` event. A
-- time of `view.TIME_FOREVER` will never generate one.
Expand Down
6 changes: 3 additions & 3 deletions core/iface.lua

Large diffs are not rendered by default.

54 changes: 52 additions & 2 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -9723,8 +9723,27 @@ The EOL annotation visibility mode.
Draw EOL annotations no decoration.
* `view.EOLANNOTATION_BOXED`
Draw EOL annotations outlined with a box.

The default value is `view.EOLANNOTATION_HIDDEN`.
* `view.EOLANNOTATION_STADIUM`
Draw EOL annotations outline with curved ends.
* `view.EOLANNOTATION_FLAT_CIRCLE`
Draw EOL annotations outline with a flat left end and curved right end.
* `view.EOLANNOTATION_ANGLE_CIRCLE`
Draw EOL annotations outline with an angled left end and curved right end.
* `view.EOLANNOTATION_CIRCLE_FLAT`
Draw EOL annotations outline with a curved left end and flat right end.
* `view.EOLANNOTATION_FLATS`
Draw EOL annotations outline with a flat ends.
* `view.EOLANNOTATION_ANGLE_FLAT`
Draw EOL annotations outline with an angled left end and flat right end.
* `view.EOLANNOTATION_CIRCLE_ANGLE`
Draw EOL annotations outline with a curved left end and angled right end.
* `view.EOLANNOTATION_FLAT_ANGLE`
Draw EOL annotations outline with a flat left end and angled right end.
* `view.EOLANNOTATION_ANGLES`
Draw EOL annotations outline with angled ends.

All annotations are drawn with the same shape. The default value is
`view.EOLANNOTATION_HIDDEN`.

<a id="view.extra_ascent"></a>
#### `view.extra_ascent` (number)
Expand Down Expand Up @@ -9874,6 +9893,15 @@ Table of outline color alpha values, ranging from `0` (transparent) to `255` (op
`INDIC_STRAIGHTBOX`, or `INDIC_DOTBOX`.
The default values are `view.ALPHA_NOALPHA`, for no alpha.

<a id="view.indic_stroke_width"></a>
#### `view.indic_stroke_width` (table)

Table of stroke widths in hundredths of a pixel for indicator numbers from `1` to `32`
whose styles are either `INDIC_PLAIN`, `INDIC_SQUIGGLE`, `INDIC_TT`, `INDIC_DIAGONAL`,
`INDIC_STRIKE`, `INDIC_BOX`, `INDIC_ROUNDBOX`, `INDIC_STRAIGHTBOX`, `INDIC_FULLBOX`,
`INDIC_DASH`, `INDIC_DOTS`, or `INDIC_SQUIGGLELOW`.
The default values are `100`, or 1 pixel.

<a id="view.indic_style"></a>
#### `view.indic_style` (table)

Expand Down Expand Up @@ -10068,11 +10096,33 @@ Table of background colors, in "0xBBGGRR" format, of marker numbers from `1` to
Table of background colors, in "0xBBGGRR" format, of markers whose folding blocks are
selected for marker numbers from `1` to `32`.

<a id="view.marker_back_selected_translucent"></a>
#### `view.marker_back_selected_translucent` (table, Write-only)

Table of background colors, in "0xAABBGGRR" format, of markers whose folding blocks are
selected for marker numbers from `1` to `32`.

<a id="view.marker_back_translucent"></a>
#### `view.marker_back_translucent` (table, Write-only)

Table of background colors, in "0xAABBGGRR" format, of marker numbers from `1` to `32`.

<a id="view.marker_fore"></a>
#### `view.marker_fore` (table, Write-only)

Table of foreground colors, in "0xBBGGRR" format, of marker numbers from `1` to `32`.

<a id="view.marker_fore_translucent"></a>
#### `view.marker_fore_translucent` (table, Write-only)

Table of foreground colors, in "0xAABBGGRR" format, of marker numbers from `1` to `32`.

<a id="view.marker_stroke_width"></a>
#### `view.marker_stroke_width` (table, Write-only)

Table of stroke widths in hundredths of a pixel for marker numbers from `1` to `32`.
The default values are `100`, or 1 pixel.

<a id="view.mouse_dwell_time"></a>
#### `view.mouse_dwell_time` (number)

Expand Down
2 changes: 1 addition & 1 deletion docs/manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -1773,7 +1773,7 @@ N/A | Added | [active][]
N/A | Added | _buffer functions and fields_<sup>d</sup>

<sup>a</sup>Returns prefix and function, instead of just function.<br/>
<sup>b</sup>Use `for name in buffer:private_lexer_call(_SCINTILLA.functions.property_names[1]):gmatch('[^\n]+') do ... end`.<br/>
<sup>b</sup>Use `for name in buffer:private_lexer_call(_SCINTILLA.properties.lexer_language[1]):gmatch('[^\n]+') do ... end`.<br/>
<sup>c</sup>Use `textadept.menu.menubar[_L['Search']][_L['Find Incremental']][2]`.<br/>
<sup>d</sup>Most buffer functions and fields are available in views now. See section below.

Expand Down
18 changes: 9 additions & 9 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ for name, f in pairs(io) do if name:find('^_') then buffer[name:sub(2)], io[name

textadept = require('textadept')

local SETLEXERLANGUAGE = _SCINTILLA.properties.lexer_language[2]
local SETLEXER = _SCINTILLA.properties.i_lexer[2]

-- Documentation is in core/.view.luadoc.
local function set_theme(view, name, env)
Expand All @@ -32,7 +32,7 @@ local function set_theme(view, name, env)
-- Force reload of all styles since the current lexer may have defined its own styles. (The
-- LPeg lexer has only refreshed default lexer styles.)
-- Note: cannot use `buffer.set_lexer()` because it may not exist yet.
buffer:private_lexer_call(SETLEXERLANGUAGE, buffer._lexer or 'text')
buffer:private_lexer_call(SETLEXER, buffer._lexer or 'text')
if view ~= orig_view then ui.goto_view(orig_view) end
end
events.connect(events.VIEW_NEW, function() view.set_theme = set_theme end)
Expand Down Expand Up @@ -246,8 +246,8 @@ view.indic_style[textadept.editing.INDIC_BRACEMATCH] = view.INDIC_BOX
view:brace_highlight_indicator(not CURSES, textadept.editing.INDIC_BRACEMATCH)
view.indic_style[textadept.editing.INDIC_HIGHLIGHT] = view.INDIC_ROUNDBOX
view.indic_under[textadept.editing.INDIC_HIGHLIGHT] = not CURSES
view.indic_style[textadept.snippets.INDIC_PLACEHOLDER] =
not CURSES and view.INDIC_DOTBOX or view.INDIC_STRAIGHTBOX
view.indic_style[textadept.snippets.INDIC_PLACEHOLDER] = not CURSES and view.INDIC_DOTBOX or
view.INDIC_STRAIGHTBOX

-- Autocompletion.
-- buffer.auto_c_separator =
Expand Down Expand Up @@ -310,17 +310,17 @@ end
local SETDIRECTFUNCTION = _SCINTILLA.properties.direct_function[1]
local SETDIRECTPOINTER = _SCINTILLA.properties.doc_pointer[2]
local SETLUASTATE = _SCINTILLA.functions.change_lexer_state[1]
local LOADLEXERLIBRARY = _SCINTILLA.functions.load_lexer_library[1]
local CREATELOADER = _SCINTILLA.functions.create_loader[1]
-- Sets default properties for a Scintilla document.
events.connect(events.BUFFER_NEW, function()
local buffer = _G.buffer
buffer:private_lexer_call(SETDIRECTFUNCTION, buffer.direct_function)
buffer:private_lexer_call(SETDIRECTPOINTER, buffer.direct_pointer)
buffer:private_lexer_call(SETLUASTATE, _LUA)
buffer:private_lexer_call(LOADLEXERLIBRARY, _USERHOME .. '/lexers')
buffer:private_lexer_call(LOADLEXERLIBRARY, _HOME .. '/lexers')
buffer:private_lexer_call(CREATELOADER, _USERHOME .. '/lexers')
buffer:private_lexer_call(CREATELOADER, _HOME .. '/lexers')
load_settings()
buffer:private_lexer_call(SETLEXERLANGUAGE, 'text')
buffer:private_lexer_call(SETLEXER, 'text')
_G.lexer = require('lexer') -- replace mimic
if buffer == ui.command_entry then ui.command_entry.caret_line_visible = false end
end, 1)
Expand All @@ -342,5 +342,5 @@ events.connect(events.VIEW_NEW, function()
-- thus need refreshing. This is not an issue in BUFFER_NEW since a lexer is set immediately
-- afterwards, which refreshes styles.
-- Note: `buffer:set_lexer()` is insufficient for some reason.
buffer:private_lexer_call(SETLEXERLANGUAGE, buffer._lexer or 'text')
buffer:private_lexer_call(SETLEXER, buffer._lexer or 'text')
end, 1)
Loading

0 comments on commit 3d69ae0

Please sign in to comment.