SlickEdit Community
SlickEdit Product Discussion => SlickEditĀ® => Slick-CĀ® Macro Programming => Topic started by: jcelle on June 28, 2020, 10:21:36 AM
-
Hello slick-c gurus !
Does anyone knows what function I could use to toggle display of some bookmark icon on the left margin ?
Thanks in advance.
-
Do you want to toggle the bookmark itself or just the display of the bookmark? In tools -> options ->editing -> bookmarks - the "show set bookmarks" option allows you to hide or show bookmarks. If you want to toggle the bookmark itself - maybe toggle-bookmark() - applies to the bookmark on the current line.
-
Hi Grame and thanks for your reply.
I want only the GUI part: I have written my own slick-c bookmark functions to limit the bookmark navigation to the current buffer: each buffer has its set of bookmarks and I want to jump within the buffer only (hence the other question you replied to about testing a hashtable key).
It works pretty fine though I do not have the GUI part.
Not sure if I want to mix with real SlickEdit bookmarks using toggle_bookmark() as I still need those when using tag navigation.
-
Ah, in that case you can use line markers
see _LineMarkerAdd etc. in the help and MarkerFunctions category.
They attach to a line so that if lines are inserted or deleted they stay on the correct line.
If you want an example, I used them in my xretrace macros here - see xretrace.e
https://community.slickedit.com/index.php/topic,16598.msg64005.html#msg64005 (https://community.slickedit.com/index.php/topic,16598.msg64005.html#msg64005)
retrace_line_marker_pic_index_cur = _find_or_add_picture(XRETRACE_PATH :+ '_xretrcur.png@native');
_LineMarkerAdd(retrace_region_line_marker_window_id, retrace_current_line, 1, 1,
retrace_line_marker_pic_index_cur_now, retrace_marker_type_id, "xretrace" );
retrace_marker_type_id = _MarkerTypeAlloc();
_MarkerTypeSetPriority(retrace_marker_type_id, 241);
-
Hi Graeme, you made a happy man !
Thanks
-
Hi again,
What you mentioned about this marker being attached to the line despite inserts or deletions is interesting: is there a way to retrieve the 'new' line number so that I can jump back to the line properly ?
Currently I am using goto_line which indeed can bring me to another line than the original one I memorized. (I wish I had a goto_marker)
All the best.
-
Yes, in xretrace I do it like this
static void update_retrace_line_numbers(dlist & alist)
{
xretrace_item * ip;
VSLINEMARKERINFO info1;
dlist_iterator iter = dlist_begin(alist);
for( ; dlist_iter_valid(iter); dlist_next(iter)) {
ip = dlist_getp(iter);
if (ip->marker_id_valid && (_LineMarkerGet(ip->line_marker_id, info1) == 0)) {
ip->last_line = info1.LineNum;
}
}
}
-
Very nice !
I had tried to find such a _LineMarkeGet function in the documentation but it is apparently missing!
I have downloaded xretrace files and couldn't dive into so far, but will do when I am in holidays soon.
Thanks for your quick update Graeme.