Re: Screen update issue with incsearch in latest code

2016-09-03 Fir de Conversatie Mike Williams

Hi Christian

On 02/09/2016 20:44, Christian Brabandt wrote:

Hi Mike!

On Fr, 02 Sep 2016, Mike Williams wrote:


Hi,

On 02/09/2016 12:22, Christian Brabandt wrote:

On Mi, 31 Aug 2016, Mike Williams wrote:


Hi,

I pretty much lurk here these days but remember seeing some
discussion on changes to do with incremental search.  I am seeing
strange screen jumps with incremental search with the current
version 7.4.2295.  This is on on Windows and linux.

The following will reproduce the issue on Windows.  Start in the VIM
source directory and invoke vim with gvim -u NONE -U NONE
if_cscope.h. Next enable incsearch with ":set incsearch" and then
start a search with "/Sto" - this should cause the display to jump
to an enum near the end of the file.  At this point delete the o to
leave "/St" as the search pattern and then hit return to finish the
search.  I see VIM jumping back to the top of the file but with the
cursor at the same position as for the search.  If then hit j to go
down one line vim jumps back to the end of the file where the
original search succeeded.

The action that seems to trigger the unexpected jumps around the
buffer is deleting characters from the search pattern.  It can be
confusing as the screen doesn't initially display what you are
expecting (with the cursor appearing beyond the end of a line
sometimes) and then any cursor movement cause the display to jump
again.


Thanks for the almost perfect bug report (it just needed a patch to be
perfect ;))

I could easily reproduce it. Turns out, that after backspacing, the view
will not be reset correctly. So we have to save some variables there.

Please check the attached patch, which includes a test to fix this
behaviour.


It does fix my original problem but it has caused a new one.

With the same setup as above, delete all of pattern back to / and then
hit return.  I get the expected "No previous regular expression" error.
Then press return.  VIM should return back to the top of the file but
instead displays the end of the file - until you move the cursor when it
jumps back to the top of the file.  This does not happen without the
patch applied.


good catch. updated patch attached. I added a test, but that didn't work
as expected. Therefore the test is currently disabled. I verified
manually, that either of  works as expected.


Getting better :) but another failure case I am afraid.

Same setup as before.  This time use the search string /Stora - that
search will fail and VIM will jump back to the start of the file - but
then backspace the a to leave /Stor which is a match once again and VIM
displays it ok.  Then hit return and VIM displays the top of the file
until you move the cursor when the display updates back to the match at
the end.

HTH - TTFN

Mike
--
A leading authority is someone lucky who guessed right.
[Visit us at Labelexpo Americas 2016, stand 5931] 


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


Re: Screen update issue with incsearch in latest code

2016-09-02 Fir de Conversatie Christian Brabandt
Hi Mike!

On Fr, 02 Sep 2016, Mike Williams wrote:

> Hi,
> 
> On 02/09/2016 12:22, Christian Brabandt wrote:
> >On Mi, 31 Aug 2016, Mike Williams wrote:
> >
> >>Hi,
> >>
> >>I pretty much lurk here these days but remember seeing some
> >>discussion on changes to do with incremental search.  I am seeing
> >>strange screen jumps with incremental search with the current
> >>version 7.4.2295.  This is on on Windows and linux.
> >>
> >>The following will reproduce the issue on Windows.  Start in the VIM
> >>source directory and invoke vim with gvim -u NONE -U NONE
> >>if_cscope.h. Next enable incsearch with ":set incsearch" and then
> >>start a search with "/Sto" - this should cause the display to jump
> >>to an enum near the end of the file.  At this point delete the o to
> >>leave "/St" as the search pattern and then hit return to finish the
> >>search.  I see VIM jumping back to the top of the file but with the
> >>cursor at the same position as for the search.  If then hit j to go
> >>down one line vim jumps back to the end of the file where the
> >>original search succeeded.
> >>
> >>The action that seems to trigger the unexpected jumps around the
> >>buffer is deleting characters from the search pattern.  It can be
> >>confusing as the screen doesn't initially display what you are
> >>expecting (with the cursor appearing beyond the end of a line
> >>sometimes) and then any cursor movement cause the display to jump
> >>again.
> >
> >Thanks for the almost perfect bug report (it just needed a patch to be
> >perfect ;))
> >
> >I could easily reproduce it. Turns out, that after backspacing, the view
> >will not be reset correctly. So we have to save some variables there.
> >
> >Please check the attached patch, which includes a test to fix this
> >behaviour.
> 
> It does fix my original problem but it has caused a new one.
> 
> With the same setup as above, delete all of pattern back to / and then
> hit return.  I get the expected "No previous regular expression" error.
> Then press return.  VIM should return back to the top of the file but
> instead displays the end of the file - until you move the cursor when it
> jumps back to the top of the file.  This does not happen without the
> patch applied.

good catch. updated patch attached. I added a test, but that didn't work 
as expected. Therefore the test is currently disabled. I verified 
manually, that either of  works as expected.

Best,
Christian
-- 
In der Politik errät sogar das Publikum stets das Listige und Feine;
nur das Große und Reine allein ist dazu gemacht, nicht geahnet zu
werden.
-- Jean Paul

-- 
-- 
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.
From a9553dd9ecbbbe7254250be28d7a05ee844e70c1 Mon Sep 17 00:00:00 2001
From: Christian Brabandt 
Date: Fri, 2 Sep 2016 13:09:37 +0200
Subject: [PATCH] Save and restore position after  in search

patch 7.4.2259 introduced the possibility to jump to different matches
using / when 'incsearch' is set. This works by internally
setting the cursor position and saving and restoring the view for each
match.

Unfortunately, this introduced a regression, that when using  to
delete some characters from the search prompt and pressing enter, the
view would be restored to the initial view (when we started the search
command), while the cursor might end up still on a different line (not
even being visible).

Therefore, let's just save the current view on deleteing characters from
the command line, so that it will be correctly restored on pressing
enter and add a test to verify, this actually works.
---
 src/ex_getln.c  | 27 ++-
 src/testdir/test_search.vim | 25 +
 2 files changed, 51 insertions(+), 1 deletion(-)

diff --git a/src/ex_getln.c b/src/ex_getln.c
index 110a95a..4fb4c73 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -179,15 +179,20 @@ getcmdline(
 #ifdef FEAT_SEARCH_EXTRA
 pos_T	old_cursor;
 colnr_T	old_curswant;
+colnr_T init_curswant = curwin->w_curswant;
 colnr_T	old_leftcol;
+colnr_T init_leftcol = curwin->w_leftcol;
 linenr_T	old_topline;
+linenr_Tinit_topline = curwin->w_topline;
 pos_T   cursor_start;
 pos_T   match_start = curwin->w_cursor;
 pos_T   match_end;
 # ifdef FEAT_DIFF
 int		old_topfill;
+int init_topfill = curwin->w_topfill;
 # endif
 linenr_T	old_botline;
+linenr_T	init_botline = curwin->w_botline;
 int		did_incsearch = FALSE;
 int		incsearch_postponed = FALSE;
 #endif
@@ -1006,13 

Re: Screen update issue with incsearch in latest code

2016-09-02 Fir de Conversatie Mike Williams

Hi,

On 02/09/2016 12:22, Christian Brabandt wrote:

On Mi, 31 Aug 2016, Mike Williams wrote:


Hi,

I pretty much lurk here these days but remember seeing some
discussion on changes to do with incremental search.  I am seeing
strange screen jumps with incremental search with the current
version 7.4.2295.  This is on on Windows and linux.

The following will reproduce the issue on Windows.  Start in the VIM
source directory and invoke vim with gvim -u NONE -U NONE
if_cscope.h. Next enable incsearch with ":set incsearch" and then
start a search with "/Sto" - this should cause the display to jump
to an enum near the end of the file.  At this point delete the o to
leave "/St" as the search pattern and then hit return to finish the
search.  I see VIM jumping back to the top of the file but with the
cursor at the same position as for the search.  If then hit j to go
down one line vim jumps back to the end of the file where the
original search succeeded.

The action that seems to trigger the unexpected jumps around the
buffer is deleting characters from the search pattern.  It can be
confusing as the screen doesn't initially display what you are
expecting (with the cursor appearing beyond the end of a line
sometimes) and then any cursor movement cause the display to jump
again.


Thanks for the almost perfect bug report (it just needed a patch to be
perfect ;))

I could easily reproduce it. Turns out, that after backspacing, the view
will not be reset correctly. So we have to save some variables there.

Please check the attached patch, which includes a test to fix this
behaviour.


It does fix my original problem but it has caused a new one.

With the same setup as above, delete all of pattern back to / and then
hit return.  I get the expected "No previous regular expression" error.
Then press return.  VIM should return back to the top of the file but
instead displays the end of the file - until you move the cursor when it
jumps back to the top of the file.  This does not happen without the
patch applied.

HTH - TTFN

Mike
--
There are a thousand languages, but a smile speaks them all.
[Visit us at Labelexpo Americas 2016, stand 5931] 


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


Re: Screen update issue with incsearch in latest code

2016-09-02 Fir de Conversatie Christian Brabandt
On Mi, 31 Aug 2016, Mike Williams wrote:

> Hi,
> 
> I pretty much lurk here these days but remember seeing some
> discussion on changes to do with incremental search.  I am seeing
> strange screen jumps with incremental search with the current
> version 7.4.2295.  This is on on Windows and linux.
> 
> The following will reproduce the issue on Windows.  Start in the VIM
> source directory and invoke vim with gvim -u NONE -U NONE
> if_cscope.h. Next enable incsearch with ":set incsearch" and then
> start a search with "/Sto" - this should cause the display to jump
> to an enum near the end of the file.  At this point delete the o to
> leave "/St" as the search pattern and then hit return to finish the
> search.  I see VIM jumping back to the top of the file but with the
> cursor at the same position as for the search.  If then hit j to go
> down one line vim jumps back to the end of the file where the
> original search succeeded.
> 
> The action that seems to trigger the unexpected jumps around the
> buffer is deleting characters from the search pattern.  It can be
> confusing as the screen doesn't initially display what you are
> expecting (with the cursor appearing beyond the end of a line
> sometimes) and then any cursor movement cause the display to jump
> again.

Thanks for the almost perfect bug report (it just needed a patch to be 
perfect ;))

I could easily reproduce it. Turns out, that after backspacing, the view 
will not be reset correctly. So we have to save some variables there.

Please check the attached patch, which includes a test to fix this 
behaviour.

Best,
Christian
-- 
Wer weiß denn, ob das Leben nicht das Totsein ist und das Totsein
Leben
-- Euripides (580-406 v. Chr.)

-- 
-- 
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.
From 6e0de09303e580ef77c41bea61be91910eed1235 Mon Sep 17 00:00:00 2001
From: Christian Brabandt 
Date: Fri, 2 Sep 2016 13:09:37 +0200
Subject: [PATCH] Save and restore position after  in search

patch 7.4.2259 introduced the possibility to jump to different matches
using / when 'incsearch' is set. This works by internally
setting the cursor position and saving and restoring the view for each
match.

Unfortunately, this introduced a regression, that when using  to
delete some characters from the search prompt and pressing enter, the
view would be restored to the initial view (when we started the search
command), while the cursor might end up still on a different line (not
even being visible).

Therefore, let's just save the current view on deleteing characters from
the command line, so that it will be correctly restored on pressing
enter and add a test to verify, this actually works.
---
 src/ex_getln.c  | 8 
 src/testdir/test_search.vim | 8 
 2 files changed, 16 insertions(+)

diff --git a/src/ex_getln.c b/src/ex_getln.c
index 110a95a..369acb2 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -1011,6 +1011,14 @@ getcmdline(
 		{
 			old_cursor = match_start;
 			decl(_cursor);
+			/* save view settings, so that the screen
+			 * won't be restored at the wrong position */
+			old_leftcol = curwin->w_leftcol;
+			old_topline = curwin->w_topline;
+# ifdef FEAT_DIFF
+			old_topfill = curwin->w_topfill;
+# endif
+			old_botline = curwin->w_botline;
 		}
 #endif
 		redrawcmd();
diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim
index 6e51460..0abb7fd 100644
--- a/src/testdir/test_search.vim
+++ b/src/testdir/test_search.vim
@@ -235,8 +235,16 @@ func Test_search_cmdline2()
   " go to previous match (on line 2)
   call feedkeys("/the\\\", 'tx')
   call assert_equal('  2 these', getline('.'))
+  " Test 2: keep the view,
+  " after deleting a character from the search cmd
+  call setline(1, ['  1', '  2 these', '  3 the', '  4 their', '  5 there', '  6 their', '  7 the', '  8 them', '  9 these', ' 10 foobar'])
+  resize 5
+  1
+  call feedkeys("/foo\\", 'tx')
+  call assert_equal({'lnum': 10, 'leftcol': 0, 'col': 4, 'topfill': 0, 'topline': 6, 'coladd': 0, 'skipcol': 0, 'curswant': 4}, winsaveview())
 
   " clean up
+  set noincsearch
   call test_disable_char_avail(0)
   bw!
 endfunc
-- 
2.1.4



Re: Screen update issue with incsearch in latest code

2016-08-31 Fir de Conversatie Christian Brabandt

Thanks for the report and sorry for that. I'll look into it and post an
update.

Best,
Christian

Am 2016-08-31 15:36, schrieb Mike Williams:

Yep, it is a regression introduced by the work for CTRL-N/P with
incsearch in 7.4.2259.

On 31/08/2016 12:09, Mike Williams wrote:

Hi,

I pretty much lurk here these days but remember seeing some discussion
on changes to do with incremental search.  I am seeing strange screen
jumps with incremental search with the current version 7.4.2295.  This
is on on Windows and linux.

The following will reproduce the issue on Windows.  Start in the VIM
source directory and invoke vim with gvim -u NONE -U NONE if_cscope.h.
Next enable incsearch with ":set incsearch" and then start a search 
with

"/Sto" - this should cause the display to jump to an enum near the end
of the file.  At this point delete the o to leave "/St" as the search
pattern and then hit return to finish the search.  I see VIM jumping
back to the top of the file but with the cursor at the same position 
as
for the search.  If then hit j to go down one line vim jumps back to 
the

end of the file where the original search succeeded.

The action that seems to trigger the unexpected jumps around the 
buffer
is deleting characters from the search pattern.  It can be confusing 
as

the screen doesn't initially display what you are expecting (with the
cursor appearing beyond the end of a line sometimes) and then any 
cursor

movement cause the display to jump again.

HTH - TTFN

Mike



Mike
--
Tennis racket broken, anyone got a extra cat?

--


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


Re: Screen update issue with incsearch in latest code

2016-08-31 Fir de Conversatie Mike Williams
Yep, it is a regression introduced by the work for CTRL-N/P with 
incsearch in 7.4.2259.


On 31/08/2016 12:09, Mike Williams wrote:

Hi,

I pretty much lurk here these days but remember seeing some discussion
on changes to do with incremental search.  I am seeing strange screen
jumps with incremental search with the current version 7.4.2295.  This
is on on Windows and linux.

The following will reproduce the issue on Windows.  Start in the VIM
source directory and invoke vim with gvim -u NONE -U NONE if_cscope.h.
Next enable incsearch with ":set incsearch" and then start a search with
"/Sto" - this should cause the display to jump to an enum near the end
of the file.  At this point delete the o to leave "/St" as the search
pattern and then hit return to finish the search.  I see VIM jumping
back to the top of the file but with the cursor at the same position as
for the search.  If then hit j to go down one line vim jumps back to the
end of the file where the original search succeeded.

The action that seems to trigger the unexpected jumps around the buffer
is deleting characters from the search pattern.  It can be confusing as
the screen doesn't initially display what you are expecting (with the
cursor appearing beyond the end of a line sometimes) and then any cursor
movement cause the display to jump again.

HTH - TTFN

Mike



Mike
--
Tennis racket broken, anyone got a extra cat?

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


Screen update issue with incsearch in latest code

2016-08-31 Fir de Conversatie Mike Williams

Hi,

I pretty much lurk here these days but remember seeing some discussion 
on changes to do with incremental search.  I am seeing strange screen 
jumps with incremental search with the current version 7.4.2295.  This 
is on on Windows and linux.


The following will reproduce the issue on Windows.  Start in the VIM 
source directory and invoke vim with gvim -u NONE -U NONE if_cscope.h. 
Next enable incsearch with ":set incsearch" and then start a search with 
"/Sto" - this should cause the display to jump to an enum near the end 
of the file.  At this point delete the o to leave "/St" as the search 
pattern and then hit return to finish the search.  I see VIM jumping 
back to the top of the file but with the cursor at the same position as 
for the search.  If then hit j to go down one line vim jumps back to the 
end of the file where the original search succeeded.


The action that seems to trigger the unexpected jumps around the buffer 
is deleting characters from the search pattern.  It can be confusing as 
the screen doesn't initially display what you are expecting (with the 
cursor appearing beyond the end of a line sometimes) and then any cursor 
movement cause the display to jump again.


HTH - TTFN

Mike
--
Tennis racket broken, anyone got a extra cat?

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