Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macro sub focus_window(next) does nothing #347

Open
ahoffm11 opened this issue May 8, 2023 · 2 comments
Open

macro sub focus_window(next) does nothing #347

ahoffm11 opened this issue May 8, 2023 · 2 comments

Comments

@ahoffm11
Copy link

ahoffm11 commented May 8, 2023

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
Copy link
Author

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.

@eteran
Copy link
Owner

eteran commented May 13, 2023

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants