aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2011-06-16 17:23:55 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2011-06-16 17:23:55 -0400
commit3d56741b1ef1ea2790607a5575f771d43aae4308 (patch)
treeaf4da86dec710546924e7ea7b893591989e785d0 /modules/textadept
parent9a61370b7d739b51228395b304915b2c4cc2e077 (diff)
downloadtextadept-3d56741b1ef1ea2790607a5575f771d43aae4308.tar.gz
textadept-3d56741b1ef1ea2790607a5575f771d43aae4308.zip
Use functions for generating unique IDs for markers, indicators, and user lists.
Diffstat (limited to 'modules/textadept')
-rw-r--r--modules/textadept/bookmarks.lua5
-rw-r--r--modules/textadept/editing.lua8
-rw-r--r--modules/textadept/find.lua2
-rw-r--r--modules/textadept/keys.lua2
-rw-r--r--modules/textadept/snippets.lua11
5 files changed, 9 insertions, 19 deletions
diff --git a/modules/textadept/bookmarks.lua b/modules/textadept/bookmarks.lua
index 97121547..26cfb09a 100644
--- a/modules/textadept/bookmarks.lua
+++ b/modules/textadept/bookmarks.lua
@@ -9,18 +9,17 @@ module('_m.textadept.bookmarks', package.seeall)
-- Markdown:
-- ## Settings
--
--- * `MARK_BOOKMARK`: The unique integer mark used to identify a bookmarked
--- line.
-- * `MARK_BOOKMARK_COLOR`: The [Scintilla color][scintilla_color] used for a
-- bookmarked line.
--
-- [scintilla_color]: http://scintilla.org/ScintillaDoc.html#colour
-- settings
-MARK_BOOKMARK = 1
MARK_BOOKMARK_COLOR = 0xC08040
-- end settings
+local MARK_BOOKMARK = _SCINTILLA.next_marker_number()
+
---
-- Adds a bookmark to the current line.
function add()
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua
index 629ee017..64dbae76 100644
--- a/modules/textadept/editing.lua
+++ b/modules/textadept/editing.lua
@@ -22,11 +22,8 @@ module('_m.textadept.editing', package.seeall)
-- previous line.
-- * `SAVE_STRIPS_WS`: Flag indicating whether or not to strip trailing
-- whitespace on file save.
--- * `MARK_HIGHLIGHT`: The unique integer mark used to identify a line
--- containing a highlighted word.
-- * `MARK_HIGHLIGHT_BACK`: The [Scintilla color][scintilla_color] used for a
-- line containing a highlighted word.
--- * `INDIC_HIGHLIGHT`: The unique integer indicator for highlighted words.
-- * `INDIC_HIGHLIGHT_BACK`: The [Scintilla color][scintilla_color] used for an
-- indicator for a highlighted word.
-- * `INDIC_HIGHLIGHT_ALPHA`: The transparency used for an indicator for a
@@ -37,9 +34,7 @@ AUTOPAIR = true
HIGHLIGHT_BRACES = true
AUTOINDENT = true
SAVE_STRIPS_WS = true
-MARK_HIGHLIGHT = 2
MARK_HIGHLIGHT_BACK = buffer and buffer.caret_line_back or 0xEEEEEE
-INDIC_HIGHLIGHT = 8 -- INDIC_CONTAINER
INDIC_HIGHLIGHT_BACK = 0x4080C0
INDIC_HIGHLIGHT_ALPHA = 100
-- end settings
@@ -442,6 +437,9 @@ function convert_indentation()
buffer:end_undo_action()
end
+local MARK_HIGHLIGHT = _SCINTILLA.next_marker_number()
+local INDIC_HIGHLIGHT = _SCINTILLA.next_indic_number()
+
-- Clears highlighted word indicators and markers.
local function clear_highlighted_words()
local buffer = buffer
diff --git a/modules/textadept/find.lua b/modules/textadept/find.lua
index dcb570ba..f770e2dd 100644
--- a/modules/textadept/find.lua
+++ b/modules/textadept/find.lua
@@ -5,7 +5,7 @@ local events = _G.events
local find = gui.find
local c = _SCINTILLA.constants
-local MARK_FIND = 0
+local MARK_FIND = _SCINTILLA.next_marker_number()
local MARK_FIND_COLOR = 0x4D9999
local previous_view
diff --git a/modules/textadept/keys.lua b/modules/textadept/keys.lua
index bdefd37a..ddd237af 100644
--- a/modules/textadept/keys.lua
+++ b/modules/textadept/keys.lua
@@ -34,7 +34,7 @@ local function toggle_setting(setting, i)
end
events.emit('update_ui') -- for updating statusbar
end
-local RECENT_FILES = 1
+local RECENT_FILES = _SCINTILLA.next_user_list_type()
events.connect('user_list_selection',
function(type, text) if type == RECENT_FILES then io.open_file(text) end end)
local function show_recent_file_list()
diff --git a/modules/textadept/snippets.lua b/modules/textadept/snippets.lua
index 988424b6..0f4369b3 100644
--- a/modules/textadept/snippets.lua
+++ b/modules/textadept/snippets.lua
@@ -26,11 +26,6 @@ module('_m.textadept.snippets', package.seeall)
-- while `Shift+Tab` tabs backwards through them. Snippets can also be expanded
-- inside one another.
--
--- ## Settings
---
--- * `INDIC_SNIPPET`: The unique integer indicator used to mark the end of a
--- snippet.
---
-- ## Snippet Precedence
--
-- When searching for a snippet to expand in the `snippets` table, snippets in
@@ -122,10 +117,6 @@ module('_m.textadept.snippets', package.seeall)
-- It is recommended to use tab characters instead of spaces like in the last
-- example. Tabs will be converted to spaces as necessary.
--- settings
-INDIC_SNIPPET = 9
--- end settings
-
-- The stack of currently running snippets.
local snippet_stack = {}
@@ -135,6 +126,8 @@ local snippet_stack = {}
-- @name newlines
local newlines = { [0] = '\r\n', '\r', '\n' }
+local INDIC_SNIPPET = _SCINTILLA.next_indic_number()
+
-- Inserts a new snippet.
-- @param text The new snippet to insert.
-- @param trigger The trigger text used to expand the snippet, if any.