I have loaded a macro for < copying selective display > The macro name is copy_shown(). I can run the command by binding to some key. But how do I run it without binding to a key? The macro I am trying to use is by Mathew - see < Slickedit forum thread >.
////////////////////////////////////////////////////////////////////////////////////////////
#include "slick.sh"
/*
Copy the lines currently shown in the current buffer to the clipboard. This
should ignore lines that are hidden because of selective display settings.
*/
_command void copy_shown()
{
int lines_copied = 0;
// Create a new buffer to hold the displayed lines.
int tempWID;
int prevWID = _create_temp_view(tempWID);
// Switch back to the previous buffer to find the lines to copy.
p_window_id = prevWID;
// Place cursor on line 0 before first line of the buffer.
top(); up();
// Iterate across the lines in the buffer, copying those that are not hidden.
for (j=1; j<=p_Noflines; j++) {
// Go down and get the next line.
if (down()) break;
get_line(line);
// If this line is not hidden, copy it to the new buffer.
if (!(_lineflags() & HIDDEN_LF)) {
// Copy the line.
lines_copied++;
tempWID.insert_line(line);
}
}
if (lines_copied == 0) {
message('No displayed lines found!');
}
else {
// Activate the temp view to copy the lines
p_window_id = tempWID;
select_all();
copy_to_clipboard();
// Switch back to original view
p_window_id = prevWID;
s = lines_copied==1 ? '' : 's';
message(lines_copied ' line's ' copied to this buffer.');
}
// Clean up the temp view
_delete_temp_view(tempWID);
}
////////////////////////////////////////////////////////////////////////////////////////////