Code folding and text selections
Posted: Sun Dec 22, 2013 12:07 am
I'm not sure if this should be here or under the bugs topic. Feel free to relocate this if I chose wrong...
I found a problem with my SlideIn/Out scripts that also appears to affect Add/Remove Comments. comment_range() appears to work on display line, not file line:
For example, if I have
and fold SomeFunction() so AnotherFunction begins on display line 6 like so:
then select the text of the entire AnotherFunction() and execute Macros->Add/Remove Comments, the resulting text is:
I initially thought this was going to be related to get_marked_top() and get_marked_bottom(), but I when I put together the simplest test I could think of:
It correctly displays the selected line numbers regardless of fold state. If I include the folded text in the selection (i.e. same fold as above, but attempt to comment out both methods), commenting works correctly.
I've run out of time to look at this today, but thought I'd post here in case you have an immediate idea where the problem is.
Thanks!
I found a problem with my SlideIn/Out scripts that also appears to affect Add/Remove Comments. comment_range() appears to work on display line, not file line:
For example, if I have
Code: Select all
public class Bob
{
bool SomeFunction()
{
return(true);
}
bool AnotherFunction()
{
return(true);
}
}
Code: Select all
public class Bob
{
bool SomeFunction()
{ ... }
bool AnotherFunction()
{
return(true);
}
}
Code: Select all
public class Bob
{
bool SomeFunction()
{
return(true);
// }
//
// bool AnotherFunction()
// {
return(true);
}
}
Code: Select all
function key_macro()
message
(
string.format
(
"Selected range [%d:%d]. Current line: %d",
get_marked_top(),
get_marked_bottom(),
get_line_pos()
)
);
end
key_macro() -- run the macro
I've run out of time to look at this today, but thought I'd post here in case you have an immediate idea where the problem is.
Thanks!