comparison src/search.c @ 18644:7bfe68b637be v8.1.2314

patch 8.1.2314: vi' sometimes does not select anything Commit: https://github.com/vim/vim/commit/7170b295b06e3168424985530d8477ed2e058b67 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Nov 17 17:32:28 2019 +0100 patch 8.1.2314: vi' sometimes does not select anything Problem: vi' sometimes does not select anything. Solution: Recognize an empty selection. (Christian Brabandt, closes https://github.com/vim/vim/issues/5183)
author Bram Moolenaar <Bram@vim.org>
date Sun, 17 Nov 2019 17:45:03 +0100
parents bbea1f108187
children 953e83e09e78
comparison
equal deleted inserted replaced
18643:31ba6c846789 18644:7bfe68b637be
4432 /* this only works within one line */ 4432 /* this only works within one line */
4433 if (VIsual.lnum != curwin->w_cursor.lnum) 4433 if (VIsual.lnum != curwin->w_cursor.lnum)
4434 return FALSE; 4434 return FALSE;
4435 4435
4436 vis_bef_curs = LT_POS(VIsual, curwin->w_cursor); 4436 vis_bef_curs = LT_POS(VIsual, curwin->w_cursor);
4437 vis_empty = EQUAL_POS(VIsual, curwin->w_cursor);
4437 if (*p_sel == 'e') 4438 if (*p_sel == 'e')
4438 { 4439 {
4439 if (!vis_bef_curs) 4440 if (!vis_bef_curs && !vis_empty)
4440 { 4441 {
4441 // VIsual needs to be the start of Visual selection. 4442 // VIsual needs to be the start of Visual selection.
4442 pos_T t = curwin->w_cursor; 4443 pos_T t = curwin->w_cursor;
4443 4444
4444 curwin->w_cursor = VIsual; 4445 curwin->w_cursor = VIsual;
4445 VIsual = t; 4446 VIsual = t;
4446 vis_bef_curs = TRUE; 4447 vis_bef_curs = TRUE;
4447 restore_vis_bef = TRUE; 4448 restore_vis_bef = TRUE;
4448 } 4449 }
4449 dec_cursor(); 4450 dec_cursor();
4450 } 4451 vis_empty = EQUAL_POS(VIsual, curwin->w_cursor);
4451 vis_empty = EQUAL_POS(VIsual, curwin->w_cursor); 4452 }
4452 } 4453 }
4453 4454
4454 if (!vis_empty) 4455 if (!vis_empty)
4455 { 4456 {
4456 /* Check if the existing selection exactly spans the text inside 4457 /* Check if the existing selection exactly spans the text inside