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

Closing all files in editor shouldn't leave it empty #2302

Closed
Garrett-R opened this issue Apr 6, 2015 · 17 comments
Closed

Closing all files in editor shouldn't leave it empty #2302

Garrett-R opened this issue Apr 6, 2015 · 17 comments

Comments

@Garrett-R
Copy link

Open a file in the editor, then click the small Options icon in the top-right and click Split Horizontally. The file should appear on both sides. Now close the file and this will have the effect of closing the extra panel. That is, if you were to open a new file, you now only have 1 panel.

I think this is unexpected behavior and not in line with other programs such as my C++ IDE, Qt Creator.

I think both the panel layout and the small Options button should persist even when no files are open in the editor. As it is currently, if I'm closing files, because I'm about to work on a different project, I have to make sure to open the new project files before closing all the current ones.

(I'm on Ubuntu 14.04.2 and the latest version of Spyder, i.e. 91dac51)

@ccordoba12
Copy link
Member

This is not easy to fix. If there are no files open, I don't know how we could maintain the splitted view.

The only solution I can think of is to forbid closing the last opened file.

@Garrett-R
Copy link
Author

I see. I think preventing the last open file from closing would be bad...

@ccordoba12
Copy link
Member

That would work like in Firefox, i.e. just the last file couldn't be closed.

Another option would be to open a new file when closing the last one.

@Garrett-R
Copy link
Author

My opinion is that both options would be more surprising than the original behavior of closing the panels (which isn't that a huge problem). I've never seen any IDE that automatically open a new file when the last one got closed.

And Firefox (and Chromium) actually terminates when the last tab is closed, probably because it's a clear indication that the user has finished with the application, but in Spyder, I don't think that's the case. The user may still have a terminal session open, for example.

@Shaunakde
Copy link

@ccordoba12 and @Garrett-R Perhaps opening a new blank tab is the best solution. It is the default behavior of Notepad++ and is not jarring at all.

@ccordoba12
Copy link
Member

Yes, I think that too!

@blink1073, could you take a look at this one when you have some time?

@Shaunakde
Copy link

@ccordoba12 I'd like to try and look at this too. Could you tell where to roughly start looking?

@blink1073
Copy link
Contributor

It seems like something would have to take the closed dock's place, perhaps an empty dock window?

@ccordoba12
Copy link
Member

I think this is simpler:

  1. Check how many files are open (on the current Editor Stack) in the close_file method of plugins/editor
  2. If there is only one file open and the user wants to close it, call the new method after that to create a new file.

I think that's all :-)

@blink1073
Copy link
Contributor

Yeah I'm with you @ccordoba12, this would be akin to emacs opening a new buffer in a split view.

@ccordoba12
Copy link
Member

@blink1073, oh yeah!! Besides opening a new file, we should split it as before :-)

@goanpeca
Copy link
Member

@Shaunakde if you still want to help on this, you can start taking a look at this and try to implement @ccordoba12 suggestions.

@Shaunakde
Copy link

@goanpeca I will take a look as soon as I get home tonight. Thank you!

On Wed, Apr 22, 2015 at 6:29 PM, Gonzalo Peña-Castellanos <
notifications@github.com> wrote:

@Shaunakde https://github.com/Shaunakde if you still want to help on
this, you can start taking a look at this
https://github.com/spyder-ide/spyder/blob/master/spyderlib/plugins/editor.py#L1713
and try to implement @ccordoba12 https://github.com/ccordoba12
suggestions.


Reply to this email directly or view it on GitHub
#2302 (comment).

Shaunak De
http://shaunak.de/

@goanpeca
Copy link
Member

👍 great, remember to drop by gitter if you have doubts, cheers

@ccordoba12 ccordoba12 added this to the v2.3.5 milestone Jun 1, 2015
@ccordoba12 ccordoba12 changed the title Closing all files in editor shouldn't close all panels Closing all files in editor shouldn't left it empty Jun 9, 2015
@ccordoba12
Copy link
Member

I invested a couple of hours trying to preserve panel distribution after closing all files, but I couldn't make it work reliably. So I'm sorry to say we're not going to be implement that feature.

I just implemented the simplest thing, which is opening a new empty file after closing all files. This way the Editor will never be empty again.

Since projects are going to revamped in 3.0, and will let users to easily switch between sessions (somethings we're not offering right now), the feature required by @Garrett-R won't be really necessary :-) I mean, panel distribution will be saved for every project.

@ccordoba12
Copy link
Member

@Garrett-R, please don't forget to mention it in issue #2460.

@Garrett-R Garrett-R changed the title Closing all files in editor shouldn't left it empty Closing all files in editor shouldn't leave it empty Jun 11, 2015
@Garrett-R
Copy link
Author

Thanks, @ccordoba12!

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

No branches or pull requests

5 participants