Tuesday, September 3, 2019

Re: Mapping erases search count message

On Di, 03 Sep 2019, Bram Moolenaar wrote:

>
> Christian wrote:
>
> > > > On Fr, 30 Aug 2019, Bram Moolenaar wrote:
> > > >
> > > > > Thanks. Yes, I think we should do this. But the allocation should
> > > > > probably be done differently, it looks like with cmd_silent set it still
> > > > > computes the size of the command. This will require some more "if"
> > > > > statements, but makes the size computation more accurate.
> > > >
> > > > Well, yeah I thought this wouldn't hurt.
> > > >
> > > > So how about the attached patch then? It will simply use all available
> > > > space in the command line. Not sure this is correct however.
> > >
> > > It's tricky with all the conditions. But it looks OK. All tests pass.
> > > Let's include this and check that nothing goes wrong. Can we cover this
> > > with a test?
> >
> > Apologizes, the last patch was wrong and caused a strtrunc message
> > ('...')
> >
> > Perhaps we don't even need the added condition `|| cmd_silent` at all?
> >
> > Here is a fix including a test.
>
> Thanks. The test doesn't fail without the fix though.

Yeah, I did not update the test, I tried, but the message is not
truncated when running the test. I think this happens because the output
of `execute()` is actually scrolled. Not sure.

This patch should do it, but only works when run interactively.

diff --git a/src/testdir/test_search_stat.vim b/src/testdir/test_search_stat.vim
index f23952915..33c3858bc 100644
--- a/src/testdir/test_search_stat.vim
+++ b/src/testdir/test_search_stat.vim
@@ -176,7 +176,9 @@ func! Test_search_stat()
let g:b = split(g:a, "\n")[-1]
let stat = '\[1/2\]'
call assert_notmatch(pat .. stat, g:b)
- call assert_match(stat, g:b)
+ " Test that the message is not truncated
+ " it would insert '...' into the output.
+ call assert_match('^\s\+' .. stat, g:b)
unmap n

" Clean up


Mit freundlichen Grüßen
Christian
--
Das Werk sollte immer ein wenig schlauer sein als der Autor.
-- Vaclav Havel

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20190904062502.GO25942%40256bit.org.

No comments: