Remove "no-save" and "current line" lineflags

Friday, February 27, 2009

The purpose of this macro is to remove certain 
lineflags placed in the text manually be the user.
These particular lineflags were explored in "Fun
with Lineflags." That post can be found elsewhere
in this blog.

The use of the "no-save"(NLF) and "current line"
(CLF) lineflags were bastardizations, in that the
flags were not meant to used in ways I showed.
One thing you can do with these lineflags is to
use them to tag special lines, much like using a
bookmark. It doesn't have any great uses.

When flagged with either of these lineflags, small
icons will be displayed in the left margin of the
selected lines. You can also use the lineflags to
show a background color of you choice for each
flagged line. This can help to distinguish the
specially lineflagged lines from other selective
display lines. You can create selective displays
using color backgrounds of your choice for the
selected lines to display all lines with those
particular bits.

I have some simple macros named "all_nl" and
"all_clf" and others created to be used for having
fun with lineflags. At the bottom of this post is
a tiny macro for toggling a lineflag on a line.
In this case it deals with "CLFs" only.

// turn NLF & CLF OFF for ALL lines

_command untag_all_nlfclf()
{
if (p_mode_name=='Fileman') {
deselect_all();
} else {
save_pos(p)
top();up();
_lineflags(0,CURLINEBITMAP_LF);
_lineflags(0,NOSAVE_LF);
for (;;) {
if (down()) break;
_lineflags(0,CURLINEBITMAP_LF);
_lineflags(0,NOSAVE_LF);
}
restore_pos(p);
}
}

------------------------

// toggle CLF for current line
_command clf_toggle()
{
if (!(_lineflags() & CURLINEBITMAP_LF)) {
_lineflags(CURLINEBITMAP_LF,CURLINEBITMAP_LF);
} else {
_lineflags(0,CURLINEBITMAP_LF);
}
down();
}



0 comments:

Post a Comment

GlossyBlue Blogger by Black Quanta. Theme & Icons by N.Design Studio
Entries RSS Comments RSS