Using :g command in Ex mode using feedkeys() puts Vim in a weird mode

12 views
Skip to first unread message

Yegappan Lakshmanan

unread,
Feb 18, 2020, 12:35:13 PM2/18/20
to vim_dev
Hi,

The following commands put Vim in a weird mode:

new
call setline(1, ["foo"])
call feedkeys("Qg/foo/visual\<CR>", 'xt')

I noticed this when developing tests for the code in ex_docmd.c.
It looks like this is caused by the code in do_exedit().

- Yegappan

Bram Moolenaar

unread,
Feb 18, 2020, 3:33:44 PM2/18/20
to vim...@googlegroups.com, Yegappan Lakshmanan
Yes, that is a special mode from old Vi.
See above ":help complex-repeat".

Problem is that when there are no more characters vgetc() returns Esc,
but that doesn't return from main_loop(), thus it hangs.

--
You can't have everything. Where would you put it?
-- Steven Wright

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Yegappan Lakshmanan

unread,
Feb 19, 2020, 10:05:27 AM2/19/20
to Bram Moolenaar, vim_dev
Hi Bram,

On Tue, Feb 18, 2020 at 12:33 PM Bram Moolenaar <Br...@moolenaar.net> wrote:
>
> Yegappan wrote:
>
> > The following commands put Vim in a weird mode:
> >
> > new
> > call setline(1, ["foo"])
> > call feedkeys("Qg/foo/visual\<CR>", 'xt')
> >
> > I noticed this when developing tests for the code in ex_docmd.c.
> > It looks like this is caused by the code in do_exedit().
>
> Yes, that is a special mode from old Vi.
> See above ":help complex-repeat".
>
> Problem is that when there are no more characters vgetc() returns Esc,
> but that doesn't return from main_loop(), thus it hangs.
>

Thanks for the reference to the documentation and fixing the bug.
I have converted this into a test.

- Yegappan
Reply all
Reply to author
Forward
0 new messages