Hi Bram!

On So, 20 Mai 2012, Bram Moolenaar wrote:

> Christian Brabandt wrote:
> 
> > I find it irritating, that folds open on horizontal movements depending 
> > on where the cursor is.
> > 
> > For example open fold.c, move the cursor to a closed fold, Move the 
> > cursor to the end of the line ('$'), now the fold opens. Close the fold 
> > and press 'l'. The closed fold does not open, because the cursor did not 
> > move.
> > 
> > This happens sometimes to me and I find this confusing, that 
> > sometimes the fold does not open and sometimes it does.
> > 
> > So here is a small patch, that fixes it.
> > 
> > diff --git a/src/normal.c b/src/normal.c
> > --- a/src/normal.c
> > +++ b/src/normal.c
> > @@ -6081,7 +6081,7 @@
> >  #endif
> >      }
> >  #ifdef FEAT_FOLDING
> > -    if (n != cap->count1 && (fdo_flags & FDO_HOR) && KeyTyped
> > +    if (n <= cap->count1 && (fdo_flags & FDO_HOR) && KeyTyped
> >                                                && cap->oap->op_type == 
> > OP_NOP)
> >         foldOpenCursor();
> >  #endif
> > @@ -6151,7 +6151,7 @@
> >         }
> >      }
> >  #ifdef FEAT_FOLDING
> > -    if (n != cap->count1 && (fdo_flags & FDO_HOR) && KeyTyped
> > +    if (n <= cap->count1 && (fdo_flags & FDO_HOR) && KeyTyped
> >                                                && cap->oap->op_type == 
> > OP_NOP)
> >         foldOpenCursor();
> >  #endif
> 
> I'm not sure we need this change.  It's actually not because the cursor
> didn't move.  If you use a command that fails, such as using "l" when
> already at the end of the line, nothing happens.  If you want to open a
> fold intentionally, use "0", that never fails.  Is there a good reason
> to change this behavior?

The point is, when the folds are closed, the user doesn't know, whether 
the cursor is at the end of the line so it's kind of unexpected that l 
doesn't open the fold.

regards,
Christian

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui