comparison src/normal.c @ 18128:aeabc666a119 v8.1.2059

patch 8.1.2059: fix for "x" deleting a fold has side effects Commit: https://github.com/vim/vim/commit/56ebbabea1d8409ba67127b9674f6c714739c8e0 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Sep 20 13:40:14 2019 +0200 patch 8.1.2059: fix for "x" deleting a fold has side effects Problem: Fix for "x" deleting a fold has side effects. Solution: Fix it where the fold is included.
author Bram Moolenaar <Bram@vim.org>
date Fri, 20 Sep 2019 13:45:04 +0200
parents 90b0af9ba4ff
children 1868ec23360e
comparison
equal deleted inserted replaced
18127:3a7a8ae0864f 18128:aeabc666a119
1533 /* Include folded lines completely. */ 1533 /* Include folded lines completely. */
1534 if (!VIsual_active) 1534 if (!VIsual_active)
1535 { 1535 {
1536 if (hasFolding(oap->start.lnum, &oap->start.lnum, NULL)) 1536 if (hasFolding(oap->start.lnum, &oap->start.lnum, NULL))
1537 oap->start.col = 0; 1537 oap->start.col = 0;
1538 if (hasFolding(curwin->w_cursor.lnum, NULL, 1538 if ((curwin->w_cursor.col > 0 || oap->inclusive)
1539 && hasFolding(curwin->w_cursor.lnum, NULL,
1539 &curwin->w_cursor.lnum)) 1540 &curwin->w_cursor.lnum))
1540 curwin->w_cursor.col = (colnr_T)STRLEN(ml_get_curline()); 1541 curwin->w_cursor.col = (colnr_T)STRLEN(ml_get_curline());
1541 } 1542 }
1542 #endif 1543 #endif
1543 oap->end = curwin->w_cursor; 1544 oap->end = curwin->w_cursor;
5999 if (virtual_active()) 6000 if (virtual_active())
6000 oneright(); 6001 oneright();
6001 else 6002 else
6002 { 6003 {
6003 if (has_mbyte) 6004 if (has_mbyte)
6004 curwin->w_cursor.col += 6005 curwin->w_cursor.col += (*mb_ptr2len)(ml_get_cursor());
6005 (*mb_ptr2len)(ml_get_cursor());
6006 else 6006 else
6007 ++curwin->w_cursor.col; 6007 ++curwin->w_cursor.col;
6008 } 6008 }
6009 } 6009 }
6010 } 6010 }
7398 } 7398 }
7399 else 7399 else
7400 { 7400 {
7401 if (cap->count0) 7401 if (cap->count0)
7402 stuffnumReadbuff(cap->count0); 7402 stuffnumReadbuff(cap->count0);
7403 // If on an empty line and using 'x' and "l" is included in the 7403 stuffReadbuff(ar[(int)(vim_strchr(str, cap->cmdchar) - str)]);
7404 // whichwrap option, do not delete the next line.
7405 if (cap->cmdchar == 'x' && vim_strchr(p_ww, 'l') != NULL
7406 && gchar_cursor() == NUL)
7407 stuffReadbuff((char_u *)"dd");
7408 else
7409 stuffReadbuff(ar[(int)(vim_strchr(str, cap->cmdchar) - str)]);
7410 } 7404 }
7411 } 7405 }
7412 cap->opcount = 0; 7406 cap->opcount = 0;
7413 } 7407 }
7414 7408