diff options
Diffstat (limited to 'modules/textadept')
-rw-r--r-- | modules/textadept/bookmarks.lua | 2 | ||||
-rw-r--r-- | modules/textadept/editing.lua | 33 | ||||
-rw-r--r-- | modules/textadept/find.lua | 5 | ||||
-rw-r--r-- | modules/textadept/run.lua | 6 | ||||
-rw-r--r-- | modules/textadept/session.lua | 2 | ||||
-rw-r--r-- | modules/textadept/snapopen.lua | 2 | ||||
-rw-r--r-- | modules/textadept/snippets.lua | 5 |
7 files changed, 14 insertions, 41 deletions
diff --git a/modules/textadept/bookmarks.lua b/modules/textadept/bookmarks.lua index 38a031e0..74a2ad7d 100644 --- a/modules/textadept/bookmarks.lua +++ b/modules/textadept/bookmarks.lua @@ -15,9 +15,7 @@ module('_m.textadept.bookmarks')]] -- * `MARK_BOOKMARK_COLOR` [number]: The color used for a bookmarked line in -- `0xBBGGRR` format. --- settings M.MARK_BOOKMARK_COLOR = 0xB3661A --- end settings local MARK_BOOKMARK = _SCINTILLA.next_marker_number() diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua index 6c9c0bfa..c39d699a 100644 --- a/modules/textadept/editing.lua +++ b/modules/textadept/editing.lua @@ -30,7 +30,6 @@ module('_m.textadept.editing')]] -- (transparent) and `255` (opaque) used for an indicator for a highlighted -- word. The default value is `100`. --- settings M.AUTOPAIR = true M.HIGHLIGHT_BRACES = true M.AUTOINDENT = true @@ -38,7 +37,6 @@ M.STRIP_WHITESPACE_ON_SAVE = true M.MARK_HIGHLIGHT_BACK = buffer and buffer.caret_line_back or 0xEEEEEE M.INDIC_HIGHLIGHT_BACK = 0x4D99E6 M.INDIC_HIGHLIGHT_ALPHA = 100 --- end settings --- -- Comment strings for various lexer languages. @@ -54,26 +52,22 @@ M.comment_string = {} -- Auto-matched characters. -- Used for auto-matching parentheses, brackets, braces, quotes, etc. Keys are -- lexer language names and values are tables of character match pairs. This --- table can be populated by language-specific modules. +-- table can be populated by language-specific modules. The defaults are '()', +-- '[]', '{}', '''', and '""'. -- @class table -- @name char_matches -- @usage _m.textadept.editing.char_matches.hypertext = { ..., [60] = '>' } -M.char_matches = { - [40] = ')', [91] = ']', [123] = '}', [39] = "'", [34] = '"' -} +M.char_matches = { [40] = ')', [91] = ']', [123] = '}', [39] = "'", [34] = '"' } --- -- Highlighted brace characters. -- Keys are lexer language names and values are tables of characters that count -- as brace characters. This table can be populated by language-specific --- modules. +-- modules. The defaults are '(', ')', '[', ']', '{', and '}'. -- @class table -- @name braces -- @usage _m.textadept.editing.braces.hypertext = { ..., [60] = 1, [62] = 1 } -M.braces = { -- () [] {} - [40] = 1, [91] = 1, [123] = 1, - [41] = 1, [93] = 1, [125] = 1, -} +M.braces = { [40] = 1, [41] = 1, [91] = 1, [93] = 1, [123] = 1, [125] = 1 } -- The current call tip. -- Used for displaying call tips. @@ -284,12 +278,8 @@ function M.prepare_for_save() local lines = buffer.line_count for line = 0, lines - 1 do local s, e = buffer:position_from_line(line), line_end_position[line] - local i = e - 1 - local c = char_at[i] - while i >= s and c == 9 or c == 32 do - i = i - 1 - c = char_at[i] - end + local i, c = e - 1, char_at[e - 1] + while i >= s and c == 9 or c == 32 do i, c = i - 1, char_at[i - 1] end if i < e - 1 then buffer.target_start, buffer.target_end = i + 1, e buffer:replace_target('') @@ -297,8 +287,7 @@ function M.prepare_for_save() end -- Ensure ending newline. local e = buffer:position_from_line(lines) - if lines == 1 or - lines > 1 and e > buffer:position_from_line(lines - 1) then + if lines == 1 or lines > 1 and e > buffer:position_from_line(lines - 1) then buffer:insert_text(e, '\n') end -- Convert non-consistent EOLs @@ -493,15 +482,13 @@ function M.highlight_word() if word == '' then return end buffer.search_flags = _SCINTILLA.constants.SCFIND_WHOLEWORD + _SCINTILLA.constants.SCFIND_MATCHCASE - buffer.target_start = 0 - buffer.target_end = buffer.length + buffer.target_start, buffer.target_end = 0, buffer.length while buffer:search_in_target(word) > 0 do local len = buffer.target_end - buffer.target_start buffer:marker_add(buffer:line_from_position(buffer.target_start), MARK_HIGHLIGHT) buffer:indicator_fill_range(buffer.target_start, len) - buffer.target_start = buffer.target_end - buffer.target_end = buffer.length + buffer.target_start, buffer.target_end = buffer.target_end, buffer.length end buffer:set_sel(s, e) end diff --git a/modules/textadept/find.lua b/modules/textadept/find.lua index b82d882a..dddc1800 100644 --- a/modules/textadept/find.lua +++ b/modules/textadept/find.lua @@ -159,7 +159,6 @@ local function find_(text, next, flags, nowrap, wrapped) buffer:search_anchor() result = buffer['search_'..(next and 'next' or 'prev')](buffer, flags, text) if result ~= -1 then buffer:scroll_caret() end - elseif flags < 16 then -- lua pattern search (forward search only) text = text:gsub('\\[abfnrtv\\]', escapes) local buffer_text = buffer:get_text(buffer.length) @@ -171,7 +170,6 @@ local function find_(text, next, flags, nowrap, wrapped) else result = -1 end - else -- find in files find.find_in_files() return @@ -212,8 +210,7 @@ end -- (pressing 'Escape' by default). -- @name find_incremental function find.find_incremental() - find.incremental = true - find.incremental_start = buffer.current_pos + find.incremental, find.incremental_start = true, buffer.current_pos gui.command_entry.entry_text = '' gui.command_entry.focus() end diff --git a/modules/textadept/run.lua b/modules/textadept/run.lua index 0947258b..88967d1c 100644 --- a/modules/textadept/run.lua +++ b/modules/textadept/run.lua @@ -52,10 +52,8 @@ function M.execute(command) end local filename_noext = filename:match('^(.+)%.') command = command:gsub('%%%b()', { - ['%(filepath)'] = filepath, - ['%(filedir)'] = filedir, - ['%(filename)'] = filename, - ['%(filename_noext)'] = filename_noext, + ['%(filepath)'] = filepath, ['%(filedir)'] = filedir, + ['%(filename)'] = filename, ['%(filename_noext)'] = filename_noext, }) local current_dir = lfs.currentdir() lfs.chdir(filedir) diff --git a/modules/textadept/session.lua b/modules/textadept/session.lua index ce92febd..217f8101 100644 --- a/modules/textadept/session.lua +++ b/modules/textadept/session.lua @@ -19,11 +19,9 @@ module('_m.textadept.session')]] -- * `MAX_RECENT_FILES` [number]: The maximum number of files from the recent -- files list to save to the session. The default is `10`. --- settings M.DEFAULT_SESSION = _USERHOME..'/session' M.SAVE_ON_QUIT = true M.MAX_RECENT_FILES = 10 --- end settings --- -- Loads a Textadept session file. diff --git a/modules/textadept/snapopen.lua b/modules/textadept/snapopen.lua index cb233a82..bcf7e482 100644 --- a/modules/textadept/snapopen.lua +++ b/modules/textadept/snapopen.lua @@ -35,11 +35,9 @@ module('_m.textadept.snapopen')]] -- local project_dir = '/path/to/project' -- snapopen(project_dir, { folders = { '%.hg' } }, true) --- settings M.PATHS = {} M.DEFAULT_DEPTH = 4 M.MAX = 1000 --- end settings local lfs_dir, lfs_attributes = lfs.dir, lfs.attributes local DEPTH = M.DEFAULT_DEPTH diff --git a/modules/textadept/snippets.lua b/modules/textadept/snippets.lua index fc26427b..189c5e92 100644 --- a/modules/textadept/snippets.lua +++ b/modules/textadept/snippets.lua @@ -223,10 +223,7 @@ function M._select() local list = {} local type = type for trigger, text in pairs(snippets) do - if type(text) == 'string' and - trigger ~= '_NAME' and trigger ~= '_PACKAGE' then - list[#list + 1] = trigger..'\0global\0'..text - end + if type(text) == 'string' then list[#list + 1] = trigger..'\0 \0'..text end end local lexer = buffer:get_lexer() for trigger, text in pairs(snippets[lexer] or {}) do |