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

Limit open to one instance #49

Open
ghost opened this issue Apr 28, 2019 · 12 comments
Open

Limit open to one instance #49

ghost opened this issue Apr 28, 2019 · 12 comments

Comments

@ghost
Copy link

ghost commented Apr 28, 2019

Currently it's possible to "stack" open dialogs on top of each other. Would it be a good idea to only allow one open dialog at a time?
Do you happen to have a clever idea to implement this?

@rgieseke
Copy link
Owner

That would be a great addition!
One way could be to identify the shortcut for „Open file“ and disable/overwrite it in the Textredux dialog. It‘s already found in the hijack function. So maybe it only needs to be re-used.

@rgieseke
Copy link
Owner

Another way might be to check for a visible Textredux buffer in the current view and re-use this one if a new Textredux buffer is created. This would be a way to go from a "buffer list" to an "open dialog" as well without having to close one Textredux buffer first. (Use-case, realise file not already open, switch to "file open")

@ghost
Copy link
Author

ghost commented May 2, 2019

Your first suggestion seems to work well enough. There are still some rough edges but it certainly is the right direction.
The other use-case you mention is also interesting, might look into that in the future.

@ghost ghost closed this as completed May 2, 2019
@rgieseke
Copy link
Owner

rgieseke commented May 3, 2019

Did you just add it manually or did you find a generic way?

@ghost
Copy link
Author

ghost commented May 4, 2019

Did you just add it manually or did you find a generic way?

Generic but really ghetto. Don't care though since no one except me will use it anyways so it doesn't have to be some super slick solution.

@rgieseke
Copy link
Owner

rgieseke commented May 4, 2019

I'd care and be happy if you could share it! This would be definitely a good addition to Textredux.

@rgieseke rgieseke reopened this May 4, 2019
@ghost
Copy link
Author

ghost commented May 4, 2019

Be my guest. I'll make a feature branch for it soon™.
Just check https://github.com/loomer/textredux/branches in a bit.

@ghost
Copy link
Author

ghost commented May 12, 2019

As requested the branch exists. Since it's unlikely to get merged in it's current state I'd like to close this. That is unless you see the need for more discussion?

@rgieseke
Copy link
Owner

I'd like to keep it open because i think it would be a valuable addition - if we find a way that works even if someone doesn't use hijack.

Your version prevents certain keys, maybe the opposite is also possible - explicitly setting permissable keys. Or the other approach could work, re-using Textredux buffers in a view.

@ghost
Copy link
Author

ghost commented Jun 1, 2019

I think whitelisting keys would create a much longer list than a blacklist and is IMO not feasible.
The other approach seems more promising but I'm unsure how it could be done. Have you had a chance to think about it?

@rgieseke
Copy link
Owner

rgieseke commented Jun 6, 2019

Likely you're right, it could become quite a long list ... (buffer close, quite, switch view, navigate ... on all platforms) -- haven't had a chance to look into filtering on buffer creation ...

@rgieseke
Copy link
Owner

rgieseke commented Aug 2, 2020

5d0941e handles this for the open dialog. One can still open e.g. a buffer list. Still not sure how to handle this (there might be other Textredux buffers a user might want to open) but it seems like an improvement.

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

1 participant