Allow Vdebug windows to toggle open/closed #30

Open
grota opened this Issue Jan 8, 2013 · 7 comments

Projects

None yet

3 participants

@grota
grota commented Jan 8, 2013

Hi,
I think I'm doing something wrong with vdebug's windows/tabs.
My use case is the following:

  • I start debugging and vdebug opens a new tab with all its windows.
  • Then I finish debugging and I :tabclose vdebug's tab.
  • Then I maybe want to start debugging again, so I press g:vdebug_keymap['run'] (which is F8 for me) and I get the following error.
"DebuggerStack" [New File]
E37: No write since last change (add ! to override)
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/grota/rcfiles/vim/dotvim/bundle/joonty_vdebug/plugin/python/start_vdebug.py", line 30, in run
    self.runner.run()
  File "/home/grota/rcfiles/vim/dotvim/bundle/joonty_vdebug/plugin/python/vdebug/runner.py", line 135, in run
    self.open()
  File "/home/grota/rcfiles/vim/dotvim/bundle/joonty_vdebug/plugin/python/vdebug/runner.py", line 63, in open
    self.refresh(status)
  File "/home/grota/rcfiles/vim/dotvim/bundle/joonty_vdebug/plugin/python/vdebug/runner.py", line 88, in refresh
    stack_res = self.update_stack()
  File "/home/grota/rcfiles/vim/dotvim/bundle/joonty_vdebug/plugin/python/vdebug/runner.py", line 268, in update_stack
    self.ui.stackwin.accept_renderer(renderer)
  File "/home/grota/rcfiles/vim/dotvim/bundle/joonty_vdebug/plugin/python/vdebug/ui/vimui.py", line 300, in accept_renderer
    self.write(renderer.render())
  File "/home/grota/rcfiles/vim/dotvim/bundle/joonty_vdebug/plugin/python/vdebug/ui/vimui.py", line 370, in write
    Window.write(self, msg, after="normal gg")
  File "/home/grota/rcfiles/vim/dotvim/bundle/joonty_vdebug/plugin/python/vdebug/ui/vimui.py", line 219, in write
    self.create()
  File "/home/grota/rcfiles/vim/dotvim/bundle/joonty_vdebug/plugin/python/vdebug/ui/vimui.py", line 273, in create
    vim.command('silent ' + self.open_cmd + ' ' + self.name)
vim.error
Press ENTER or type command to continue

I think I'm operating on vdebug's tab/windows incorrectly. What's the right way to fulfill the use case described above?

Related to the question above, say I close DebuggerWatch window. How can I reopen it?

Again, may be related to the questions above, say I :VdebugEval 2+2. The contents of the DebuggerWatch window get overwritten, how do I get back to the previous content?

@joonty
Owner
joonty commented Jan 8, 2013

Hi,

It's actually much simpler than you think - Vdebug handles the closing of windows. When you've finished debugging, just press the key that maps to g:vdebug_keymap['close']. This will wipeout all buffers that relate to vdebug and close the vdebug tab - you shouldn't need to do any of that yourself.

However, I'll put in a fix that means an error isn't thrown if the user closes the tab manually, as it seems like that's the problem you're having.

Thanks

@grota
grota commented Jan 8, 2013

Thanks for adding the check, it's a very welcome addition as far as I am concerned.

Question 2 above is solved, I basically had it mapped to F11 but Xorg stole that keystroke to put the terminal fullscreen. Sorry for having bothered you with that.

Question 3 actually makes vim crash. I basically start debugging and then due to my fat fingers I close the DebuggerWatch window (but I guess other people will want to close it intentionally to save screen space).
After that starting another connection is impossible with this error

"DebuggerWatch" [New File]
E37: No write since last change (add ! to override)
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/grota/rcfiles/vim/dotvim/bundle/joonty_vdebug/plugin/python/start_vdebug.py", line 30, in run
    self.runner.run()
  File "/home/grota/rcfiles/vim/dotvim/bundle/joonty_vdebug/plugin/python/vdebug/runner.py", line 135, in run
    self.open()
  File "/home/grota/rcfiles/vim/dotvim/bundle/joonty_vdebug/plugin/python/vdebug/runner.py", line 63, in open
    self.refresh(status)
  File "/home/grota/rcfiles/vim/dotvim/bundle/joonty_vdebug/plugin/python/vdebug/runner.py", line 99, in refresh
    self.get_context(0)
  File "/home/grota/rcfiles/vim/dotvim/bundle/joonty_vdebug/plugin/python/vdebug/runner.py", line 110, in get_context
    self.ui.watchwin.accept_renderer(rend)
  File "/home/grota/rcfiles/vim/dotvim/bundle/joonty_vdebug/plugin/python/vdebug/ui/vimui.py", line 300, in accept_renderer
    self.write(renderer.render())
  File "/home/grota/rcfiles/vim/dotvim/bundle/joonty_vdebug/plugin/python/vdebug/ui/vimui.py", line 388, in write
    Window.write(self, msg, after="normal gg")
  File "/home/grota/rcfiles/vim/dotvim/bundle/joonty_vdebug/plugin/python/vdebug/ui/vimui.py", line 219, in write
    self.create()
  File "/home/grota/rcfiles/vim/dotvim/bundle/joonty_vdebug/plugin/python/vdebug/ui/vimui.py", line 273, in create
    vim.command('silent ' + self.open_cmd + ' ' + self.name)
vim.error

Trying to quit vim I see that the DebuggerWatch buffer is empty (but marked as modified with changes to be saved). I :bd! that and I get a crash to terminal with

Vim: Caught deadly signal ABRT                                                                                                                                                                                                      
Vim: preserving files...                                                                                                                                                                                                            
Vim: Finished.
Aborted (core dumped)

Would it be possible to have Vdebug's 3 windows togglable like the breakpoint one?

@grota grota referenced this issue Jan 8, 2013
Closed

detaching #33

@joonty
Owner
joonty commented Jan 8, 2013

Sorry - failed to read your original post all the way through! It's a good point, maybe all windows should have a open/close toggle.

I'll take a look at this and will link updates in this issue.

Thanks

@joonty
Owner
joonty commented May 10, 2013

Hi @grota, sorry for neglecting this issue!

It might be worth pointing out that the vdebug tab shouldn't be closed with :tabclose: just press the stop button again (defaults to <F6>).

I just did an experiment where I used :tabclose after the debugging session closed, and it caused all sorts of problems on the next startup, which is probably what you're seeing.

Anyway, that's an oversight on my part really. It should behave better if you close it using vim commands, so I'll take a look at what can be done to sort that out.

Thanks

@qstrahl
Collaborator
qstrahl commented May 10, 2013

You should be able to leverage the BufUnload or BufDelete autocmd events for this purpose.

@grota
grota commented May 10, 2013

@joonty no worries man, we all do this on our spare time

@joonty
Owner
joonty commented May 16, 2013

@qstrahl that's perfect for what this needs, thanks. I'll look into implementing that.

@joonty joonty closed this May 16, 2013
@joonty joonty reopened this May 16, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment