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

Already on GitHub? Sign in to your account

Folds forgotten after beginning debug session #56

Closed
qstrahl opened this Issue Mar 5, 2013 · 12 comments

Comments

Projects
None yet
2 participants
Collaborator

qstrahl commented Mar 5, 2013

Scenario:

  • I am in tab1 with some folds
  • Start debugging
  • Folds have been forgotten

Depending on the value of 'foldmethod', the problem looks different (but probably isn't); for manual folds, all folds are lost (!!!). For computed folds (all other foldmethods), all folds revert to their default state (closed).

Owner

joonty commented Mar 6, 2013

Interesting... does this happen if you create a new tab in Vim, open a few buffers then close the tab and return to the file with the manual folds? This is essentially all that Vdebug should be doing, so it might be that it's something that Vim does. Unless there's some weird side effect going on!

Collaborator

qstrahl commented Mar 7, 2013

Only happens with Vdebug as far as I can tell.

Owner

joonty commented Mar 7, 2013

OK, intriguing. Will investigate.

Owner

joonty commented Mar 22, 2013

Hi there,

Finally been able to give this some time, but I can't reproduce it: folds are remembered for me. Can you give me an example of the steps you're using, with vim commands?

Thanks

Collaborator

qstrahl commented Mar 25, 2013

  • Open a vim file with folds, or :set fdm=manual and make some
  • zM: close all folds
  • zo on a fold: open it
  • <F10>: set a breakpoint
  • <F5>: start debugging

The fold(s) should be reset/destroyed by this point. Best tried with manual folds for full effect.

Edit: Also, it is not necessary to set a breakpoint. Simply starting the debugger will do it.

Owner

joonty commented Mar 29, 2013

Hi Quinn,

I've managed to reproduce this with setting foldmethod to marker and setting a manual fold. It appears that reloading the file in vim (e.g. with :e) clears manual folds defined in that file, and that's what Vdebug is doing - it loads every file that Xdebug (or whichever engine) tells it to, and if you've defined manual folds then they get cleared as a result of Vim's normal behaviour.

Do you know if there's any "soft" loading that Vim can do? I.e. load the file only if there isn't already a buffer, otherwise show that buffer?

Thanks

Collaborator

qstrahl commented Apr 2, 2013

function s:edit(filename)
    try 
        execute 'buffer' fnameescape(a:filename)
    catch /^Vim\%((\a\+)\)\=:E94/ 
        execute 'edit' fnameescape(a:filename)
    endtry
endfunction

Should do the trick.

Edit: added fnameescape() for good measure (unsure if your filenames will already be escaped)

Owner

joonty commented Apr 5, 2013

Nice, thanks for that. I'll give it a whirl when I can.

joonty added a commit that referenced this issue Apr 9, 2013

Fix buffer creation and fold remembering, #70 and #56
Use qstrahl's method for non-destructively opening a file. Also, remove
the empty buffer created by :tabnew
Owner

joonty commented Apr 9, 2013

Hey Quinn,

I added your function (slightly modified) and managed to get some manual folds remembered. Seems to work pretty well, but if you could give the updated dev branch a go you're probably best placed to test it.

Cheers

joonty added a commit that referenced this issue May 9, 2013

Fix buffer creation and fold remembering, #70 and #56
Use qstrahl's method for non-destructively opening a file. Also, remove
the empty buffer created by :tabnew
Owner

joonty commented May 20, 2013

@qstrahl have you given this a go?

Thanks

Collaborator

qstrahl commented May 21, 2013

Sorry, completely forgot about this! I'd love to close the issue, but currently can't confirm due to #84

Collaborator

qstrahl commented Jun 7, 2013

Confirmed fixed as of cb9ebd3

@qstrahl qstrahl closed this Jun 7, 2013

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