Roland Puntaier wrote:
> On 12/31/2015 6:22 PM, Bram Moolenaar (Vim Github Repository) wrote:
> >
> > No, the langmap and keymap options relate to the keyboard. Replaying a
> > register does not involve the keyboard. When replaying a register one
> > doesn't know where the characters came from, they might be typed or the
> > result of something else, e.g. a yank operation.
> >
> > > > I wonder how you managed to get characters into a register that
> > you want to
> > > > apply 'keymap' or 'langmap' to. This translation should have
> > already happened
> > > > when typing the characters.
> > >
> > > - do ":help russian"
> > > - use the keymap as described there
> > > - insert some russian text
> > > - record a macro @a that inserts some russian text
> > > - play the macor @a
> >
> > This is a bit vague... Perhaps the problem is that when recording into
> > a register the keymap/langmap is not applied, resulting in the wrong
> > characters in the register?
> >
> > I look at keymap/langmap as a low level operation, which is applied when
> > typing on the keyboard, before it goes to the rest of Vim, which is
> > unaware of this filtering.
> >
> > It's possible that this interferes with other things, such as terminal
> > codes and other mappings. It's quite complicated. Many changes in this
> > area are not backwards compatible and break someone's carefully tuned
> > setup. I have thought of re-implementing this, but haven't found the
> > time to dive into it.
> >
> Dear Bram,
>
> Of course a cleaner implementation would be desirable
> and that could store to a register after applying keymap.
> But as of now the typed chars are stored into the register before
> applying keymap,
> i.e.
>
> //getchar.c:2515
> if (keylen > typebuf.tb_maplen)
> gotchars(typebuf.tb_buf + typebuf.tb_off
> + typebuf.tb_maplen,
> keylen - typebuf.tb_maplen);
>
> is before
>
> //getchar.c:2610
> i = ins_typebuf(s, noremap,
>
> So my patch fits to the current implementation by applying the keymap to
> chars in the register.
> I also added tests for keymap. There haven't been any so far.
>
> Regarding applying langmap to ':'-CMDLINE
> I've found that only patch v7.4.773 had removed the langmap mapping from
> CMDLINE.
> For / and ? commands that is good. langmap shouldn't apply, because you
> want to find text.
> So it should be like for the insert mode, i.e keyboard layout should be
> used.
>
> But for :-commands, if langmap is intended to enable russians or greeks
> to use vim without the need to switch to an english keyboard layout,
> langmap should apply. Otherwise you cannot enter :q, :w, :e,... commands.
>
> To enter non-english letters in :-commands, e.g. for :s,
> one can first search via / or yank and then do ^R/ or ^R".
>
> So this pull request is a modification and not an undo of patch 773.
>
> langmap now also is a better opposite to keymap.
> keymap does not apply to :-commands, so langmap should.
>
> I adapted the tests for langmap to fit the changes.
>
> I have also updated the documentation to mention:
> - langmap applies to ':'-CMDLINE mode (new)
> - keymap applies to non-':'-CMDLINE mode (current)
>
>
> From my side pull request
>
> https://github.com/vim/vim/pull/543
>
> is ready now.
Sorry, but this is not the right solution.
Did you see the change that Christian Brabandt made, sent to the vim-dev
list on July 25 last year? This also indicates what is wrong: need to
apply langmap before checking for matching mappings.
So, what needs to be done is in vgetorpeek() to apply langmap to the
head of the typeahead buffer and put the result in a copy-buffer. Then
use this copy-buffer to check for mappings and otherwise get the
character from. Then gotchars() will record the characters after
applying langmap and replaying the register will work.
The calls to LANGMAP_ADJUST() in other places of the code have to be
removed.
This also fixes the problem with multi-byte characters that Christian
solved.
This is not easy, but we need to do this properly, otherwise we'll get a
sequence of slightly incompatible changes that is annoying for users.
--
BROTHER MAYNARD: Armaments Chapter Two Verses Nine to Twenty One.
ANOTHER MONK: And St. Attila raised his hand grenade up on high saying "O
Lord bless this thy hand grenade that with it thou mayest
blow thine enemies to tiny bits, in thy mercy. "and the Lord
did grin and people did feast upon the lambs and sloths and
carp and anchovies and orang-utans and breakfast cereals and
fruit bats and...
BROTHER MAYNARD: Skip a bit brother ...
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// Bram Moolenaar -- [email protected] -- 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 ///
--
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.