nedit-ng icon indicating copy to clipboard operation
nedit-ng copied to clipboard

macro sub focus_window(next) does nothing

Open ahoffm11 opened this issue 2 years ago • 2 comments

I have a session saving macro going over all open tabs like this:

  for (w = focus_window("last"); w != ""; w = focus_window("next")) {
     if ( $file_name != "Untitled" ) {
    	append_file($file_path"// "$file_name"/"$cursor"/"$language_mode"/"$n_display_lines"/"$top_line "/\n", name)
    }
    }
}

focus_window("next") does not seem to advance to next tab, no matter how many tabs are open only the last one is reported

nedit-ng version 2020.1-257-gac8ddba5-dirty Qt: 5.12.8

ahoffm11 avatar May 08 '23 09:05 ahoffm11

The original nedit focus_window("next") rotated tabs backwards, this port does it other way around which is imho right but there is no focus_window("first") which could also be much better if you want to iterate over all open tabs . And also since one can now move tabs and also original nedit allowed detaching and reattaching tabs which also changed tab order so iterating from the last opened file was not always correct.

ahoffm11 avatar May 10 '23 14:05 ahoffm11

Hey there!

So I'm currently overseas, so I won't be able to respond much for a bit. But yes, NG does iterate forwards instead of backwards.

The reasons are actually pretty subtle and making it iterate backwards is surprisingly MUCH more complicated in the new code.

That being said, you've outlined a circumstance where it actually changes behavior in a notable way, so I'll have to think about what the ideal solution is.

Thanks for the report!

eteran avatar May 13 '23 00:05 eteran