On Mi, 12 Nov 2014, Christian Brabandt wrote: > Am 2014-11-12 04:22, schrieb Vlad Irnov: > >I have encountered a bug when long wrapped lines are briefly displayed > >incorrectly after normal command "s". To reproduce: > >1) Open attached .txt file: > > gvim -u NONE -N s-wrapped-line-display-bug.txt > >2) Set the following options, the long line with aaaa's should be > >wrapped: > > :set wrap linebreak cul cuc > >3) Place the cursor on line with bbbb and press "s". The results > >before and after are in the attached .png screenshot. The display of > >the long wrapped line changes unexpectedly from 'linebreak' to > >'nolinebreak'. The cursor position is also wrong, as seen in the > >screenshot, but this does not always happen. > > > >Setting 'showbreak' may also have the same affect as setting cul > >and/or cuc, but I am not sure about that. > > > >Tested Vim versions: the most recent gvim 7.4.507, source downloaded > >2014-11-11, compiled on Windows; gvim 7.4.488 on Linux (Debian Live > >7.6, vim-gtk installed from backports). > >Vim 7.4.256 on Windows is not affected. > > This is probably caused by 7.4.435 which tries to fix > an formatting error caused by the linebreak setting. > > I'll look into this. Perhaps one can reset the linebreak setting > earlier.
It's actually patch 7.4.467 that causes this. Here is a patch that resets the linebreak setting in a few more places in do_pending_operator so that whenever for the change, replace and insert/append operations, linebreak will be set to its original value (while still keeping the fix for 7.4.467). That should also prevent the redrawing issues, that caused the cursor position to be wrong. Best, Christian -- F: Woran erkennt man, daß ein Politiker lügt? A: Wenn sich seine Lippen bewegen. -- -- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
diff --git a/src/normal.c b/src/normal.c --- a/src/normal.c +++ b/src/normal.c @@ -1969,6 +1969,10 @@ do_pending_operator(cap, old_col, gui_ya else restart_edit_save = 0; restart_edit = 0; +#ifdef FEAT_LINEBREAK + /* Restore linebreak, so that when the user edits it looks as before */ + curwin->w_p_lbr = lbr_saved; +#endif /* Reset finish_op now, don't want it set inside edit(). */ finish_op = FALSE; if (op_change(oap)) /* will call edit() */ @@ -2064,8 +2068,15 @@ do_pending_operator(cap, old_col, gui_ya * Visual mode. But do this only once. */ restart_edit_save = restart_edit; restart_edit = 0; - +#ifdef FEAT_LINEBREAK + /* Restore linebreak, so that when the user edits it looks as before */ + curwin->w_p_lbr = lbr_saved; +#endif op_insert(oap, cap->count1); +#ifdef FEAT_LINEBREAK + /* Reset linebreak, so that formatting works correctly */ + curwin->w_p_lbr = FALSE; +#endif /* TODO: when inserting in several lines, should format all * the lines. */ @@ -2090,7 +2101,13 @@ do_pending_operator(cap, old_col, gui_ya } #ifdef FEAT_VISUALEXTRA else + { +#ifdef FEAT_LINEBREAK + /* Restore linebreak, so that when the user edits it looks as before */ + curwin->w_p_lbr = lbr_saved; +#endif op_replace(oap, cap->nchar); + } #endif break; @@ -2126,6 +2143,9 @@ do_pending_operator(cap, old_col, gui_ya #ifdef FEAT_VIRTUALEDIT virtual_op = MAYBE; #endif +#ifdef FEAT_LINEBREAK + curwin->w_p_lbr = FALSE; +#endif if (!gui_yank) { /*