From ee416479a1b990a325d98f77b07b360c7b025c53 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Mon, 16 Jul 2012 15:13:46 -0400 Subject: Support bookmarks in ncurses; modules/textadept/bookmarks.lua --- modules/textadept/bookmarks.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'modules') diff --git a/modules/textadept/bookmarks.lua b/modules/textadept/bookmarks.lua index 4219da58..6284f25c 100644 --- a/modules/textadept/bookmarks.lua +++ b/modules/textadept/bookmarks.lua @@ -9,7 +9,7 @@ local M = {} -- The color used for a bookmarked line in `0xBBGGRR` format. module('_M.textadept.bookmarks')]] -M.MARK_BOOKMARK_COLOR = 0xB3661A +M.MARK_BOOKMARK_COLOR = not NCURSES and 0xB3661A or 0xFF0000 local MARK_BOOKMARK = _SCINTILLA.next_marker_number() @@ -89,8 +89,13 @@ function M.goto_bookmark() if line then _M.textadept.editing.goto_line(line:match('^%d+')) end end -if buffer then buffer:marker_set_back(MARK_BOOKMARK, M.MARK_BOOKMARK_COLOR) end +local NCURSES_MARK = _SCINTILLA.constants.SC_MARK_CHARACTER + string.byte(' ') +if buffer then + if NCURSES then buffer:marker_define(MARK_BOOKMARK, NCURSES_MARK) end + buffer:marker_set_back(MARK_BOOKMARK, M.MARK_BOOKMARK_COLOR) +end events.connect(events.VIEW_NEW, function() + if NCURSES then buffer:marker_define(MARK_BOOKMARK, NCURSES_MARK) end buffer:marker_set_back(MARK_BOOKMARK, M.MARK_BOOKMARK_COLOR) end) -- cgit v1.2.3