goldonly / conque

Automatically exported from code.google.com/p/conque
0 stars 0 forks source link

Proposing a mutibyte patch #56

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Thank you for developing great plugin.
I am expecting that the plugin will work with multi-byte asap.
Now, I am trying to help about that.
So, attached patch is my first hack that is to be able to input and output of 
multibyte string.

My strategies to support multibyte are;
1. Calculating columns of cursor shall be in bytewise.
2. To detect multibyte input via IME or something, monitoring CursorMoveI.

This patch is for conque_v2.1 and tested only on Mac terminal with;
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jun 18 2011 16:09:51)
MacOS X (unix) version
Included patches: 1-146
Normal version without GUI.  Features included (+) or not (-):
-arabic +autocmd -balloon_eval -browse +builtin_terms +byte_offset +cindent 
-clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments 
-conceal +cryptv -cscope +cursorbind +cursorshape +dialog_con +diff +digraphs 
-dnd -ebcdic -emacs_tags +eval +ex_extra +extra_search -farsi +file_in_path 
+find_in_path +float +folding -footer +fork() -gettext -hangul_input +iconv 
+insert_expand +jumplist -keymap -langmap +libcall +linebreak +lispindent 
+listcmds +localmap -lua +menu +mksession +modify_fname +mouse -mouseshape 
-mouse_dec -mouse_gpm -mouse_jsbterm -mouse_netterm -mouse_sysmouse 
+mouse_xterm +multi_byte +multi_lang -mzscheme +netbeans_intg -osfiletype 
+path_extra -perl +persistent_undo +postscript +printer -profile +python 
-python3 +quickfix +reltime -rightleft +ruby +scrollbind +signs +smartindent 
-sniff +startuptime +statusline -sun_workshop +syntax +tag_binary 
+tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title
 -toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo 
+vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp
 -xterm_clipboard -xterm_save 
   system vimrc file: "/opt/local/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/opt/local/share/vim"
Compilation: /usr/bin/gcc-4.2 -c -I. -Iproto -DHAVE_CONFIG_H   
-I/opt/local/include -DMACOS_X_UNIX -no-cpp-precomp  -pipe -O2 -arch x86_64 
-D_FORTIFY_SOURCE=1      
Linking: /usr/bin/gcc-4.2   -L. -L/opt/local/lib  -L/opt/local/lib -arch x86_64 
-o vim       -lm  -lncurses -liconv -framework Cocoa     
-L/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/conf
ig -lpython2.6 -framework CoreFoundation -u _PyMac_Error 
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/Python   -lruby 
-lobjc

Please ignore this, if you are already working about that.

Original issue reported on code.google.com by J.OKAD...@gmail.com on 7 Jul 2011 at 6:26

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks for the patch!

I'll look into it in the next week.

Original comment by nicora...@gmail.com on 7 Jul 2011 at 4:04

GoogleCodeExporter commented 8 years ago
Now a Mercurial (hg) repository of my hack is available.
https://tomesoft.net/hg/conque_hack/

Original comment by J.OKAD...@gmail.com on 11 Jul 2011 at 6:02

GoogleCodeExporter commented 8 years ago
Hi. How can I clone your conque_hack from the site you offered?

Original comment by xell....@gmail.com on 21 Jul 2011 at 6:19

GoogleCodeExporter commented 8 years ago
You can clone with following way, if you already installed Mercurial (hg);

$ hg clone https://tomesoft.net/hg/conque_hack conque_mb_hack

Please remember that this hack is just first hack.
This is not perfect thing at this time.

Original comment by J.OKAD...@gmail.com on 21 Jul 2011 at 8:34

GoogleCodeExporter commented 8 years ago
Hey tome,

Have you tried integrating this hack with the InsertCharPre event?

The event allows you to call a vim function right before any character is sent 
to Vim. It works with multi-byte characters. I added this to conque trunk, 
though I haven't done too much testing with it yet:

(autoload/conque_term.vim)

autocmd InsertCharPre <buffer> call conque_term#key_press()

function! conque_term#key_press()
    " send Unicode ordinal to python
    sil exe s:py . ' ' . b:ConqueTerm_Var . ".write_buffered_ord(" . char2nr(v:char) . ")"
    " remove character from Vim input queue
    sil let v:char = ''
endfunction

It seems like this should allow you to remove the cursor_moved insanity from 
your patch.

Original comment by nicora...@gmail.com on 21 Jul 2011 at 6:36

GoogleCodeExporter commented 8 years ago
Oh, forgot to mention... The InsertCharPre event is only available in Vim 
mercurial repo. It missed the 7.3 release by a few months. See 
http://www.vim.org/download.php

Original comment by nicora...@gmail.com on 21 Jul 2011 at 6:39