views:

98

answers:

1

Normally a great boon to humanity, on occasion vim's indent-based folding will get confused and need a reset via :set foldmethod=indent. Symptoms include the appearance of consecutive folded lines in the window.

Is there a way to avoid having this happen? Is it just me?

update

Although I'm pretty sure at this point that I've ID'd a bug, answers from people who try my bug reproduction script (linked to in my answer) will serve to actually answer my second question. And if somebody can tell me about the arcane setting that fixes this sketchy behaviour, they get 25 points (assuming that said advice is phrased in the form of an Answer). Actually I think I'll wait a day or two just to make sure I don't pester the good people of vim with a non-bug report.

A: 

I've managed to reproduce this bug.

A vimscript which will conduct an entertaining historical reenactment for your debugging pleasure is available at http://gist.github.com/427303. In case some hooligan decides to revise the gist with Balzac quotations, I'll link to the current revision as well.

At this point it seems to be pretty clearly a bug, so I'll go ahead and report it. I'll reference this post in the bug report, so any further information reported here should be useful to the debuggers.

I'm running the vim-gnome package, version '2:7.2.330-1ubuntu3'. In case something is totally screwy with my vim install, here's the output from the 'analysis' window that my script creates:

  change: Initial setup
  line [foldlevel: contents]:
    0: '  first section'
    1: '    first subsection'
    2: ''
    0: 'second section'
    0: '  second subsection'

  change: Indent the empty-line-delimited last section
  line [foldlevel: contents]:
    0: '  first section'
    1: '    first subsection'
    2: ''
    0: '  second section'
    1: '    second subsection'

  change: Delete the empty line
  line [foldlevel: contents]:
    0: '  first section'
    1: '    first subsection'
    2: '  second section'
    1: '    second subsection'

  change: Fold things in a way that demonstrates the bug
  line [foldlevel: contents]:
    0: '  first section'
    1: '    first subsection'
    2: '  second section'
    1: '    second subsection'

edit

This is a known issue.

intuited