Re: Problem with gvim, latexsuite and japanese input

441 views
Skip to first unread message

Yukihiro Nakadaira

unread,
May 15, 2014, 1:17:42 PM5/15/14
to vim...@googlegroups.com, vim...@googlegroups.com
CC to vim_dev.

On Sun, Apr 27, 2014 at 4:29 PM, Alain Bertrand <ala...@free.fr> wrote:
Hello all,

I have encounter a serious bug which prevents me from using gvim to edit latexfile in japanese. (I am a beginner with latexsuite so I still need the menu to learn the shortcuts for latex elements).

Steps to reproduce the bug :

Use a linux box with ibus and mozc set up.
Launch gvim on a file with *.tex suffix.
start Japanese input. Anytime you press enter should transfer the characters currently typed in the gvim buffer. This not the case. No character is ever transfered. The following warning appears :
** (gvim:22533): WARNING **: Invalid change to preedit string, first=0 length=1 (orig length == 0)

Typing Japanese with a file ending in *txt in vim or gvim is OK.
Typing Japanese in a file ending in *tex in vim is mostly OK.

Where can I report this bug ?

 I don't see same warning, but I know why vim-latex doesn't work with
Japanese Input Method.

For example, to input Japanese letter "か" (U+304B), we need to type
"ka<Enter>".  To show pre-edit text, Vim inserts pre-edit text to the
buffer temporarily by generating key sequence like using feedkeys().

  Type "k" => "k" is inserted.
              (same as :call feedkeys("k"))
  Type "a" => "k" is deleted and "か" is inserted.
              (same as :call feedkeys("\<BS>か"))
  Type "<Enter>" => "か" (pre-edit text) is deleted and "か" (commit text) is inserted.
              (same as :call feedkeys("\<BS>か"))

Vim uses <BS> to delete pre-edit text.  And vim-latex have mapping for
<BS> like ":imap <BS> <C-R>=...<CR>".  That mapping is applied and Vim
reset Input Method context for mode change of <C-R>=.  Then we can not
input Japanese text.

I use attached patch for this problem.  It  makes Vim to use window to
show pre-edit text.  It means to use over-the-spot insted of on-the-spot.

--
Yukihiro Nakadaira - yukihiro....@gmail.com
im_overthespot.diff

lilydjwg

unread,
May 16, 2014, 5:00:13 AM5/16/14
to vim...@googlegroups.com, vim...@googlegroups.com
On Fri, May 16, 2014 at 02:17:42AM +0900, Yukihiro Nakadaira wrote:
>
> I don't see same warning, but I know why vim-latex doesn't work with
> Japanese Input Method.
>
> For example, to input Japanese letter "か" (U+304B), we need to type
> "ka<Enter>". To show pre-edit text, Vim inserts pre-edit text to the
> buffer temporarily by generating key sequence like using feedkeys().
>
> Type "k" => "k" is inserted.
> (same as :call feedkeys("k"))
> Type "a" => "k" is deleted and "か" is inserted.
> (same as :call feedkeys("\<BS>か"))
> Type "<Enter>" => "か" (pre-edit text) is deleted and "か" (commit text) is
> inserted.
> (same as :call feedkeys("\<BS>か"))
>
> Vim uses <BS> to delete pre-edit text. And vim-latex have mapping for
> <BS> like ":imap <BS> <C-R>=...<CR>". That mapping is applied and Vim
> reset Input Method context for mode change of <C-R>=. Then we can not
> input Japanese text.
>
> I use attached patch for this problem. It makes Vim to use window to
> show pre-edit text. It means to use over-the-spot insted of on-the-spot.

I also met this kind of problem with fcitx and Chinese input method. Now
I understand why :-) Recent versions of fcitx will not use that kind of
preediting for GVim by default for this reason.

--
Best regards,
lilydjwg

mattn

unread,
May 6, 2015, 10:13:25 AM5/6/15
to vim...@googlegroups.com, vim...@googlegroups.com
Bram, we multi-byte users want to fix. Most of users that uses input-method on gvim doesn't satisfied by current behavior.
So I hope to remove OnTheSpot. Or how about to add new option to change behavior OverTheSpot/OnTheSpot?

Bram Moolenaar

unread,
May 7, 2015, 8:01:30 AM5/7/15
to mattn, vim...@googlegroups.com, vim...@googlegroups.com
I do not use input methods myself. I would rather leave it to people
who do use it. Do please keep in mind that for different countries
different methods will be preferred. I hope this will not result in a
war!

--
The technology involved in making anything invisible is so infinitely
complex that nine hundred and ninety-nine billion, nine hundred and
ninety-nine million, nine hundred and ninety-nine thousand, nine hundred
and ninety-nine times out of a trillion it is much simpler and more
effective just to take the thing away and do without it.
-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"

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

mattn

unread,
May 7, 2015, 8:34:09 AM5/7/15
to vim...@googlegroups.com, vim...@googlegroups.com, matt...@gmail.com
On Thursday, May 7, 2015 at 9:01:30 PM UTC+9, Bram Moolenaar wrote:
> Yasuhiro Matsumoto wrote:
>
> > Bram, we multi-byte users want to fix. Most of users that uses
> > input-method on gvim doesn't satisfied by current behavior. So I hope
> > to remove OnTheSpot. Or how about to add new option to change behavior
> > OverTheSpot/OnTheSpot?
>
> I do not use input methods myself. I would rather leave it to people
> who do use it. Do please keep in mind that for different countries
> different methods will be preferred. I hope this will not result in a
> war!

In my personally thinking, we can add new option to:

* keep current behavior (default)
* implement OnTheSpot

I don't make sure, but I'm guessing, most of IM users don't satisfy by current behavior, as i said in above. If using fcitx, the preediting text is not displayed on screen since fcitx add "gvim" into blacklist to disable preediting.

https://github.com/fcitx/fcitx/pull/125/files

And, the preediting have critical bug that break key-mappings. Perhaps, if we remove OverTheSpot, most of users will not bother.

- mattn

Yasuhiro MATSUMOTO

unread,
May 7, 2015, 8:46:31 AM5/7/15
to vim...@googlegroups.com, vim...@googlegroups.com, matt...@gmail.com
sorry typo
Perhaps, if we remove OnTheSpot, most of users will not bother.
--
- Yasuhiro Matsumoto
Reply all
Reply to author
Forward
0 new messages