Loading ...
Sorry, an error occurred while loading the content.

77665Re: Line formatting bug

Expand Messages
  • mvxxc@...
    Sep 1, 2014
    • 0 Attachment
      Christian Brabandt, 01.09.2014 21:40:
      >
      > On So, 31 Aug 2014, mvxxc@... wrote:
      >
      > > As I have read a lot about assumed breakindent bugs in previous threads: This
      > > reminds me of the strange behavior related to line formatting I mentioned in the
      > > vim_use mailing list. It can still be reproduced with the following test.
      > >
      > > mvxxc@..., 15.02.2014 02:11:
      > > > ... it seems that formatting really behaves
      > > > differently if "linebreak" is set. After setting options with
      > > > ":se all& co=79 tw=80", place the cursor in the first test line and format both
      > > > lines with "gqj". Try this with and without "linebreak".
      > >
      > > > xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx
      > > > xxx
      > >
      > > > In the first case, there are two words in the second line; in the second case,
      > > > it is just one word. This can also be reproduced when starting Vim with
      > > > "vim -u NONE +'se all& co=79 tw=80'".
      > >
      > > According to the help page for linebreak, this option should not affect
      > > formatting.
      >
      > Attached is a patch.
      >
      > Best,
      > Christian
      > --
      > Zwei Knaben stiegen auf einen Turm,
      > Der eine hatte 'nen Bandelwurm.
      > Der andre keck und munter,
      > Der lieƟ sich daran herunter.
      >
      > --
      > --
      > 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
      >
      > ---
      > You received this message because you are subscribed to the Google Groups "vim_dev" group.
      > To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      > For more options, visit https://groups.google.com/d/optout.

      > diff --git a/src/edit.c b/src/edit.c
      > --- a/src/edit.c
      > +++ b/src/edit.c
      > @@ -6131,6 +6131,11 @@ internal_format(textwidth, second_indent
      > int no_leader = FALSE;
      > int do_comments = (flags & INSCHAR_DO_COM);
      > #endif
      > +#ifdef FEAT_LINEBREAK
      > + int has_lbr = curwin->w_p_lbr;
      > + /* make sure, win_lbr_chartabsize counts correct */
      > + curwin->w_p_lbr = FALSE;
      > +#endif
      >
      > /*
      > * When 'ai' is off we don't want a space under the cursor to be
      > @@ -6483,6 +6488,9 @@ internal_format(textwidth, second_indent
      > if (save_char != NUL) /* put back space after cursor */
      > pchar_cursor(save_char);
      >
      > +#ifdef FEAT_LINEBREAK
      > + curwin->w_p_lbr = has_lbr;
      > +#endif
      > if (!format_only && haveto_redraw)
      > {
      > update_topline();

      Thank you for this patch!

      Best regards.

      --
      --
      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

      ---
      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/d/optout.
    • Show all 5 messages in this topic