On 2015-01-09 Friday at 19:14 +0000 [email protected] wrote: > Status: New > Owner: ---- > Labels: Type-Defect Priority-Medium > > New issue 312 by [email protected]: word wrapping messed up when > entering Insert mode with 'c' or 's' > https://code.google.com/p/vim/issues/detail?id=312 > > What steps will reproduce the problem? > 1. set linebreak > 2. Fill the line with words until it wraps, make sure that the first > character in the wrapped word could still fit on the previous line. > 3. Move to anywhere on (one of) the continuation lines. > 4. Press 's' to enter Insert mode. > > What is the expected output? What do you see instead? > Expected: line breaking prior to the cursor location does not change; word > wrapping remains legible. > Actual: line breaks before the cursor are recomputed, and do not honor word > boundaries any more. > > What version of the product are you using? On what operating system? > Vim 7.4.473 on Ubuntu Linux. > For context, vim 7.4.52 on Mint Linux does not have this problem. > > Please provide any additional information below. > > * When entering Insert mode the cursor seems to move with the text, i.e. > keep its location relative to the insert point. > * After quitting Insert mode (Esc) the lines of text remain the same, but > the cursor seems to move to the screen location where it would supposedly > have been had the text layout not changed. > * Outside of Insert mode, hitting Ctrl-L would cause the paragraph to > rearrange correctly. The cursor would align with the text that has just > been edited. > * This happens in both Vim and Gvim in the exact same way, so not a > terminal issue. > * Happens regardless of the value of showbreak. > * This may be related to the breakindent feature, which is present in my > buggy version (7.4.473) but not the good version (7.4.52).
This is probably the same issue as has been reported several weeks ago. Christian Brabandt provided two patches already. Both are on Brams todo list and not yet included. For your convenience I have attached my versions updated for 7.4.529. It appears they apply to current tip 7.4.567 cleanly, just for one hunk I saw an offset message. Please try and report if they fix your issue. -- Roland Eggner -- -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
Fix incorrect display of wrapped lines during insert mode with option linebreak set. ┌──────────────────────────────────────────────────────────────────────────┐ │ Fix incorrect display of wrapped lines during │ │ insert mode with option linebreak set. │ └──────────────────────────────────────────────────────────────────────────┛ todo.txt entry: Patch to fix wrong formatting if 'linebreak' is set. (Christian Brabandt, 2014 Nov 12) Latest update for: vim-7.4.529 Status: Roland Eggner: “Works flawlessly, is in daily usage at my production site (Linux x86_64).” Original author: Christian Brabandt Bug reports and development discussion: http://www.vim.org/maillist.php License and Copyright: http://vimdoc.sourceforge.net/htmldoc/uganda.html ──────────────────────────────────────────────────────────────────────────── ──────────────────────────────────────────────────────────────────────────── Christian Brabandt <cblists@******.org> wrote 2014-11-12 19:58:48 +0100 >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. ──────────────────────────────────────────────────────────────────────────── diff --git a/src/normal.c b/src/normal.c --- a/src/normal.c +++ b/src/normal.c @@ -1966,12 +1966,16 @@ do_pending_operator(cap, old_col, gui_yank) * 'insertmode' isn't set. */ if (p_im || !KeyTyped) restart_edit_save = restart_edit; 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() */ cap->retval |= CA_COMMAND_BUSY; if (restart_edit == 0) restart_edit = restart_edit_save; @@ -2061,14 +2065,21 @@ do_pending_operator(cap, old_col, gui_yank) { /* This is a new edit command, not a restart. Need to * remember it to make 'insertmode' work with mappings for * 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. */ auto_format(FALSE, TRUE); if (restart_edit == 0) @@ -2087,13 +2098,19 @@ do_pending_operator(cap, old_col, gui_yank) { vim_beep(); CancelRedo(); } #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; #ifdef FEAT_FOLDING case OP_FOLD: VIsual_reselect = FALSE; /* don't reselect now */ @@ -2123,12 +2140,15 @@ do_pending_operator(cap, old_col, gui_yank) default: clearopbeep(oap); } #ifdef FEAT_VIRTUALEDIT virtual_op = MAYBE; #endif +#ifdef FEAT_LINEBREAK + curwin->w_p_lbr = FALSE; +#endif if (!gui_yank) { /* * if 'sol' not set, go back to old column for some commands */ if (!p_sol && oap->motion_type == MLINE && !oap->end_adjusted
Fix bug with options relativenumbers and linebreak set. ┌──────────────────────────────────────────────────────────────────────────┐ │ Fix bug with options relativenumbers and linebreak set. │ └──────────────────────────────────────────────────────────────────────────┛ todo.txt entry: Patch to fix relative numbers. (Christian Brabandt, 2014 Nov 17) Update Nov 26. Latest update for: vim-7.4.529 Status: Roland Eggner: “Works flawlessly, is in daily usage at my production site (Linux x86_64).” Original author: Christian Brabandt Bug reports and development discussion: http://www.vim.org/maillist.php License and Copyright: http://vimdoc.sourceforge.net/htmldoc/uganda.html ──────────────────────────────────────────────────────────────────────────── diff --git a/src/normal.c b/src/normal.c --- a/src/normal.c +++ b/src/normal.c @@ -1390,16 +1390,12 @@ do_pending_operator(cap, old_col, gui_yank) static colnr_T redo_VIsual_vcol; /* number of cols or end column */ static long redo_VIsual_count; /* count for Visual operator */ #ifdef FEAT_VIRTUALEDIT int include_line_break = FALSE; #endif -#ifdef FEAT_LINEBREAK - curwin->w_p_lbr = FALSE; /* Avoid a problem with unwanted linebreaks in - * block mode. */ -#endif #if defined(FEAT_CLIPBOARD) /* * Yank the visual area into the GUI selection register before we operate * on it and lose it forever. * Don't do it if a specific register was specified, so that ""x"*P works. * This could call do_pending_operator() recursively, but that's OK @@ -1417,12 +1413,16 @@ do_pending_operator(cap, old_col, gui_yank) /* * If an operation is pending, handle it... */ if ((finish_op || VIsual_active) && oap->op_type != OP_NOP) { +#ifdef FEAT_LINEBREAK + /* Avoid a problem with unwanted linebreaks in block mode. */ + curwin->w_p_lbr = FALSE; +#endif oap->is_VIsual = VIsual_active; if (oap->motion_force == 'V') oap->motion_type = MLINE; else if (oap->motion_force == 'v') { /* If the motion was linewise, "inclusive" will not have been set. @@ -1816,13 +1816,19 @@ do_pending_operator(cap, old_col, gui_yank) #endif if ((oap->op_type == OP_YANK || oap->op_type == OP_COLON || oap->op_type == OP_FUNCTION || oap->op_type == OP_FILTER) && oap->motion_force == NUL) + { +#ifdef FEAT_LINEBREAK + /* make sure, redrawing is correct */ + curwin->w_p_lbr = lbr_saved; +#endif redraw_curbuf_later(INVERTED); + } } } #ifdef FEAT_MBYTE /* Include the trailing byte of a multi-byte char. */ if (has_mbyte && oap->inclusive) @@ -1860,13 +1866,18 @@ do_pending_operator(cap, old_col, gui_yank) * 'modifiable is off or creating a fold. */ if (oap->is_VIsual && (oap->empty || !curbuf->b_p_ma #ifdef FEAT_FOLDING || oap->op_type == OP_FOLD #endif )) + { +#ifdef FEAT_LINEBREAK + curwin->w_p_lbr = lbr_saved; +#endif redraw_curbuf_later(INVERTED); + } /* * If the end of an operator is in column one while oap->motion_type * is MCHAR and oap->inclusive is FALSE, we put op_end after the last * character in the previous line. If op_start is on or before the * first non-blank in the line, the operator becomes linewise @@ -1944,13 +1955,18 @@ do_pending_operator(cap, old_col, gui_yank) { vim_beep(); CancelRedo(); } } else + { +#ifdef FEAT_LINEBREAK + curwin->w_p_lbr = lbr_saved; +#endif (void)op_yank(oap, FALSE, !gui_yank); + } check_cursor_col(); break; case OP_CHANGE: VIsual_reselect = FALSE; /* don't reselect now */ if (empty_region_error) @@ -2151,13 +2167,18 @@ do_pending_operator(cap, old_col, gui_yank) /* * if 'sol' not set, go back to old column for some commands */ if (!p_sol && oap->motion_type == MLINE && !oap->end_adjusted && (oap->op_type == OP_LSHIFT || oap->op_type == OP_RSHIFT || oap->op_type == OP_DELETE)) + { +#ifdef FEAT_LINEBREAK + curwin->w_p_lbr = FALSE; +#endif coladvance(curwin->w_curswant = old_col); + } } else { curwin->w_cursor = old_cursor; } oap->block_mode = FALSE;
pgpz6KsQjfYhJ.pgp
Description: PGP signature
