October 1, 2013 at 3:52 am #16951
Stefan
Participant
>>> In the drop-down menu, how can I see line contents instead of line numbers?
To see line numbers and line contents, change this on the code:
FROM:
s = “Line ” + n;
TO:
L = document.GetLine(n); //line content
L = L.substring(0,80); //shorten content
s = “Line ” + n + “: ” + L;
.
.
Here is a slightly altered code from me:
CurrentLine = document.selection.GetActivePointY( eePosLogical );
menu = CreatePopupMenu();
count = 0;
document.selection.SetActivePoint( eePosLogical, 1, 2 );
if (document.selection.PreviousBookmark()){ AddToList(); }
while( document.selection.NextBookmark() ){ AddToList(); count++; if (count > 20) break;}
function AddToList(){
n = document.selection.GetActivePointY( eePosLogical );
L = document.GetLine(n); //line content
L = L.substring(0,80); //shorten content
s = "Line " + n + ": " + L;
menu.Add( s, n );
}
//back to that line where this script was executed:
document.selection.SetActivePoint( eePosLogical, 1, CurrentLine );
//show bookmarks list:
result = menu.Track( 0 );
if( result > 0 ) {
document.selection.SetActivePoint( eePosLogical, 1, result );
}