aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--doc/manual.md17
-rw-r--r--init.lua2
-rw-r--r--modules/lua/ta_api28
-rw-r--r--modules/lua/ta_tags4
-rw-r--r--src/Makefile2
-rw-r--r--test/test.lua32
6 files changed, 60 insertions, 25 deletions
diff --git a/doc/manual.md b/doc/manual.md
index 44354113..729339ca 100644
--- a/doc/manual.md
+++ b/doc/manual.md
@@ -2068,6 +2068,7 @@ MODE |Renamed |[mode][]
N/A |Added |[to_eol()][]
delimited\_range() |Replaced|[range()][]
nested\_pair() |Replaced|[range()][]
+fold\_line\_comments() |Replaced|[fold_consecutive_lines()][]<sup>a</sup>
N/A |Added |[number][]
N/A |Added |[colors][]
N/A |Added |[styles][]
@@ -2080,9 +2081,9 @@ toggle(line, on) |Changed |[toggle()][]
block\_comment() |Renamed |[toggle_comment()][]
highlight_word() |Replaced|[highlight_words][]
**textadept.file_types** | |
-lexers |Removed |N/A<sup>a</sup>
+lexers |Removed |N/A<sup>b</sup>
**textadept.find** | |
-find\_incremental() |Replaced|[incremental][]<sup>b</sup>
+find\_incremental() |Replaced|[incremental][]<sup>c</sup>
find\_incremental\_keys |Removed |
N/A |Added |[highlight_all_matches][]
**textadept.snippets** | |
@@ -2098,11 +2099,12 @@ N/A |Added |[progressbar()][]
**ui.find** | |
find\_in\_files\_timeout |Removed |N/A
**view** | |
-N/A |Added |_buffer functions and fields_<sup>c</sup>
+N/A |Added |_buffer functions and fields_<sup>d</sup>
-<sup>a</sup>Use `for name in buffer:private_lexer_call(_SCINTILLA.functions.property_names[1]):gmatch('[^\n]+') do ... end`.<br/>
-<sup>b</sup>Use `textadept.menu.menubar[_L['Search']][_L['Find Incremental']][2]`.<br/>
-<sup>c</sup>Most buffer functions and fields are available in views now. See
+<sup>a</sup>Returns prefix and function, instead of just function.
+<sup>b</sup>Use `for name in buffer:private_lexer_call(_SCINTILLA.functions.property_names[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.
[view:set_theme()]: api.html#view.set_theme
@@ -2116,6 +2118,7 @@ section below.
[mode]: api.html#keys.mode
[to_eol()]: api.html#lexer.to_eol
[range()]: api.html#lexer.range
+[fold_consecutive_lines()]: api.html#lexer.fold_consecutive_lines
[number]: api.html#lexer.number
[colors]: api.html#lexer.colors
[styles]: api.html#lexer.styles
@@ -2251,7 +2254,7 @@ examples.
#### Key Bindings Changes
-Key binding modifiers have changed from their shortened form to a longer form
+Key sequence modifiers have changed from their shortened form to a longer form
that is more intuitive. `'c'` is now `'ctrl'`, `'a'` is now `'alt'`, `'m'` is
now `'cmd'` on macOS and `'meta'` in the terminal version, and `'s'` is now
`'shift'`. For example, `keys.cn = ...` is now `keys['ctrl+n'] = ...` and
diff --git a/init.lua b/init.lua
index 1ac5e783..661f281e 100644
--- a/init.lua
+++ b/init.lua
@@ -297,7 +297,7 @@ view.call_tip_use_style = buffer.tab_width *
-- Folding.
lexer.folding = true
--lexer.fold_by_indentation = true
---lexer.fold_line_comments = true
+--lexer.fold_line_groups = true
--lexer.fold_on_zero_sum_lines = true
--lexer.fold_compact = true
view.automatic_fold = view.AUTOMATICFOLD_SHOW | view.AUTOMATICFOLD_CLICK |
diff --git a/modules/lua/ta_api b/modules/lua/ta_api
index 8d4698ef..79e8f0a4 100644
--- a/modules/lua/ta_api
+++ b/modules/lua/ta_api
@@ -13,8 +13,8 @@ AUTO_C_COMPLETED events.AUTO_C_COMPLETED (string)\nEmitted after inserting an it
AUTO_C_SELECTION events.AUTO_C_SELECTION (string)\nEmitted after selecting an item from an autocompletion list, but before\ninserting that item into the buffer.\nAutomatic insertion can be canceled by calling\n`buffer:auto_c_cancel()` before returning from the event handler.\nArguments:\n\n* _`text`_: The selection's text.\n* _`position`_: The autocompleted word's beginning position.
AUTO_C_SELECTION_CHANGE events.AUTO_C_SELECTION_CHANGE (string)\nEmitted as items are highlighted in an autocompletion or user list.\nArguments:\n\n* _`id`_: Either the *id* from `buffer.user_list_show()` or `0` for an\n autocompletion list.\n* _`text`_: The current selection's text.\n* _`position`_: The position the list was displayed at.
BSD _G.BSD (bool)\nWhether or not Textadept is running on BSD.
-BUFFER_AFTER_SWITCH events.BUFFER_AFTER_SWITCH (string)\nEmitted right after switching to another buffer.\nEmitted by `view.goto_buffer()`.
-BUFFER_BEFORE_SWITCH events.BUFFER_BEFORE_SWITCH (string)\nEmitted right before switching to another buffer.\nEmitted by `view.goto_buffer()`.
+BUFFER_AFTER_SWITCH events.BUFFER_AFTER_SWITCH (string)\nEmitted right after switching to another buffer.\nThe buffer being switched to is `buffer`.\nEmitted by `view.goto_buffer()`.
+BUFFER_BEFORE_SWITCH events.BUFFER_BEFORE_SWITCH (string)\nEmitted right before switching to another buffer.\nThe buffer being switched from is `buffer`.\nEmitted by `view.goto_buffer()`.
BUFFER_DELETED events.BUFFER_DELETED (string)\nEmitted after deleting a buffer.\nEmitted by `buffer.delete()`.
BUFFER_NEW events.BUFFER_NEW (string)\nEmitted after creating a new buffer.\nThe new buffer is `buffer`.\nEmitted on startup and by `buffer.new()`.
BUILD_OUTPUT events.BUILD_OUTPUT (string)\nEmitted when executing a project's build shell command.\nBy default, output is printed to the message buffer. In order to override\nthis behavior, connect to the event with an index of `1` and return `true`.\nArguments:\n\n* `output`: A line of string output from the command.
@@ -288,8 +288,8 @@ URI_DROPPED events.URI_DROPPED (string)\nEmitted after dragging and dropping a U
USER_LIST_SELECTION events.USER_LIST_SELECTION (string)\nEmitted after selecting an item in a user list.\nArguments:\n\n* _`id`_: The *id* from `buffer.user_list_show()`.\n* _`text`_: The selection's text.\n* _`position`_: The position the list was displayed at.
VARIABLE lexer.VARIABLE (string)\nThe token name for variable tokens.
VARIABLE textadept.editing.XPM_IMAGES.VARIABLE (table)\nThe image number for variables.
-VIEW_AFTER_SWITCH events.VIEW_AFTER_SWITCH (string)\nEmitted right after switching to another view.\nEmitted by `ui.goto_view()`.
-VIEW_BEFORE_SWITCH events.VIEW_BEFORE_SWITCH (string)\nEmitted right before switching to another view.\nEmitted by `ui.goto_view()`.
+VIEW_AFTER_SWITCH events.VIEW_AFTER_SWITCH (string)\nEmitted right after switching to another view.\nThe view being switched to is `view`.\nEmitted by `ui.goto_view()`.
+VIEW_BEFORE_SWITCH events.VIEW_BEFORE_SWITCH (string)\nEmitted right before switching to another view.\nThe view being switched from is `view`.\nEmitted by `ui.goto_view()`.
VIEW_NEW events.VIEW_NEW (string)\nEmitted after creating a new view.\nThe new view is `view`.\nEmitted on startup and by `view.split()`.
VISIBLE_SLOP view.VISIBLE_SLOP (number, Read-only)\n
VISIBLE_STRICT view.VISIBLE_STRICT (number, Read-only)\n
@@ -332,7 +332,7 @@ _VIEWS _G._VIEWS (table)\nTable of all views in Textadept.\nNumeric keys have vi
_print ui._print(buffer_type, ...)\nPrints the given string messages to the buffer of string type *buffer_type*.\nOpens a new buffer for printing messages to if necessary. If the message\nbuffer is already open in a view, the message is printed to that view.\nOtherwise the view is split (unless `ui.tabs` is `true`) and the message\nbuffer is displayed before being printed to.\n@param buffer_type String type of message buffer.\n@param ... Message strings.\n@usage ui._print(_L['[Message Buffer]'], message)
abspath lfs.abspath(filename, prefix)\nReturns the absolute path to string *filename*.\n*prefix* or `lfs.currentdir()` is prepended to a relative filename. The\nreturned path is not guaranteed to exist.\n@param filename The relative or absolute path to a file.\n@param prefix Optional prefix path prepended to a relative filename.\n@return string absolute path
add_dic spellchecker:add_dic(dic)\nAdds words from dictionary file path *dic* to the spellchecker.\n@param dic Path to the Hunspell dictionary file to load.
-add_fold_point lexer.add_fold_point(lexer, token_name, start_symbol, end_symbol)\nAdds to lexer *lexer* a fold point whose beginning and end tokens are string\n*token_name* tokens with string content *start_symbol* and *end_symbol*,\nrespectively.\nIn the event that *start_symbol* may or may not be a fold point depending on\ncontext, and that additional processing is required, *end_symbol* may be a\nfunction that ultimately returns `1` (indicating a beginning fold point),\n`-1` (indicating an ending fold point), or `0` (indicating no fold point).\nThat function is passed the following arguments:\n\n * `text`: The text being processed for fold points.\n * `pos`: The position in *text* of the beginning of the line currently\n being processed.\n * `line`: The text of the line currently being processed.\n * `s`: The position of *start_symbol* in *line*.\n * `symbol`: *start_symbol* itself.\n@param lexer The lexer to add a fold point to.\n@param token_name The token name of text that indicates a fold point.\n@param start_symbol The text that indicates the beginning of a fold point.\n@param end_symbol Either the text that indicates the end of a fold point, or\n a function that returns whether or not *start_symbol* is a beginning fold\n point (1), an ending fold point (-1), or not a fold point at all (0).\n@usage lex:add_fold_point(lexer.OPERATOR, '{', '}')\n@usage lex:add_fold_point(lexer.KEYWORD, 'if', 'end')\n@usage lex:add_fold_point(lexer.COMMENT, '#', lexer.fold_line_comments('#'))\n@usage lex:add_fold_point('custom', function(text, pos, line, s, symbol)\n ... end)
+add_fold_point lexer.add_fold_point(lexer, token_name, start_symbol, end_symbol)\nAdds to lexer *lexer* a fold point whose beginning and end tokens are string\n*token_name* tokens with string content *start_symbol* and *end_symbol*,\nrespectively.\nIn the event that *start_symbol* may or may not be a fold point depending on\ncontext, and that additional processing is required, *end_symbol* may be a\nfunction that ultimately returns `1` (indicating a beginning fold point),\n`-1` (indicating an ending fold point), or `0` (indicating no fold point).\nThat function is passed the following arguments:\n\n * `text`: The text being processed for fold points.\n * `pos`: The position in *text* of the beginning of the line currently\n being processed.\n * `line`: The text of the line currently being processed.\n * `s`: The position of *start_symbol* in *line*.\n * `symbol`: *start_symbol* itself.\n@param lexer The lexer to add a fold point to.\n@param token_name The token name of text that indicates a fold point.\n@param start_symbol The text that indicates the beginning of a fold point.\n@param end_symbol Either the text that indicates the end of a fold point, or\n a function that returns whether or not *start_symbol* is a beginning fold\n point (1), an ending fold point (-1), or not a fold point at all (0).\n@usage lex:add_fold_point(lexer.OPERATOR, '{', '}')\n@usage lex:add_fold_point(lexer.KEYWORD, 'if', 'end')\n@usage lex:add_fold_point(lexer.COMMENT, lexer.fold_consecutive_lines('#'))\n@usage lex:add_fold_point('custom', function(text, pos, line, s, symbol)\n ... end)
add_rule lexer.add_rule(lexer, id, rule)\nAdds pattern *rule* identified by string *id* to the ordered list of rules\nfor lexer *lexer*.\n@param lexer The lexer to add the given rule to.\n@param id The id associated with this rule. It does not have to be the same\n as the name passed to `token()`.\n@param rule The LPeg pattern of the rule.\n@see modify_rule
add_selection buffer.add_selection(buffer, end_pos, start_pos)\nSelects the range of text between positions *start_pos* to *end_pos* as the\nmain selection, retaining all other selections as additional selections.\nSince an empty selection (i.e. the current position) still counts as a\nselection, use `buffer.set_selection()` first when setting a list of\nselections.\n@param buffer A buffer.\n@param end_pos The caret position of the range of text to select in *buffer*.\n@param start_pos The anchor position of the range of text to select in\n *buffer*.\n@see set_selection
add_style lexer.add_style(lexer, token_name, style)\nAssociates string *token_name* in lexer *lexer* with style table *style*.\n*style* may have the following fields:\n\n* `font`: String font name.\n* `size`: Integer font size.\n* `bold`: Whether or not the font face is bold. The default value is `false`.\n* `weight`: Integer weight or boldness of a font, between 1 and 999.\n* `italics`: Whether or not the font face is italic. The default value is\n `false`.\n* `underlined`: Whether or not the font face is underlined. The default value\n is `false`.\n* `fore`: Font face foreground color in `0xBBGGRR` or `"#RRGGBB"` format.\n* `back`: Font face background color in `0xBBGGRR` or `"#RRGGBB"` format.\n* `eolfilled`: Whether or not the background color extends to the end of the\n line. The default value is `false`.\n* `case`: Font case, `'u'` for upper, `'l'` for lower, and `'m'` for normal,\n mixed case. The default value is `'m'`.\n* `visible`: Whether or not the text is visible. The default value is `true`.\n* `changeable`: Whether the text is changeable instead of read-only. The\n default value is `true`.\n\nField values may also contain "$(property.name)" expansions for properties\ndefined in Scintilla, theme files, etc.\n@param lexer The lexer to add a style to.\n@param token_name The name of the token to associated with the style.\n@param style A style string for Scintilla.\n@usage lex:add_style('longstring', lexer.styles.string)\n@usage lex:add_style('deprecated_func', lexer.styles['function'] ..\n {italics = true}\n@usage lex:add_style('visible_ws', lexer.styles.whitespace ..\n {back = lexer.colors.grey}
@@ -560,7 +560,7 @@ file_types textadept.file_types (module)\nHandles file type detection for Textad
filename buffer.filename (string)\nThe absolute file path associated with the buffer.
filesave ui.dialogs.filesave(options)\nPrompts the user with a file save dialog defined by dialog options table\n*options*, returning the string file chosen.\nIf the user canceled the dialog, returns `nil`.\n@param options Table of key-value option pairs for the dialog.\n\n * `title`: The dialog's title text.\n * `with_directory`: The initial filesystem directory to show.\n * `with_file`: The initially chosen filename. This option requires\n `with_directory` to be set.\n * `with_extension`: The list of extensions selectable files must have.\n * `no_create_directories`: Prevent the user from creating new directories.\n The default value is `false`.\n@return filename or nil
fileselect ui.dialogs.fileselect(options)\nPrompts the user with a file selection dialog defined by dialog options\ntable *options*, returning the string file selected.\nIf *options*.`select_multiple` is `true`, returns the list of files selected.\nIf the user canceled the dialog, returns `nil`.\n@param options Table of key-value option pairs for the dialog.\n\n * `title`: The dialog's title text.\n * `with_directory`: The initial filesystem directory to show.\n * `with_file`: The initially selected filename. This option requires\n `with_directory` to be set.\n * `with_extension`: The list of extensions selectable files must have.\n * `select_multiple`: Allow the user to select multiple files. The default\n value is `false`.\n * `select_only_directories`: Only allow the user to select directories. The\n default value is `false`.\n@usage ui.dialogs.fileselect{title = 'Open C File', with_directory = _HOME,\n with_extension = {'c', 'h'}, select_multiple = true}\n@return filename, list of filenames, or nil
-filter_through textadept.editing.filter_through(command)\nPasses the selected text or all buffer text to string shell command *command*\nas standard input (stdin) and replaces the input text with the command's\nstandard output (stdout). *command* may contain pipes.\nStandard input is as follows:\n\n1. If no text is selected, the entire buffer is used.\n2. If text is selected and spans a single line, only the selected text is\nused.\n3. If text is selected and spans multiple lines, all text on the lines that\nhave text selected is passed as stdin. However, if the end of the selection\nis at the beginning of a line, only the line ending delimiters from the\nprevious line are included. The rest of the line is excluded.\n@param command The Linux, BSD, Mac OSX, or Windows shell command to filter\n text through. May contain pipes.
+filter_through textadept.editing.filter_through(command)\nPasses the selected text or all buffer text to string shell command *command*\nas standard input (stdin) and replaces the input text with the command's\nstandard output (stdout). *command* may contain shell pipes ('|').\nStandard input is as follows:\n\n1. If no text is selected, the entire buffer is used.\n2. If text is selected and spans a single line, only the selected text is\nused.\n3. If text is selected and spans multiple lines, all text on the lines that\nhave text selected is passed as stdin. However, if the end of the selection\nis at the beginning of a line, only the line ending delimiters from the\nprevious line are included. The rest of the line is excluded.\n@param command The Linux, BSD, Mac OSX, or Windows shell command to filter\n text through. May contain pipes.
filteredlist ui.dialogs.filteredlist(options)\nPrompts the user with a filtered list item selection dialog defined by dialog\noptions table *options*, returning the selected button's index along with the\nindex or indices of the selected item or items (depending on whether or not\n*options*.`select_multiple` is `true`).\nIf *options*.`string_output` is `true`, returns the selected button's label\nalong with the text of the selected item or items.\nIf the dialog timed out, returns `0` or `"timeout"`. If the user canceled the\ndialog, returns `-1` or `"delete"`.\nSpaces in the filter text are treated as wildcards.\n@param options Table of key-value option pairs for the filtered list dialog.\n\n * `title`: The dialog's title text.\n * `informative_text`: The dialog's main message text.\n * `text`: The dialog's initial input text.\n * `columns`: The list of string column names for list rows.\n * `items`: The list of string items to show in the filtered list.\n * `button1`: The right-most button's label. The default value is\n `_L['OK']`.\n * `button2`: The middle button's label.\n * `button3`: The left-most button's label. This option requires `button2`\n to be set.\n * `select_multiple`: Allow the user to select multiple items. The default\n value is `false`.\n * `search_column`: The column number to filter the input text against. The\n default value is `1`. This option requires `columns` to be set and\n contain at least *n* column names.\n * `output_column`: The column number to use for `string_output`. The\n default value is `1`. This option requires `columns` to be set and\n contain at least *n* column names.\n * `string_output`: Return the selected button's label (instead of its\n index) and the selected item's text (instead of its index). If no item\n was selected, returns the dialog's exit status (instead of its exit\n code). The default value is `false`.\n * `width`: The dialog's pixel width.\n * `height`: The dialog's pixel height.\n * `float`: Show the dialog on top of all desktop windows. The default value\n is `false`.\n * `timeout`: The integer number of seconds the dialog waits for the user to\n select a button before timing out. Dialogs do not time out by default.\n@usage ui.dialogs.filteredlist{title = 'Title', columns = {'Foo', 'Bar'},\n items = {'a', 'b', 'c', 'd'}}\n@return selected button or exit code, selected item or list of selected items
find ui.find (module)\nTextadept's Find & Replace pane.
find_column buffer.find_column(buffer, line, column)\nReturns the position of column number *column* on line number *line* (taking\ntab and multi-byte characters into account), or the position at the end of\nline *line*.\n@param buffer A buffer.\n@param line The line number in *buffer* to use.\n@param column The column number to use.
@@ -582,14 +582,14 @@ fold_all view.fold_all(view, action)\nContracts, expands, or toggles all fold po
fold_by_indentation lexer.fold_by_indentation (boolean)\nWhether or not to fold based on indentation level if a lexer does not have\na folder.\nSome lexers automatically enable this option. It is disabled by default.\nThis is an alias for `lexer.property['fold.by.indentation'] = '1|0'`.
fold_children view.fold_children(view, line, action)\nContracts, expands, or toggles the fold point on line number *line*, as well\nas all of its children, depending on *action*.\n@param view A view.\n@param line The line number in *view* to set the fold states for.\n@param action The fold action to perform. Valid values are:\n * `view.FOLDACTION_CONTRACT`\n * `view.FOLDACTION_EXPAND`\n * `view.FOLDACTION_TOGGLE`
fold_compact lexer.fold_compact (boolean)\nWhether or not blank lines after an ending fold point are included in that\nfold.\nThis option is disabled by default.\nThis is an alias for `lexer.property['fold.compact'] = '1|0'`.
+fold_consecutive_lines lexer.fold_consecutive_lines(prefix)\nReturns for `lexer.add_fold_point()` the parameters needed to fold\nconsecutive lines that start with string *prefix*.\n@param prefix The prefix string (e.g. a line comment).\n@usage lex:add_fold_point(lexer.COMMENT, lexer.fold_consecutive_lines('--'))\n@usage lex:add_fold_point(lexer.COMMENT, lexer.fold_consecutive_lines('//'))\n@usage lex:add_fold_point(\n lexer.KEYWORD, lexer.fold_consecutive_lines('import'))
fold_display_text_style view.fold_display_text_style (number)\nThe fold display text mode.\n\n* `view.FOLDDISPLAYTEXT_HIDDEN`\n Fold display text is not shown.\n* `view.FOLDDISPLAYTEXT_STANDARD`\n Fold display text is shown with no decoration.\n* `view.FOLDDISPLAYTEXT_BOXED`\n Fold display text is shown outlined with a box.\n\nThe default value is `view.FOLDDISPLAYTEXT_HIDDEN`.
fold_expanded view.fold_expanded (table)\nTable of flags per line number that indicate whether or not fold points are\nexpanded for those line numbers.\nSetting expanded fold states does not toggle folds; it only updates fold\nmargin markers. Use `view.toggle_fold()` instead.
fold_flags view.fold_flags (number, Read-only)\nBit-mask of folding lines to draw in the buffer.\n\n* `view.FOLDFLAG_LINEBEFORE_EXPANDED`\n Draw lines above expanded folds.\n* `view.FOLDFLAG_LINEBEFORE_CONTRACTED`\n Draw lines above collapsed folds.\n* `view.FOLDFLAG_LINEAFTER_EXPANDED`\n Draw lines below expanded folds.\n* `view.FOLDFLAG_LINEAFTER_CONTRACTED`\n Draw lines below collapsed folds.\n* `view.FOLDFLAG_LEVELNUMBERS`\n Show hexadecimal fold levels in line margins.\n This option cannot be combined with `FOLDFLAG_LINESTATE`.\n* `view.FOLDFLAG_LINESTATE`\n Show line state in line margins.\n This option cannot be combined with `FOLDFLAG_LEVELNUMBERS`.\n\nThe default value is `0`.
fold_level buffer.fold_level (table)\nTable of fold level bit-masks per line number.\nFold level masks comprise of an integer level combined with any of the\nfollowing bit flags:\n\n* `buffer.FOLDLEVELBASE`\n The initial fold level.\n* `buffer.FOLDLEVELWHITEFLAG`\n The line is blank.\n* `buffer.FOLDLEVELHEADERFLAG`\n The line is a header, or fold point.
fold_level lexer.fold_level (table, Read-only)\nTable of fold level bit-masks for line numbers starting from 1.\nFold level masks are composed of an integer level combined with any of the\nfollowing bits:\n\n* `lexer.FOLD_BASE`\n The initial fold level.\n* `lexer.FOLD_BLANK`\n The line is blank.\n* `lexer.FOLD_HEADER`\n The line is a header, or fold point.
fold_line view.fold_line(view, line, action)\nContracts, expands, or toggles the fold point on line number *line*,\ndepending on *action*.\n@param view A view.\n@param line The line number in *view* to set the fold state for.\n@param action The fold action to perform. Valid values are:\n * `view.FOLDACTION_CONTRACT`\n * `view.FOLDACTION_EXPAND`\n * `view.FOLDACTION_TOGGLE`
-fold_line_comments lexer.fold_line_comments (boolean)\nWhether or not to fold multiple, consecutive line comments and only show\nthe top-level comment.\nThis option is disabled by default.\nThis is an alias for `lexer.property['fold.line.comments'] = '1|0'`.
-fold_line_comments lexer.fold_line_comments(prefix)\nReturns a fold function (to be passed to `lexer.add_fold_point()`) that folds\nconsecutive line comments that start with string *prefix*.\n@param prefix The prefix string defining a line comment.\n@usage lex:add_fold_point(lexer.COMMENT, '--',\n lexer.fold_line_comments('--'))\n@usage lex:add_fold_point(lexer.COMMENT, '//',\n lexer.fold_line_comments('//'))
+fold_line_groups lexer.fold_line_groups (boolean)\nWhether or not to fold multiple, consecutive line groups (such as line\ncomments and import statements) and only show the top line.\nThis option is disabled by default.\nThis is an alias for `lexer.property['fold.line.groups'] = '1|0'`.
fold_on_zero_sum_lines lexer.fold_on_zero_sum_lines (boolean)\nWhether or not to mark as a fold point lines that contain both an ending\nand starting fold point. For example, `} else {` would be marked as a fold\npoint.\nThis option is disabled by default.\nThis is an alias for `lexer.property['fold.on.zero.sum.lines'] = '1|0'`.
fold_parent buffer.fold_parent (table, Read-only)\nTable of fold point line numbers per child line number.\nA line number of `-1` means no line was found.
folding lexer.folding (boolean)\nWhether or not folding is enabled.\nThis option is disabled by default.\nThis is an alias for `lexer.property['fold'] = '1|0'`.
@@ -647,7 +647,7 @@ hover lsp.hover(position)\nShows a calltip with information about the identifier
html _G.keys.html (table)\nContainer for HTML-specific key bindings.
html _G.snippets.html (table)\nContainer for HTML-specific snippets.
html _M.html (module)\nThe html module.\nIt provides utilities for editing HTML code.
-iconv string.iconv(text, new, old)\nConverts string *text* from encoding *old* to encoding *new* using iconv,\nreturning the string result.\nValid encodings are GNU iconv's encodings and include:\n\n * European: ASCII, ISO-8859-{1,2,3,4,5,7,9,10,13,14,15,16}, KOI8-R, KOI8-U,\n KOI8-RU, CP{1250,1251,1252,1253,1254,1257}, CP{850,866,1131},\n Mac{Roman,CentralEurope,Iceland,Croatian,Romania},\n Mac{Cyrillic,Ukraine,Greek,Turkish}, Macintosh.\n * Semitic: ISO-8859-{6,8}, CP{1255,1256}, CP862, Mac{Hebrew,Arabic}.\n * Japanese: EUC-JP, SHIFT_JIS, CP932, ISO-2022-JP, ISO-2022-JP-2,\n ISO-2022-JP-1.\n * Chinese: EUC-CN, HZ, GBK, CP936, GB18030, EUC-TW, BIG5, CP950,\n BIG5-HKSCS, BIG5-HKSCS:2004, BIG5-HKSCS:2001, BIG5-HKSCS:1999,\n ISO-2022-CN, ISO-2022-CN-EXT.\n * Korean: EUC-KR, CP949, ISO-2022-KR, JOHAB.\n * Armenian: ARMSCII-8.\n * Georgian: Georgian-Academy, Georgian-PS.\n * Tajik: KOI8-T.\n * Kazakh: PT154, RK1048.\n * Thai: ISO-8859-11, TIS-620, CP874, MacThai.\n * Laotian: MuleLao-1, CP1133.\n * Vietnamese: VISCII, TCVN, CP1258.\n * Unicode: UTF-8, UCS-2, UCS-2BE, UCS-2LE, UCS-4, UCS-4BE, UCS-4LE, UTF-16,\n UTF-16BE, UTF-16LE, UTF-32, UTF-32BE, UTF-32LE, UTF-7, C99, JAVA.\n@param text The text to convert.\n@param new The string encoding to convert to.\n@param old The string encoding to convert from.
+iconv string.iconv(text, new, old)\nConverts string *text* from encoding *old* to encoding *new* using GNU\nlibiconv, returning the string result.\nValid encodings are GNU libiconv's encodings and include:\n\n * European: ASCII, ISO-8859-{1,2,3,4,5,7,9,10,13,14,15,16}, KOI8-R, KOI8-U,\n KOI8-RU, CP{1250,1251,1252,1253,1254,1257}, CP{850,866,1131},\n Mac{Roman,CentralEurope,Iceland,Croatian,Romania},\n Mac{Cyrillic,Ukraine,Greek,Turkish}, Macintosh.\n * Semitic: ISO-8859-{6,8}, CP{1255,1256}, CP862, Mac{Hebrew,Arabic}.\n * Japanese: EUC-JP, SHIFT_JIS, CP932, ISO-2022-JP, ISO-2022-JP-2,\n ISO-2022-JP-1.\n * Chinese: EUC-CN, HZ, GBK, CP936, GB18030, EUC-TW, BIG5, CP950,\n BIG5-HKSCS, BIG5-HKSCS:2004, BIG5-HKSCS:2001, BIG5-HKSCS:1999,\n ISO-2022-CN, ISO-2022-CN-EXT.\n * Korean: EUC-KR, CP949, ISO-2022-KR, JOHAB.\n * Armenian: ARMSCII-8.\n * Georgian: Georgian-Academy, Georgian-PS.\n * Tajik: KOI8-T.\n * Kazakh: PT154, RK1048.\n * Thai: ISO-8859-11, TIS-620, CP874, MacThai.\n * Laotian: MuleLao-1, CP1133.\n * Vietnamese: VISCII, TCVN, CP1258.\n * Unicode: UTF-8, UCS-2, UCS-2BE, UCS-2LE, UCS-4, UCS-4BE, UCS-4LE, UTF-16,\n UTF-16BE, UTF-16LE, UTF-32, UTF-32BE, UTF-32LE, UTF-7, C99, JAVA.\n@param text The text to convert.\n@param new The string encoding to convert to.\n@param old The string encoding to convert from.
idle_styling view.idle_styling (number)\nThe idle styling mode.\nThis mode has no effect when `view.wrap_mode` is on.\n\n* `view.IDLESTYLING_NONE`\n Style all the currently visible text before displaying it.\n* `view.IDLESTYLING_TOVISIBLE`\n Style some text before displaying it and then style the rest\n incrementally in the background as an idle-time task.\n* `view.IDLESTYLING_AFTERVISIBLE`\n Style text after the currently visible portion in the background.\n* `view.IDLESTYLING_ALL`\n Style text both before and after the visible text in the background.\n\nThe default value is `view.IDLESTYLING_NONE`.
in_files ui.find.in_files (bool)\nFind search text in a directory of files.\nThe default value is `false`.
in_files_label_text ui.find.in_files_label_text (string, Write-only)\nThe text of the "In files" label.\nThis is primarily used for localization.
@@ -766,12 +766,12 @@ marker_delete_all buffer.marker_delete_all(buffer, marker)\nDeletes marker numbe
marker_delete_handle buffer.marker_delete_handle(buffer, handle)\nDeletes the marker with handle *handle* returned by `buffer.marker_add()`.\n@param buffer A buffer.\n@param handle The identifier of a marker returned by `buffer.marker_add()`.
marker_enable_highlight view.marker_enable_highlight(view, enabled)\nHighlights the margin fold markers for the current fold block if *enabled* is\n`true`.\n@param view A view.\n@param enabled Whether or not to enable highlight.
marker_fore view.marker_fore (table, Write-only)\nTable of foreground colors, in "0xBBGGRR" format, of marker numbers from\n`1` to `32`.
-marker_get buffer.marker_get(buffer, line)\nReturns a bit-mask that represents the markers that were added to line number\n*line*.\nThe first bit is set if marker number 1 is present, the second bit for marker\nnumber 2, and so on.\n@param buffer A buffer.\n@param line The line number to get markers on.\n@return number
+marker_get buffer.marker_get(buffer, line)\nReturns a bit-mask that represents the markers on line number *line*.\nThe first bit is set if marker number 1 is present, the second bit for marker\nnumber 2, and so on.\n@param buffer A buffer.\n@param line The line number to get markers on.\n@return number
marker_handle_from_line buffer.marker_handle_from_line(buffer, line, n)\nReturns the handle of the *n*th marker on line number *line*, or `-1` if no\nsuch marker exists.\n@param buffer A buffer.\n@param line The line number to get markers on.\n@param n The marker to get the handle of.
-marker_line_from_handle buffer.marker_line_from_handle(buffer, handle)\nReturns the line number that marker handle *handle*, returned by\n`buffer.marker_add()`, was added to, or `-1` if the line was not found.\n@param buffer A buffer.\n@param handle The identifier of a marker returned by `buffer.marker_add()`.\n@return number
-marker_next buffer.marker_next(buffer, line, marker_mask)\nReturns the first line number, starting at line number *line*, that has had\nall of the markers represented by marker bit-mask *marker_mask* added to it.\nReturns `-1` if no line was found.\nThe first bit is set if marker 1 is set, the second bit for marker 2, etc.,\nup to marker 32.\n@param buffer A buffer.\n@param line The start line to search from.\n@param marker_mask The mask of markers to find. Set the first bit to find\n marker 1, the second bit for marker 2, and so on.\n@return number
+marker_line_from_handle buffer.marker_line_from_handle(buffer, handle)\nReturns the line number of the line that contains the marker with handle\n*handle* (returned `buffer.marker_add()`), or `-1` if the line was not found.\n@param buffer A buffer.\n@param handle The identifier of a marker returned by `buffer.marker_add()`.\n@return number
+marker_next buffer.marker_next(buffer, line, marker_mask)\nReturns the first line number, starting at line number *line*, that contains\nall of the markers represented by marker bit-mask *marker_mask*.\nReturns `-1` if no line was found.\nThe first bit is set if marker 1 is set, the second bit for marker 2, etc.,\nup to marker 32.\n@param buffer A buffer.\n@param line The start line to search from.\n@param marker_mask The mask of markers to find. Set the first bit to find\n marker 1, the second bit for marker 2, and so on.\n@return number
marker_number_from_line buffer.marker_number_from_line(buffer, line, n)\nReturns the number of the *n*th marker on line number *line*, or `-1` if no\nsuch marker exists.\n@param buffer A buffer.\n@param line The line number to get markers on.\n@param n The marker to get the number of.
-marker_previous buffer.marker_previous(buffer, line, marker_mask)\nReturns the last line number, before or on line number *line*, that has had\nall of the markers represented by marker bit-mask *marker_mask* added to it.\nReturns `-1` if no line was found.\nThe first bit is set if marker 1 is set, the second bit for marker 2, etc.,\nup to marker 32.\n@param buffer A buffer.\n@param line The start line to search from.\n@param marker_mask The mask of markers to find. Set the first bit to find\n marker 1, the second bit for marker 2, and so on.\n@return number
+marker_previous buffer.marker_previous(buffer, line, marker_mask)\nReturns the last line number, before or on line number *line*, that contains\nall of the markers represented by marker bit-mask *marker_mask*.\nReturns `-1` if no line was found.\nThe first bit is set if marker 1 is set, the second bit for marker 2, etc.,\nup to marker 32.\n@param buffer A buffer.\n@param line The start line to search from.\n@param marker_mask The mask of markers to find. Set the first bit to find\n marker 1, the second bit for marker 2, and so on.\n@return number
marker_symbol_defined view.marker_symbol_defined(view, marker)\nReturns the symbol assigned to marker number *marker*, in the range of `1` to\n`32`, used in `view.marker_define()`,\n`view.marker_define_pixmap()`, or `view.marker_define_rgba_image()`.\n@param view A view.\n@param marker The marker number in the range of `1` to `32` to get the symbol\n of.\n@return number
match_case ui.find.match_case (bool)\nMatch search text case sensitively.\nThe default value is `false`.
match_case_label_text ui.find.match_case_label_text (string, Write-only)\nThe text of the "Match case" label.\nThis is primarily used for localization.
@@ -801,7 +801,7 @@ multiple_select_add_next buffer.multiple_select_add_next(buffer)\nAdds to the se
multiple_selection buffer.multiple_selection (bool)\nEnable multiple selection.\nThe default value is `false`.
name_of_style buffer.name_of_style(buffer, style)\nReturns the name of style number *style*, which is between `1` and `256`.\n@param buffer A buffer.\n@param style The style number between `1` and `256` to get the name of.\n@return string
new Server.new(lexer, cmd, init_options)\nStarts, initializes, and returns a new language server.\n@param lexer Lexer language of the language server.\n@param cmd String command to start the language server.\n@param init_options Optional table of options to be passed to the language\n server for initialization.
-new buffer.new()\nCreates and returns a new buffer.\nEmits a `BUFFER_NEW` event.\n@return the new buffer.\n@see events.BUFFER_NEW
+new buffer.new()\nCreates a new buffer, displays it in the current view, and returns it.\nEmits a `BUFFER_NEW` event.\n@return the new buffer.\n@see events.BUFFER_NEW
new lexer.new(name, opts)\nCreates a returns a new lexer with the given name.\n@param name The lexer's name.\n@param opts Table of lexer options. Options currently supported:\n * `lex_by_line`: Whether or not the lexer only processes whole lines of\n text (instead of arbitrary chunks of text) at a time.\n Line lexers cannot look ahead to subsequent lines.\n The default value is `false`.\n * `fold_by_indentation`: Whether or not the lexer does not define any fold\n points and that fold points should be calculated based on changes in line\n indentation.\n The default value is `false`.\n * `case_insensitive_fold_points`: Whether or not fold points added via\n `lexer.add_fold_point()` ignore case.\n The default value is `false`.\n * `inherit`: Lexer to inherit from.\n The default value is `nil`.\n@usage lexer.new('rhtml', {inherit = lexer.load('html')})
new_line buffer.new_line(buffer)\nTypes a new line at the caret position according to `buffer.eol_mode`.\n@param buffer A buffer.
newline lexer.newline (pattern)\nA pattern that matches a sequence of end of line characters.
diff --git a/modules/lua/ta_tags b/modules/lua/ta_tags
index 79f211be..430217d4 100644
--- a/modules/lua/ta_tags
+++ b/modules/lua/ta_tags
@@ -592,14 +592,14 @@ fold_all _HOME/core/.view.luadoc /^function fold_all(view, action) end$/;" f cla
fold_by_indentation _HOME/lexers/lexer.lua /^module('lexer')]=]$/;" F class:lexer
fold_children _HOME/core/.view.luadoc /^function fold_children(view, line, action) end$/;" f class:view
fold_compact _HOME/lexers/lexer.lua /^module('lexer')]=]$/;" F class:lexer
+fold_consecutive_lines _HOME/lexers/lexer.lua /^function M.fold_consecutive_lines(prefix)$/;" f class:lexer
fold_display_text_style _HOME/core/.view.luadoc /^module('view')$/;" F class:view
fold_expanded _HOME/core/.view.luadoc /^module('view')$/;" F class:view
fold_flags _HOME/core/.view.luadoc /^module('view')$/;" F class:view
fold_level _HOME/core/.buffer.luadoc /^module('buffer')$/;" F class:buffer
fold_level _HOME/lexers/lexer.lua /^module('lexer')]=]$/;" F class:lexer
fold_line _HOME/core/.view.luadoc /^function fold_line(view, line, action) end$/;" f class:view
-fold_line_comments _HOME/lexers/lexer.lua /^function M.fold_line_comments(prefix)$/;" f class:lexer
-fold_line_comments _HOME/lexers/lexer.lua /^module('lexer')]=]$/;" F class:lexer
+fold_line_groups _HOME/lexers/lexer.lua /^module('lexer')]=]$/;" F class:lexer
fold_on_zero_sum_lines _HOME/lexers/lexer.lua /^module('lexer')]=]$/;" F class:lexer
fold_parent _HOME/core/.buffer.luadoc /^module('buffer')$/;" F class:buffer
folding _HOME/lexers/lexer.lua /^module('lexer')]=]$/;" F class:lexer
diff --git a/src/Makefile b/src/Makefile
index 6b4f5cce..4b1aaf63 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -376,7 +376,7 @@ else
gtdialog_url = http://foicica.com/hg/gtdialog/archive/tip.zip
endif
-scintilla_zip = d1b254905c74.zip
+scintilla_zip = 9e79ba3e1394.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/test/test.lua b/test/test.lua
index 68125dd7..2519414f 100644
--- a/test/test.lua
+++ b/test/test.lua
@@ -3271,6 +3271,38 @@ function test_lexer_fold_properties()
assert_equal(view.property['fold'], '0')
end
+function test_lexer_fold_line_groups()
+ local fold_line_groups = lexer.fold_line_groups
+ buffer.new()
+ buffer:add_text[[
+ package foo;
+
+ import bar;
+ import baz;
+ import quux;
+ // comment
+ // comment
+ // comment
+
+ public class Foo {}
+ ]]
+ buffer:set_lexer('java')
+ lexer.fold_line_groups = false
+ buffer:colorize(1, -1)
+ assert(buffer.fold_level[3] & lexer.FOLD_HEADER == 0, 'import is a fold point')
+ assert(buffer.fold_level[6] & lexer.FOLD_HEADER == 0, 'line comment is a fold point')
+ lexer.fold_line_groups = true
+ buffer:colorize(1, -1)
+ assert(buffer.fold_level[3] & lexer.FOLD_HEADER > 0, 'import is not a fold point')
+ assert(buffer.fold_level[6] & lexer.FOLD_HEADER > 0, 'line comment is not a fold point')
+ view:toggle_fold(3)
+ for i = 4, 5 do assert(not view.line_visible[i], 'line %i is visible', i) end
+ view:toggle_fold(6)
+ for i = 7, 8 do assert(not view.line_visible[i], 'line %i is visible', i) end
+ buffer:close(true)
+ lexer.fold_line_groups = fold_line_groups -- restore
+end
+
-- TODO: test init.lua's buffer settings
function test_ctags()