AI 144604: am: CL 144603 am: CL 144601 Update OpenWnn to the latest (for Japanese Googlers).
  Original author: dmiyakawa
  Merged from: //branches/cupcake/...
  Original author: android-build

Automated import of CL 144604
diff --git a/README.txt b/README.txt
index 4975e42..f629b4e 100644
--- a/README.txt
+++ b/README.txt
@@ -1,7 +1,7 @@
 -------------------------------------------------------------------------------
                             OpenWnn for Android README
 
-                                   Version 1.20
+                             Version 1.21-RC-20090403
                   
      (C) Copyright OMRON SOFTWARE Co., Ltd. 2008,2009 All Rights Reserved.
 -------------------------------------------------------------------------------
diff --git a/libs/Android.mk b/libs/Android.mk
index 72383a0..21ff42f 100644
--- a/libs/Android.mk
+++ b/libs/Android.mk
@@ -1,4 +1,3 @@
 LOCAL_PATH:= $(call my-dir)
 include $(CLEAR_VARS)
-LOCAL_MODULE_TAGS := eng 
 include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/res/values-ja/string.xml b/res/values-ja/string.xml
index 419b207..2f75fe5 100644
--- a/res/values-ja/string.xml
+++ b/res/values-ja/string.xml
@@ -99,13 +99,13 @@
 
   <!-- IME dependency -->
     <!-- OpenWnn English -->
-    <string name="openwnn_english_copyright">Ver.1.20\nオムロン ソフトウェア(株)</string>
+    <string name="openwnn_english_copyright">Ver.1.21-RC-20090403\nオムロン ソフトウェア(株)</string>
 
     <!-- OpenWnn Japanese -->
-    <string name="openwnn_japanese_copyright">Ver.1.20\nオムロン ソフトウェア(株)</string>
+    <string name="openwnn_japanese_copyright">Ver.1.21-RC-20090403\nオムロン ソフトウェア(株)</string>
 
     <!-- OpenWnn Chinese -->
-    <string name="openwnn_china_copyright">Ver.1.20\nオムロン ソフトウェア(株)</string>
+    <string name="openwnn_china_copyright">Ver.1.21-RC-20090403\nオムロン ソフトウェア(株)</string>
 
   <!-- Candidate Delete -->
       <string name="button_candidate_select">選 択</string>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index baf5d19..993dad8 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -115,20 +115,20 @@
 
   <!-- IME dependency -->
     <!-- OpenWnn English -->
-    <string name="openwnn_english_copyright">Ver.1.20\nOMRON SOFTWARE Co., Ltd.</string>
+    <string name="openwnn_english_copyright">Ver.1.21-RC-20090403\nOMRON SOFTWARE Co., Ltd.</string>
     <string name="openwnn_english">OpenWnn English</string>
     <string name="openwnn_english_system_dictionary">/data/data/jp.co.omronsoft.openwnn/lib/libWnnEngDic.so</string>
     <string name="openwnn_english_writable_dictionary">/data/data/jp.co.omronsoft.openwnn/writableEN.dic</string>
     <string name="en_word_separators">.,;:!?</string>
 
     <!-- OpenWnn Japanese -->
-    <string name="openwnn_japanese_copyright">Ver.1.20\nOMRON SOFTWARE Co., Ltd.</string>
+    <string name="openwnn_japanese_copyright">Ver.1.21-RC-20090403\nOMRON SOFTWARE Co., Ltd.</string>
     <string name="openwnn_japanese">OpenWnn Japanese</string>
     <string name="openwnn_japanese_system_dictionary">/data/data/jp.co.omronsoft.openwnn/lib/libWnnJpnDic.so</string>
     <string name="openwnn_japanese_writable_dictionary">/data/data/jp.co.omronsoft.openwnn/writableJAJP.dic</string>
 
     <!-- OpenWnn Chinese -->
-    <string name="openwnn_china_copyright">Ver.1.20\nOMRON SOFTWARE Co., Ltd.</string>
+    <string name="openwnn_china_copyright">Ver.1.21-RC-20090403\nOMRON SOFTWARE Co., Ltd.</string>
     <string name="openwnn_china">OpenWnn Chinese</string>
     <string name="openwnn_china_system_dictionary">/data/data/jp.co.omronsoft.openwnn/lib/libWnnZHCNDic.so</string>
 <!-- After Config Change -->
diff --git a/src/jp/co/omronsoft/openwnn/CandidateFilter.java b/src/jp/co/omronsoft/openwnn/CandidateFilter.java
index a3bac7c..f3dd55a 100644
--- a/src/jp/co/omronsoft/openwnn/CandidateFilter.java
+++ b/src/jp/co/omronsoft/openwnn/CandidateFilter.java
@@ -28,43 +28,43 @@
  */
 public class CandidateFilter {
     /** Filtering pattern (No filter) */
-	public static final int FILTER_NONE = 0x0;
+    public static final int FILTER_NONE = 0x0;
     /** Filtering pattern (Emoji filter) */
-	public static final int FILTER_EMOJI = 0x1;
+    public static final int FILTER_EMOJI = 0x1;
 
     /** Regular expression pattern for emoji */
     private static final Pattern PATTERN_EMOJI = Pattern.compile("[\uDBB8\uDBB9\uDBBA\uDBBB]");
 
     /** Current filter type */
-	private int mFilter = 0;
+    private int mFilter = 0;
 
-	/**
-	 * Set specified filter type.
-	 * 
-	 * @param filter	The filter type
-	 * @see jp.co.omronsoft.openwnn.CandidateFilter#FILTER_NONE
-	 * @see jp.co.omronsoft.openwnn.CandidateFilter#FILTER_EMOJI
-	 */
-	public void setFilter(int filter) {
-		mFilter = filter;
-	}
-	
-	/**
-	 * Checking whether a specified word is filtered.
-	 * 
-	 * @param word		A word
-	 * @return			{@code true} if the word is allowed; {@code false} if the word is denied.
-	 */
-	public boolean isAllowed(WnnWord word) {
-		if (mFilter == 0) {
-			return true;
-		}
-		if ((mFilter & FILTER_EMOJI) != 0) {
-			Matcher m = PATTERN_EMOJI.matcher(word.candidate);
-			if (m.matches()) {
-				return false;
-			}
-		}		
-		return true;
-	}
+    /**
+     * Set specified filter type.
+     * 
+     * @param filter    The filter type
+     * @see jp.co.omronsoft.openwnn.CandidateFilter#FILTER_NONE
+     * @see jp.co.omronsoft.openwnn.CandidateFilter#FILTER_EMOJI
+     */
+    public void setFilter(int filter) {
+        mFilter = filter;
+    }
+    
+    /**
+     * Checking whether a specified word is filtered.
+     * 
+     * @param word      A word
+     * @return          {@code true} if the word is allowed; {@code false} if the word is denied.
+     */
+    public boolean isAllowed(WnnWord word) {
+        if (mFilter == 0) {
+            return true;
+        }
+        if ((mFilter & FILTER_EMOJI) != 0) {
+            Matcher m = PATTERN_EMOJI.matcher(word.candidate);
+            if (m.matches()) {
+                return false;
+            }
+        }       
+        return true;
+    }
 }
diff --git a/src/jp/co/omronsoft/openwnn/ComposingText.java b/src/jp/co/omronsoft/openwnn/ComposingText.java
index dbf26f5..328efb5 100644
--- a/src/jp/co/omronsoft/openwnn/ComposingText.java
+++ b/src/jp/co/omronsoft/openwnn/ComposingText.java
@@ -93,10 +93,10 @@
     /**
      * Get a {@link StrSegment} at the position specified.
      *
-     * @param layer		Layer
-     * @param pos 		Position (<0 : the tail segment)
+     * @param layer     Layer
+     * @param pos       Position (<0 : the tail segment)
      *
-     * @return			The segment; {@code null} if error occurs.
+     * @return          The segment; {@code null} if error occurs.
      */
     public StrSegment getStrSegment(int layer, int pos) {
         try {
@@ -116,10 +116,10 @@
     /**
      * Convert the range of segments to a string.
      *
-     * @param layer		Layer
-     * @param from		Convert range from
-     * @param to		Convert range to
-     * @return			The string converted; {@code null} if error occurs.
+     * @param layer     Layer
+     * @param from      Convert range from
+     * @param to        Convert range to
+     * @return          The string converted; {@code null} if error occurs.
      */
     public String toString(int layer, int from, int to) {
         try {
@@ -139,8 +139,8 @@
     /**
      * Convert segments of the layer to a string.
      *
-     * @param layer		Layer
-     * @return			The string converted; {@code null} if error occurs.
+     * @param layer     Layer
+     * @return          The string converted; {@code null} if error occurs.
      */
     public String toString(int layer) {
         return this.toString(layer, 0, mStringLayer[layer].size() - 1);
@@ -149,10 +149,10 @@
     /**
      * Update the upper layer's data.
      *
-     * @param layer			The base layer
-     * @param mod_from		Modified from
-     * @param mod_len		Length after modified (# of StrSegments from {@code mod_from})
-     * @param org_len		Length before modified (# of StrSegments from {@code mod_from})
+     * @param layer         The base layer
+     * @param mod_from      Modified from
+     * @param mod_len       Length after modified (# of StrSegments from {@code mod_from})
+     * @param org_len       Length before modified (# of StrSegments from {@code mod_from})
      */
     private void modifyUpper(int layer, int mod_from, int mod_len, int org_len) {
         if (layer >= MAX_LAYER - 1) {
@@ -272,9 +272,9 @@
     /**
      * Insert a {@link StrSegment} at the cursor position(without merging to the previous segment).
      * <p>
-     * @param layer1		Layer to insert
-     * @param layer2		Never merge to the previous segment from {@code layer1} to {@code layer2}.
-     * @param str   		String
+     * @param layer1        Layer to insert
+     * @param layer2        Never merge to the previous segment from {@code layer1} to {@code layer2}.
+     * @param str           String
      **/
     public void insertStrSegment(int layer1, int layer2, StrSegment str) {
         mStringLayer[layer1].add(mCursor[layer1], str);
@@ -300,10 +300,10 @@
     /**
      * Replace segments at the range specified.
      *
-     * @param layer		Layer
-     * @param str		String segment array to replace
-     * @param from		Replace from
-     * @param to		Replace to
+     * @param layer     Layer
+     * @param str       String segment array to replace
+     * @param from      Replace from
+     * @param to        Replace to
      **/
     protected void replaceStrSegment0(int layer, StrSegment[] str, int from, int to) {
         ArrayList<StrSegment> strLayer = mStringLayer[layer];
@@ -327,9 +327,9 @@
     /**
      * Replace segments at the range specified.
      *
-     * @param layer		Layer
-     * @param str		String segment array to replace
-     * @param num		Size of string segment array
+     * @param layer     Layer
+     * @param str       String segment array to replace
+     * @param num       Size of string segment array
      **/
     public void replaceStrSegment(int layer, StrSegment[] str, int num) {
         int cursor = mCursor[layer];
@@ -340,8 +340,8 @@
     /**
      * Replace the segment at the cursor.
      *
-     * @param layer 	Layer
-     * @param str   	String segment to replace
+     * @param layer     Layer
+     * @param str       String segment to replace
      **/
     public void replaceStrSegment(int layer, StrSegment[] str) {
         int cursor = mCursor[layer];
@@ -427,10 +427,10 @@
     /**
      * Delete segments (internal method).
      * 
-     * @param layer		Layer
-     * @param from		Delete from
-     * @param to		Delete to
-	 * @param diff		Differential
+     * @param layer     Layer
+     * @param from      Delete from
+     * @param to        Delete to
+     * @param diff      Differential
      **/
     private void deleteStrSegment0(int layer, int from, int to, int diff) {
         ArrayList<StrSegment> strLayer = mStringLayer[layer];
@@ -449,9 +449,9 @@
     /**
      * Delete a segment at the cursor.
      * 
-     * @param layer     	Layer
-     * @param rightside		{@code true} if direction is rightward at the cursor, {@code false} if direction is leftward at the cursor
-     * @return				The number of string segments in the specified layer
+     * @param layer         Layer
+     * @param rightside     {@code true} if direction is rightward at the cursor, {@code false} if direction is leftward at the cursor
+     * @return              The number of string segments in the specified layer
      **/
     public int delete(int layer, boolean rightside) {
         int cursor = mCursor[layer];
@@ -470,8 +470,8 @@
     /**
      * Get the string layer.
      *
-     * @param layer		Layer
-     * @return			{@link ArrayList} of {@link StrSegment}; {@code null} if error.
+     * @param layer     Layer
+     * @return          {@link ArrayList} of {@link StrSegment}; {@code null} if error.
      **/
     public ArrayList<StrSegment> getStringLayer(int layer) {
         try {
@@ -484,9 +484,9 @@
     /**
      * Get upper the segment which includes the position.
      * 
-     * @param layer		Layer	
-     * @param pos		Position		
-     * @return 		Index of upper segment
+     * @param layer     Layer   
+     * @param pos       Position        
+     * @return      Index of upper segment
      */
     private int included(int layer, int pos) {
         if (pos == 0) {
@@ -507,9 +507,9 @@
     /**
      * Set the cursor.
      * 
-     * @param layer		Layer
-     * @param pos   	Position of cursor
-     * @return 		New position of cursor
+     * @param layer     Layer
+     * @param pos       Position of cursor
+     * @return      New position of cursor
      */
     public int setCursor(int layer, int pos) {
         if (pos > mStringLayer[layer].size()) {
@@ -537,9 +537,9 @@
     /**
      * Move the cursor.
      *
-     * @param layer		Layer
-     * @param diff		Relative position from current cursor position
-     * @return 		New position of cursor
+     * @param layer     Layer
+     * @param diff      Relative position from current cursor position
+     * @return      New position of cursor
      **/
     public int moveCursor(int layer, int diff) {
         int c = mCursor[layer] + diff;
@@ -550,8 +550,8 @@
     /**
      * Get the cursor position.
      *
-     * @param layer		Layer
-     * @return cursor	Current position of cursor
+     * @param layer     Layer
+     * @return cursor   Current position of cursor
      **/
     public int getCursor(int layer) {
         return mCursor[layer];
@@ -560,8 +560,8 @@
     /**
      * Get the number of segments.
      *
-     * @param layer		Layer
-     * @return			Number of segments
+     * @param layer     Layer
+     * @return          Number of segments
      **/
     public int size(int layer) {
         return mStringLayer[layer].size();
diff --git a/src/jp/co/omronsoft/openwnn/DefaultSoftKeyboard.java b/src/jp/co/omronsoft/openwnn/DefaultSoftKeyboard.java
index 4da207c..9b72074 100644
--- a/src/jp/co/omronsoft/openwnn/DefaultSoftKeyboard.java
+++ b/src/jp/co/omronsoft/openwnn/DefaultSoftKeyboard.java
@@ -38,207 +38,209 @@
  * @author Copyright (C) 2009 OMRON SOFTWARE CO., LTD.  All Rights Reserved.
  */
 public class DefaultSoftKeyboard implements InputViewManager, KeyboardView.OnKeyboardActionListener {
-	/*
-	 *----------------------------------------------------------------------
-	 * key codes for a software keyboard
-	 *----------------------------------------------------------------------
-	 */
+    /*
+     *----------------------------------------------------------------------
+     * key codes for a software keyboard
+     *----------------------------------------------------------------------
+     */
     /** Change the keyboard language */
-	public static final int KEYCODE_CHANGE_LANG = -500;
+    public static final int KEYCODE_CHANGE_LANG = -500;
 
-	/* for Japanese 12-key keyboard */
-	/** Japanese 12-key keyboard [1] */
-	public static final int KEYCODE_JP12_1 = -201;
-	/** Japanese 12-key keyboard [2] */
-	public static final int KEYCODE_JP12_2 = -202;
-	/** Japanese 12-key keyboard [3] */
-	public static final int KEYCODE_JP12_3 = -203;
-	/** Japanese 12-key keyboard [4] */
-	public static final int KEYCODE_JP12_4 = -204;
-	/** Japanese 12-key keyboard [5] */
-	public static final int KEYCODE_JP12_5 = -205;
-	/** Japanese 12-key keyboard [6] */
-	public static final int KEYCODE_JP12_6 = -206;
-	/** Japanese 12-key keyboard [7] */
-	public static final int KEYCODE_JP12_7 = -207;
-	/** Japanese 12-key keyboard [8] */
-	public static final int KEYCODE_JP12_8 = -208;
-	/** Japanese 12-key keyboard [9] */
-	public static final int KEYCODE_JP12_9 = -209;
-	/** Japanese 12-key keyboard [0] */
-	public static final int KEYCODE_JP12_0 = -210;
-	/** Japanese 12-key keyboard [#] */
-	public static final int KEYCODE_JP12_SHARP = -211;
-	/** Japanese 12-key keyboard [*] */
-	public static final int KEYCODE_JP12_ASTER = -213;
-	/** Japanese 12-key keyboard [DEL] */
-	public static final int KEYCODE_JP12_BACKSPACE = -214;
-	/** Japanese 12-key keyboard [SPACE] */
-	public static final int KEYCODE_JP12_SPACE = -215;
-	/** Japanese 12-key keyboard [ENTER] */
-	public static final int KEYCODE_JP12_ENTER = -216;
-	/** Japanese 12-key keyboard [RIGHT ARROW] */
-	public static final int KEYCODE_JP12_RIGHT = -217;
-	/** Japanese 12-key keyboard [LEFT ARROW] */
-	public static final int KEYCODE_JP12_LEFT = -218;
-	/** Japanese 12-key keyboard [REVERSE TOGGLE] */
-	public static final int KEYCODE_JP12_REVERSE = -219;
-	/** Japanese 12-key keyboard [CLOSE] */
-	public static final int KEYCODE_JP12_CLOSE   = -220;
-	/** Japanese 12-key keyboard [KEYBOARD TYPE CHANGE] */
-	public static final int KEYCODE_JP12_KBD   = -221;
-	/** Japanese 12-key keyboard [EMOJI] */
-	public static final int KEYCODE_JP12_EMOJI      = -222;
-	/** Japanese 12-key keyboard [FULL-WIDTH HIRAGANA MODE] */
-	public static final int KEYCODE_JP12_ZEN_HIRA   = -223;
-	/** Japanese 12-key keyboard [FULL-WIDTH NUMBER MODE] */
-	public static final int KEYCODE_JP12_ZEN_NUM    = -224;
-	/** Japanese 12-key keyboard [FULL-WIDTH ALPHABET MODE] */
-	public static final int KEYCODE_JP12_ZEN_ALPHA  = -225;
-	/** Japanese 12-key keyboard [FULL-WIDTH KATAKANA MODE] */
-	public static final int KEYCODE_JP12_ZEN_KATA   = -226;
-	/** Japanese 12-key keyboard [HALF-WIDTH KATAKANA MODE] */
-	public static final int KEYCODE_JP12_HAN_KATA   = -227;
-	/** Japanese 12-key keyboard [HALF-WIDTH NUMBER MODE] */
-	public static final int KEYCODE_JP12_HAN_NUM    = -228;
-	/** Japanese 12-key keyboard [HALF-WIDTH ALPHABET MODE] */
-	public static final int KEYCODE_JP12_HAN_ALPHA  = -229;
-	/** Japanese 12-key keyboard [MODE TOOGLE CHANGE] */
-	public static final int KEYCODE_JP12_TOGGLE_MODE = -230;
-	
-	/* for Qwerty keyboard */
-	/** Qwerty keyboard [DEL] */
-	public static final int KEYCODE_QWERTY_BACKSPACE = -100;
-	/** Qwerty keyboard [ENTER] */
-	public static final int KEYCODE_QWERTY_ENTER = -101;
-	/** Qwerty keyboard [SHIFT] */
-	public static final int KEYCODE_QWERTY_SHIFT = Keyboard.KEYCODE_SHIFT;
-	/** Qwerty keyboard [ALT] */
-	public static final int KEYCODE_QWERTY_ALT   = -103;
-	/** Qwerty keyboard [KEYBOARD TYPE CHANGE] */
-	public static final int KEYCODE_QWERTY_KBD   = -104;
-	/** Qwerty keyboard [CLOSE] */
-	public static final int KEYCODE_QWERTY_CLOSE = -105;
-	/** Japanese Qwerty keyboard [EMOJI] */
-	public static final int KEYCODE_QWERTY_EMOJI = -106;
-	/** Japanese Qwerty keyboard [FULL-WIDTH HIRAGANA MODE] */
-	public static final int KEYCODE_QWERTY_ZEN_HIRA   = -107;
-	/** Japanese Qwerty keyboard [FULL-WIDTH NUMBER MODE] */
-	public static final int KEYCODE_QWERTY_ZEN_NUM    = -108;
-	/** Japanese Qwerty keyboard [FULL-WIDTH ALPHABET MODE] */
-	public static final int KEYCODE_QWERTY_ZEN_ALPHA  = -109;
-	/** Japanese Qwerty keyboard [FULL-WIDTH KATAKANA MODE] */
-	public static final int KEYCODE_QWERTY_ZEN_KATA   = -110;
-	/** Japanese Qwerty keyboard [HALF-WIDTH KATAKANA MODE] */
-	public static final int KEYCODE_QWERTY_HAN_KATA   = -111;
-	/** Qwerty keyboard [NUMBER MODE] */
-	public static final int KEYCODE_QWERTY_HAN_NUM    = -112;
-	/** Qwerty keyboard [ALPHABET MODE] */
-	public static final int KEYCODE_QWERTY_HAN_ALPHA  = -113;
-	/** Qwerty keyboard [MODE TOOGLE CHANGE] */
-	public static final int KEYCODE_QWERTY_TOGGLE_MODE = -114;
-	/** Qwerty keyboard [PINYIN MODE] */
-	public static final int KEYCODE_QWERTY_PINYIN  = -115;
-	
-	/** OpenWnn instance which hold this software keyboard*/
-	protected OpenWnn      mWnn;
-	
-	/** Current keyboard view */
-	protected KeyboardView mKeyboardView;
-	
-	/** View objects (main side) */
-	protected ViewGroup mMainView;
-	/** View objects (sub side) */
-	protected ViewGroup mSubView;
-	
-	/** Current keyboard definition */
-	protected Keyboard mCurrentKeyboard;
-	
+    /* for Japanese 12-key keyboard */
+    /** Japanese 12-key keyboard [1] */
+    public static final int KEYCODE_JP12_1 = -201;
+    /** Japanese 12-key keyboard [2] */
+    public static final int KEYCODE_JP12_2 = -202;
+    /** Japanese 12-key keyboard [3] */
+    public static final int KEYCODE_JP12_3 = -203;
+    /** Japanese 12-key keyboard [4] */
+    public static final int KEYCODE_JP12_4 = -204;
+    /** Japanese 12-key keyboard [5] */
+    public static final int KEYCODE_JP12_5 = -205;
+    /** Japanese 12-key keyboard [6] */
+    public static final int KEYCODE_JP12_6 = -206;
+    /** Japanese 12-key keyboard [7] */
+    public static final int KEYCODE_JP12_7 = -207;
+    /** Japanese 12-key keyboard [8] */
+    public static final int KEYCODE_JP12_8 = -208;
+    /** Japanese 12-key keyboard [9] */
+    public static final int KEYCODE_JP12_9 = -209;
+    /** Japanese 12-key keyboard [0] */
+    public static final int KEYCODE_JP12_0 = -210;
+    /** Japanese 12-key keyboard [#] */
+    public static final int KEYCODE_JP12_SHARP = -211;
+    /** Japanese 12-key keyboard [*] */
+    public static final int KEYCODE_JP12_ASTER = -213;
+    /** Japanese 12-key keyboard [DEL] */
+    public static final int KEYCODE_JP12_BACKSPACE = -214;
+    /** Japanese 12-key keyboard [SPACE] */
+    public static final int KEYCODE_JP12_SPACE = -215;
+    /** Japanese 12-key keyboard [ENTER] */
+    public static final int KEYCODE_JP12_ENTER = -216;
+    /** Japanese 12-key keyboard [RIGHT ARROW] */
+    public static final int KEYCODE_JP12_RIGHT = -217;
+    /** Japanese 12-key keyboard [LEFT ARROW] */
+    public static final int KEYCODE_JP12_LEFT = -218;
+    /** Japanese 12-key keyboard [REVERSE TOGGLE] */
+    public static final int KEYCODE_JP12_REVERSE = -219;
+    /** Japanese 12-key keyboard [CLOSE] */
+    public static final int KEYCODE_JP12_CLOSE   = -220;
+    /** Japanese 12-key keyboard [KEYBOARD TYPE CHANGE] */
+    public static final int KEYCODE_JP12_KBD   = -221;
+    /** Japanese 12-key keyboard [EMOJI] */
+    public static final int KEYCODE_JP12_EMOJI      = -222;
+    /** Japanese 12-key keyboard [FULL-WIDTH HIRAGANA MODE] */
+    public static final int KEYCODE_JP12_ZEN_HIRA   = -223;
+    /** Japanese 12-key keyboard [FULL-WIDTH NUMBER MODE] */
+    public static final int KEYCODE_JP12_ZEN_NUM    = -224;
+    /** Japanese 12-key keyboard [FULL-WIDTH ALPHABET MODE] */
+    public static final int KEYCODE_JP12_ZEN_ALPHA  = -225;
+    /** Japanese 12-key keyboard [FULL-WIDTH KATAKANA MODE] */
+    public static final int KEYCODE_JP12_ZEN_KATA   = -226;
+    /** Japanese 12-key keyboard [HALF-WIDTH KATAKANA MODE] */
+    public static final int KEYCODE_JP12_HAN_KATA   = -227;
+    /** Japanese 12-key keyboard [HALF-WIDTH NUMBER MODE] */
+    public static final int KEYCODE_JP12_HAN_NUM    = -228;
+    /** Japanese 12-key keyboard [HALF-WIDTH ALPHABET MODE] */
+    public static final int KEYCODE_JP12_HAN_ALPHA  = -229;
+    /** Japanese 12-key keyboard [MODE TOOGLE CHANGE] */
+    public static final int KEYCODE_JP12_TOGGLE_MODE = -230;
+    
+    /* for Qwerty keyboard */
+    /** Qwerty keyboard [DEL] */
+    public static final int KEYCODE_QWERTY_BACKSPACE = -100;
+    /** Qwerty keyboard [ENTER] */
+    public static final int KEYCODE_QWERTY_ENTER = -101;
+    /** Qwerty keyboard [SHIFT] */
+    public static final int KEYCODE_QWERTY_SHIFT = Keyboard.KEYCODE_SHIFT;
+    /** Qwerty keyboard [ALT] */
+    public static final int KEYCODE_QWERTY_ALT   = -103;
+    /** Qwerty keyboard [KEYBOARD TYPE CHANGE] */
+    public static final int KEYCODE_QWERTY_KBD   = -104;
+    /** Qwerty keyboard [CLOSE] */
+    public static final int KEYCODE_QWERTY_CLOSE = -105;
+    /** Japanese Qwerty keyboard [EMOJI] */
+    public static final int KEYCODE_QWERTY_EMOJI = -106;
+    /** Japanese Qwerty keyboard [FULL-WIDTH HIRAGANA MODE] */
+    public static final int KEYCODE_QWERTY_ZEN_HIRA   = -107;
+    /** Japanese Qwerty keyboard [FULL-WIDTH NUMBER MODE] */
+    public static final int KEYCODE_QWERTY_ZEN_NUM    = -108;
+    /** Japanese Qwerty keyboard [FULL-WIDTH ALPHABET MODE] */
+    public static final int KEYCODE_QWERTY_ZEN_ALPHA  = -109;
+    /** Japanese Qwerty keyboard [FULL-WIDTH KATAKANA MODE] */
+    public static final int KEYCODE_QWERTY_ZEN_KATA   = -110;
+    /** Japanese Qwerty keyboard [HALF-WIDTH KATAKANA MODE] */
+    public static final int KEYCODE_QWERTY_HAN_KATA   = -111;
+    /** Qwerty keyboard [NUMBER MODE] */
+    public static final int KEYCODE_QWERTY_HAN_NUM    = -112;
+    /** Qwerty keyboard [ALPHABET MODE] */
+    public static final int KEYCODE_QWERTY_HAN_ALPHA  = -113;
+    /** Qwerty keyboard [MODE TOOGLE CHANGE] */
+    public static final int KEYCODE_QWERTY_TOGGLE_MODE = -114;
+    /** Qwerty keyboard [PINYIN MODE] */
+    public static final int KEYCODE_QWERTY_PINYIN  = -115;
+    
+    /** OpenWnn instance which hold this software keyboard*/
+    protected OpenWnn      mWnn;
+    
+    /** Current keyboard view */
+    protected KeyboardView mKeyboardView;
+    
+    /** View objects (main side) */
+    protected ViewGroup mMainView;
+    /** View objects (sub side) */
+    protected ViewGroup mSubView;
+    
+    /** Current keyboard definition */
+    protected Keyboard mCurrentKeyboard;
+    
     /** Caps lock state */
-	protected boolean mCapsLock;
-	
-	/**
-	 * Keyboard surfaces 
-	 * <br>
-	 * Keyboard[language][portrait/landscape][keyboard type][shift off/on][key-mode]
-	 */
-	protected Keyboard[][][][][][] mKeyboard;
+    protected boolean mCapsLock;
+    
+    /** Input restraint */
+    protected boolean mDisableKeyInput = true;
+    /**
+     * Keyboard surfaces 
+     * <br>
+     * Keyboard[language][portrait/landscape][keyboard type][shift off/on][key-mode]
+     */
+    protected Keyboard[][][][][][] mKeyboard;
 
-	/* languages */
-	/** Current language */
-	protected int mCurrentLanguage;
-	/** Language (English) */
-	public static final int LANG_EN  = 0;
-	/** Language (Japanese) */
-	public static final int LANG_JA  = 1;
-	/** Language (Chinese) */
-	public static final int LANG_CN  = 2;
+    /* languages */
+    /** Current language */
+    protected int mCurrentLanguage;
+    /** Language (English) */
+    public static final int LANG_EN  = 0;
+    /** Language (Japanese) */
+    public static final int LANG_JA  = 1;
+    /** Language (Chinese) */
+    public static final int LANG_CN  = 2;
 
-	/* portrait/landscape */
-	/** State of the display */
-	protected int mDisplayMode = 0;
-	/** Display mode (Portrait) */
-	public static final int PORTRAIT  = 0;
-	/** Display mode (Landscape) */
-	public static final int LANDSCAPE = 1;
+    /* portrait/landscape */
+    /** State of the display */
+    protected int mDisplayMode = 0;
+    /** Display mode (Portrait) */
+    public static final int PORTRAIT  = 0;
+    /** Display mode (Landscape) */
+    public static final int LANDSCAPE = 1;
 
-	/* keyboard type */
-	/** Current keyboard type */
-	protected int mCurrentKeyboardType;
-	/** Keyboard (QWERTY keyboard) */
-	public static final int KEYBOARD_QWERTY  = 0;
-	/** Keyboard (12-keys keyboard) */
-	public static final int KEYBOARD_12KEY   = 1;
-	/** State of the shift key */
-	protected int mShiftOn = 0;
-	/** Shift key off */
-	public static final int KEYBOARD_SHIFT_OFF = 0;
-	/** Shift key on */
-	public static final int KEYBOARD_SHIFT_ON  = 1;
+    /* keyboard type */
+    /** Current keyboard type */
+    protected int mCurrentKeyboardType;
+    /** Keyboard (QWERTY keyboard) */
+    public static final int KEYBOARD_QWERTY  = 0;
+    /** Keyboard (12-keys keyboard) */
+    public static final int KEYBOARD_12KEY   = 1;
+    /** State of the shift key */
+    protected int mShiftOn = 0;
+    /** Shift key off */
+    public static final int KEYBOARD_SHIFT_OFF = 0;
+    /** Shift key on */
+    public static final int KEYBOARD_SHIFT_ON  = 1;
 
-	/* key-modes */
-	/** Current key-mode */
-	protected int mCurrentKeyMode;
+    /* key-modes */
+    /** Current key-mode */
+    protected int mCurrentKeyMode;
 
-	/* key-modes for English */
+    /* key-modes for English */
     /** English key-mode (alphabet) */
-	public static final int KEYMODE_EN_ALPHABET = 0;
+    public static final int KEYMODE_EN_ALPHABET = 0;
     /** English key-mode (number) */
-	public static final int KEYMODE_EN_NUMBER   = 1;
+    public static final int KEYMODE_EN_NUMBER   = 1;
     /** English key-mode (phone number) */
-	public static final int KEYMODE_EN_PHONE    = 2;
+    public static final int KEYMODE_EN_PHONE    = 2;
 
-	/* key-modes for Japanese */
+    /* key-modes for Japanese */
     /** Japanese key-mode (Full-width Hiragana) */
-	public static final int KEYMODE_JA_FULL_HIRAGANA = 0;
+    public static final int KEYMODE_JA_FULL_HIRAGANA = 0;
     /** Japanese key-mode (Full-width alphabet) */
-	public static final int KEYMODE_JA_FULL_ALPHABET = 1;
+    public static final int KEYMODE_JA_FULL_ALPHABET = 1;
     /** Japanese key-mode (Full-width number) */
-	public static final int KEYMODE_JA_FULL_NUMBER   = 2;
+    public static final int KEYMODE_JA_FULL_NUMBER   = 2;
     /** Japanese key-mode (Full-width Katakana) */
-	public static final int KEYMODE_JA_FULL_KATAKANA = 3;
+    public static final int KEYMODE_JA_FULL_KATAKANA = 3;
     /** Japanese key-mode (Half-width alphabet) */
-	public static final int KEYMODE_JA_HALF_ALPHABET = 4;
+    public static final int KEYMODE_JA_HALF_ALPHABET = 4;
     /** Japanese key-mode (Half-width number) */
-	public static final int KEYMODE_JA_HALF_NUMBER   = 5;
+    public static final int KEYMODE_JA_HALF_NUMBER   = 5;
     /** Japanese key-mode (Half-width Katakana) */
-	public static final int KEYMODE_JA_HALF_KATAKANA = 6;
+    public static final int KEYMODE_JA_HALF_KATAKANA = 6;
     /** Japanese key-mode (Half-width phone number) */
-	public static final int KEYMODE_JA_HALF_PHONE    = 7;
+    public static final int KEYMODE_JA_HALF_PHONE    = 7;
 
-	/* key-modes for Chinese */
+    /* key-modes for Chinese */
     /** Chinese key-mode (pinyin) */
-	public static final int KEYMODE_CN_PINYIN   = 0;
+    public static final int KEYMODE_CN_PINYIN   = 0;
     /** Chinese key-mode (Full-width number) */
-	public static final int KEYMODE_CN_FULL_NUMBER   = 1;
+    public static final int KEYMODE_CN_FULL_NUMBER   = 1;
     /** Chinese key-mode (alphabet) */
-	public static final int KEYMODE_CN_ALPHABET = 2;
+    public static final int KEYMODE_CN_ALPHABET = 2;
     /** Chinese key-mode (phone) */
-	public static final int KEYMODE_CN_PHONE    = 3;
+    public static final int KEYMODE_CN_PHONE    = 3;
     /** Chinese key-mode (Half-width number) */
-	public static final int KEYMODE_CN_HALF_NUMBER   = 4;
-	
-	/* key-modes for HARD */
+    public static final int KEYMODE_CN_HALF_NUMBER   = 4;
+    
+    /* key-modes for HARD */
     /** HARD key-mode (SHIFT_OFF_ALT_OFF) */
     public static final int HARD_KEYMODE_SHIFT_OFF_ALT_OFF     = 2;
     /** HARD key-mode (SHIFT_ON_ALT_OFF) */
@@ -247,7 +249,7 @@
     public static final int HARD_KEYMODE_SHIFT_OFF_ALT_ON      = 4;
     /** HARD key-mode (SHIFT_ON_ALT_ON) */
     public static final int HARD_KEYMODE_SHIFT_ON_ALT_ON       = 5;
-	/** HARD key-mode (SHIFT_LOCK_ALT_OFF) */
+    /** HARD key-mode (SHIFT_LOCK_ALT_OFF) */
     public static final int HARD_KEYMODE_SHIFT_LOCK_ALT_OFF    = 6;
     /** HARD key-mode (SHIFT_LOCK_ALT_ON) */
     public static final int HARD_KEYMODE_SHIFT_LOCK_ALT_ON     = 7;
@@ -261,26 +263,26 @@
     /** Whether the H/W keyboard is hidden. */
     protected boolean mHardKeyboardHidden = true;
 
-	/**
-	 * Status of the composing text
-	 * <br>
-	 * {@code true} if there is no composing text.
-	 */
-	protected boolean mNoInput = true;
-	
-	/** Vibratior for key click vibration */
-	protected Vibrator mVibrator = null;
-	
-	/** MediaPlayer for key click sound */
-	protected MediaPlayer mSound = null;
-	
-	/** Key toggle cycle table currently using */
-	protected String[] mCurrentCycleTable;
+    /**
+     * Status of the composing text
+     * <br>
+     * {@code true} if there is no composing text.
+     */
+    protected boolean mNoInput = true;
+    
+    /** Vibratior for key click vibration */
+    protected Vibrator mVibrator = null;
+    
+    /** MediaPlayer for key click sound */
+    protected MediaPlayer mSound = null;
+    
+    /** Key toggle cycle table currently using */
+    protected String[] mCurrentCycleTable;
 
-	/**
+    /**
      * Constructor
      */
-	public DefaultSoftKeyboard() { }
+    public DefaultSoftKeyboard() { }
 
     /**
      * Create keyboard views
@@ -298,8 +300,8 @@
     /**
      * Get the keyboard changed the specified shift state.
      *
-     * @param shift		Shift state
-     * @return			Keyboard view
+     * @param shift     Shift state
+     * @return          Keyboard view
      */
     protected Keyboard getShiftChangeKeyboard(int shift) {
         try {
@@ -317,8 +319,8 @@
     /**
      * Get the keyboard changed the specified input mode.
      *
-     * @param mode		Input mode
-     * @return			Keyboard view
+     * @param mode      Input mode
+     * @return          Keyboard view
      */
     protected Keyboard getModeChangeKeyboard(int mode) {
         try {
@@ -336,8 +338,8 @@
     /**
      * Get the keyboard changed the specified keyboard type
      *
-     * @param type		Keyboard type
-     * @return			Keyboard view
+     * @param type      Keyboard type
+     * @return          Keyboard view
      */
     protected Keyboard getTypeChangeKeyboard(int type) {
         try {
@@ -355,8 +357,8 @@
     /**
      * Get the keyboard when some characters are input or no character is input.
      *
-     * @param inputed	{@code true} if some characters are inputed; {@code false} if no character is inputed.
-     * @return			Keyboard view
+     * @param inputed   {@code true} if some characters are inputed; {@code false} if no character is inputed.
+     * @return          Keyboard view
      */
     protected Keyboard getKeyboardInputed(boolean inputed) {
         try {
@@ -527,11 +529,10 @@
         SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(parent);
         String skin = pref.getString("keyboard_skin",
                                      mWnn.getResources().getString(R.string.keyboard_skin_id_default));
-        Log.d("OpenWnn", "keyboard_skin="+skin);
         int id = parent.getResources().getIdentifier(skin, "layout", "jp.co.omronsoft.openwnn");
 
         mKeyboardView = (KeyboardView) mWnn.getLayoutInflater().inflate(id, null);
-		mKeyboardView.setOnKeyboardActionListener(this);
+        mKeyboardView.setOnKeyboardActionListener(this);
         mCurrentKeyboard = null;
 
         mMainView = (ViewGroup) parent.getLayoutInflater().inflate(R.layout.keyboard_default_main, null);
@@ -690,6 +691,7 @@
         if (mKeyboardView != null) {
             mKeyboardView.closing();
         }
+        mDisableKeyInput = true;
     }
 
     /***********************************************************************
@@ -755,6 +757,3 @@
     }
 
 }
-
-
-
diff --git a/src/jp/co/omronsoft/openwnn/InputViewManager.java b/src/jp/co/omronsoft/openwnn/InputViewManager.java
index 25bcdf4..f6e15ec 100644
--- a/src/jp/co/omronsoft/openwnn/InputViewManager.java
+++ b/src/jp/co/omronsoft/openwnn/InputViewManager.java
@@ -29,18 +29,18 @@
     /**
      * Initialize the input view.
      *
-     * @param parent   	The OpenWnn object
-     * @param width   	The width of the display
-     * @param height  	The height of the display
+     * @param parent    The OpenWnn object
+     * @param width     The width of the display
+     * @param height    The height of the display
      *
-     * @return 		The input view created in the initialize process; {@code null} if cannot create a input view.
+     * @return      The input view created in the initialize process; {@code null} if cannot create a input view.
      */
     public View initView(OpenWnn parent, int width, int height);
 
     /**
      * Get the input view being used currently.
      *
-     * @return 	The input view; {@code null} if no input view is used currently.
+     * @return  The input view; {@code null} if no input view is used currently.
      */
     public View getCurrentView();
 
diff --git a/src/jp/co/omronsoft/openwnn/JAJP/DefaultSoftKeyboardJAJP.java b/src/jp/co/omronsoft/openwnn/JAJP/DefaultSoftKeyboardJAJP.java
index 0181960..6941fda 100644
--- a/src/jp/co/omronsoft/openwnn/JAJP/DefaultSoftKeyboardJAJP.java
+++ b/src/jp/co/omronsoft/openwnn/JAJP/DefaultSoftKeyboardJAJP.java
@@ -459,6 +459,10 @@
     /** @see jp.co.omronsoft.openwnn.DefaultSoftKeyboard#onKey */
     @Override public void onKey(int primaryCode, int[] keyCodes) {
 
+        if (mDisableKeyInput) {
+            return;
+        }
+
         switch (primaryCode) {
         case KEYCODE_JP12_TOGGLE_MODE:
         case KEYCODE_QWERTY_TOGGLE_MODE:
@@ -667,6 +671,8 @@
         mEnableAutoCaps = pref.getBoolean("auto_caps", true);
         mFixedKeyMode = INVALID_KEYMODE;
         mPreferenceKeyMode = INVALID_KEYMODE;
+        mNoInput = true;
+        mDisableKeyInput = false;
 
         switch (inputType & EditorInfo.TYPE_MASK_CLASS) {
 
@@ -711,7 +717,9 @@
     /** @see jp.co.omronsoft.openwnn.DefaultSoftKeyboard#onUpdateState */
     @Override public void onUpdateState(OpenWnn parent) {
         super.onUpdateState(parent);
-        setShiftByEditorInfo();
+        if (!mCapsLock) {
+            setShiftByEditorInfo();
+        }
     }
 
     /**
diff --git a/src/jp/co/omronsoft/openwnn/LetterConverter.java b/src/jp/co/omronsoft/openwnn/LetterConverter.java
index 7d8aff2..adb6226 100644
--- a/src/jp/co/omronsoft/openwnn/LetterConverter.java
+++ b/src/jp/co/omronsoft/openwnn/LetterConverter.java
@@ -35,8 +35,8 @@
      * Romaji-to-Kana conversion in Japanese <it>(ex: "w"+"a" to "&#x308F;")</it>, 
      * Hangul conversion in Korean.
      *
-     * @param text  	The text data includes input sequence(layer #0) and output area(layer #1)
-     * @return 		{@code true} if conversion is completed; {@code false} if not.
+     * @param text      The text data includes input sequence(layer #0) and output area(layer #1)
+     * @return      {@code true} if conversion is completed; {@code false} if not.
      */
     public boolean convert(ComposingText text);
 
diff --git a/src/jp/co/omronsoft/openwnn/OpenWnn.java b/src/jp/co/omronsoft/openwnn/OpenWnn.java
index 01341ac..41795f6 100644
--- a/src/jp/co/omronsoft/openwnn/OpenWnn.java
+++ b/src/jp/co/omronsoft/openwnn/OpenWnn.java
@@ -199,7 +199,7 @@
      * Process an event.
      *
      * @param  ev  An event
-     * @return 	{@code true} if the event is processed in this method; {@code false} if not.
+     * @return  {@code true} if the event is processed in this method; {@code false} if not.
      */
     public boolean onEvent(OpenWnnEvent ev) {
         return false;
@@ -211,7 +211,7 @@
      * @param prevChar     The character input previous
      * @param toggleTable  Toggle table
      * @param reverse      {@code false} if toggle direction is forward, {@code true} if toggle direction is backward
-     * @return 			A character ({@code null} if no character is found)
+     * @return          A character ({@code null} if no character is found)
      */
     protected String searchToggleCharacter(String prevChar, String[] toggleTable, boolean reverse) {
         for (int i = 0; i < toggleTable.length; i++) {
@@ -236,6 +236,3 @@
         return null;
     }
 }
-
-
-
diff --git a/src/jp/co/omronsoft/openwnn/OpenWnnDictionaryImpl.java b/src/jp/co/omronsoft/openwnn/OpenWnnDictionaryImpl.java
index 3659fa3..6c8a464 100644
--- a/src/jp/co/omronsoft/openwnn/OpenWnnDictionaryImpl.java
+++ b/src/jp/co/omronsoft/openwnn/OpenWnnDictionaryImpl.java
@@ -30,26 +30,26 @@
  * @author Copyright (C) 2008, 2009 OMRON SOFTWARE CO., LTD.  All Rights Reserved.
  */
 public class OpenWnnDictionaryImpl implements WnnDictionary {
-	/*
-	 * DEFINITION FOR JNI
-	 */
-	static {
-		/* Load the dictionary search library */ 
-		System.loadLibrary( "wnndict" );
-	}
+    /*
+     * DEFINITION FOR JNI
+     */
+    static {
+        /* Load the dictionary search library */ 
+        System.loadLibrary( "wnndict" );
+    }
 
-	/*
-	 * DEFINITION OF CONSTANTS
-	 */
-	/** The maximum length of stroke */
+    /*
+     * DEFINITION OF CONSTANTS
+     */
+    /** The maximum length of stroke */
     public static final int MAX_STROKE_LENGTH       = 50;
-	/** The maximum length of candidate */
+    /** The maximum length of candidate */
     public static final int MAX_CANDIDATE_LENGTH    = 50;
-	/** The table name of writable dictionary on the database */
-	protected static final String TABLE_NAME_DIC    = "dic";
-	/** The type name of user word */
+    /** The table name of writable dictionary on the database */
+    protected static final String TABLE_NAME_DIC    = "dic";
+    /** The type name of user word */
     protected static final int TYPE_NAME_USER   = 0;
-	/** The type name of learn word */
+    /** The type name of learn word */
     protected static final int TYPE_NAME_LEARN  = 1;
 
     /** The column name of database */
@@ -105,10 +105,10 @@
 
     /*
      * Constants to define the upper limit of query.
-	 *
-	 * That is used to fix the size of query expression.
-	 * If the number of approximate patterns for a character is exceeded MAX_PATTERN_OF_APPROX,
-	 * increase that constant to the maximum number of patterns.
+     *
+     * That is used to fix the size of query expression.
+     * If the number of approximate patterns for a character is exceeded MAX_PATTERN_OF_APPROX,
+     * increase that constant to the maximum number of patterns.
      */
     /** Constants to define the upper limit of approximate patterns */
     protected final static int MAX_PATTERN_OF_APPROX    = 6;
@@ -117,23 +117,23 @@
     /**
      * Constants to define the turn around time of query.
      * <br>
-	 * It can be set between 1 to {@code MAX_LENGTH_OF_QUERY}. If the length of query
-	 * string is shorter than {@code FAST_QUERY_LENGTH}, the simple search logic is applied.
-	 * Therefore, the turn around time for short query string is fast so that it is short.
-	 * However, the difference of turn around time at the border length grows big.
-	 * the value should be fixed carefully.
+     * It can be set between 1 to {@code MAX_LENGTH_OF_QUERY}. If the length of query
+     * string is shorter than {@code FAST_QUERY_LENGTH}, the simple search logic is applied.
+     * Therefore, the turn around time for short query string is fast so that it is short.
+     * However, the difference of turn around time at the border length grows big.
+     * the value should be fixed carefully.
      */
     protected final static int FAST_QUERY_LENGTH        = 20;
 
-	/*
-	 * DEFINITION OF PRIVATE FIELD
-	 */
-	/** Internal work area for the dictionary search library */
-	protected long mWnnWork = 0;
+    /*
+     * DEFINITION OF PRIVATE FIELD
+     */
+    /** Internal work area for the dictionary search library */
+    protected long mWnnWork = 0;
 
-	/** The file path of the writable dictionary */
+    /** The file path of the writable dictionary */
     protected String mDicFilePath = "";
-	/** The writable dictionary object */
+    /** The writable dictionary object */
     protected SQLiteDatabase mDbDic = null;
     /** The search cursor of the writable dictionary */
     protected SQLiteCursor mDbCursor = null;
@@ -177,31 +177,31 @@
     /** The Frequency offset of learn dictionary */
     protected int mFrequencyOffsetOfLearnDictionary = -1;
 
-	/*
-	 * DEFINITION OF METHODS
-	 */
-	/**
-	 * The constructor of this class without writable dictionary.
+    /*
+     * DEFINITION OF METHODS
+     */
+    /**
+     * The constructor of this class without writable dictionary.
      *
-	 * Create a internal work area for the search engine. It is allocated for each object.
-	 *
-	 * @param dicLibPath	The dictionary library file path
-	 */
-	public OpenWnnDictionaryImpl( String dicLibPath ) {
+     * Create a internal work area for the search engine. It is allocated for each object.
+     *
+     * @param dicLibPath    The dictionary library file path
+     */
+    public OpenWnnDictionaryImpl( String dicLibPath ) {
         this( dicLibPath, null );
-	}
+    }
 
-	/**
-	 * The constructor of this class with writable dictionary.
+    /**
+     * The constructor of this class with writable dictionary.
      *
-	 * Create a internal work area and the writable dictionary for the search engine. It is allocated for each object.
-	 *
-	 * @param dicLibPath	The dictionary library file path
-     * @param dicFilePath	The path name of writable dictionary
-	 */
-	public OpenWnnDictionaryImpl( String dicLibPath, String dicFilePath ) {
+     * Create a internal work area and the writable dictionary for the search engine. It is allocated for each object.
+     *
+     * @param dicLibPath    The dictionary library file path
+     * @param dicFilePath   The path name of writable dictionary
+     */
+    public OpenWnnDictionaryImpl( String dicLibPath, String dicFilePath ) {
         /* Create the internal work area */
-		this.mWnnWork = OpenWnnDictionaryImplJni.createWnnWork( dicLibPath );
+        this.mWnnWork = OpenWnnDictionaryImplJni.createWnnWork( dicLibPath );
 
         if( this.mWnnWork != 0 && dicFilePath != null ) {
             /* Create query base strings */
@@ -264,33 +264,33 @@
 
 
             try {
-            	/* Create the database object */
+                /* Create the database object */
                 mDicFilePath = dicFilePath;
                 setInUseState( true );
 
-            	/* Create the table if not exist */
-            	createDictionaryTable( TABLE_NAME_DIC );
+                /* Create the table if not exist */
+                createDictionaryTable( TABLE_NAME_DIC );
             } catch( SQLException e ) {
             }
         }
-	}
+    }
 
-	/**
-	 * The finalizer of this class.
-	 * Destroy the internal work area for the search engine.
-	 */
-	protected void finalize( ) {
-		/* Free the internal work area */
-		if( this.mWnnWork != 0 ) {
-			OpenWnnDictionaryImplJni.freeWnnWork( this.mWnnWork );
-			this.mWnnWork = 0;
+    /**
+     * The finalizer of this class.
+     * Destroy the internal work area for the search engine.
+     */
+    protected void finalize( ) {
+        /* Free the internal work area */
+        if( this.mWnnWork != 0 ) {
+            OpenWnnDictionaryImplJni.freeWnnWork( this.mWnnWork );
+            this.mWnnWork = 0;
 
             freeDatabase();
-		}
-	}
+        }
+    }
 
-	/**
-	 * Create the table of writable dictionary.
+    /**
+     * Create the table of writable dictionary.
      *
      * @param tableName     The name of table
      */
@@ -312,103 +312,103 @@
         }
     }
 
-	/**
+    /**
      * Free the {@link SQLiteDatabase} of writable dictionary.
      */
     protected void freeDatabase( ) {
-		freeCursor();
+        freeCursor();
 
-		if( mDbDic != null ) {
+        if( mDbDic != null ) {
             /* The SQLiteDataBase object must close() before releasing. */
             mDbDic.close();
             mDbDic = null;
         }
     }
-	/**
+    /**
      * Free the {@link SQLiteCursor} of writable dictionary.
      */
     protected void freeCursor( ) {
-    	if( mDbCursor != null) {
+        if( mDbCursor != null) {
             /* The SQLiteCursor object must close() before releasing. */
-    		mDbCursor.close();
-    		mDbCursor = null;
+            mDbCursor.close();
+            mDbCursor = null;
 
             mTypeOfQuery = -1;
-    	}
+        }
     }
 
-	
-	/**
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#setInUseState
-	 */
-	public boolean isActive() {
-		return (this.mWnnWork != 0);
-	}
-	
-	/**
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#setInUseState
-	 */
+    
+    /**
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#setInUseState
+     */
+    public boolean isActive() {
+        return (this.mWnnWork != 0);
+    }
+    
+    /**
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#setInUseState
+     */
     public void setInUseState( boolean flag ) {
         if( flag ) {
             if( mDbDic == null ) {
-            	mDbDic = SQLiteDatabase.openOrCreateDatabase( mDicFilePath, null );
+                mDbDic = SQLiteDatabase.openOrCreateDatabase( mDicFilePath, null );
             }
         } else {
             freeDatabase();
         }
     }
 
-	/**
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#clearDictionary
-	 */
-	public int clearDictionary( ) {
-		if( this.mWnnWork != 0 ) {
+    /**
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#clearDictionary
+     */
+    public int clearDictionary( ) {
+        if( this.mWnnWork != 0 ) {
             mFrequencyOffsetOfUserDictionary  = -1;
             mFrequencyOffsetOfLearnDictionary = -1;
 
-			return OpenWnnDictionaryImplJni.clearDictionaryParameters( this.mWnnWork );
-		} else {
-			return -1;
-		}
-	}
+            return OpenWnnDictionaryImplJni.clearDictionaryParameters( this.mWnnWork );
+        } else {
+            return -1;
+        }
+    }
 
-	/**
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#setDictionary
-	 */
+    /**
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#setDictionary
+     */
     public int setDictionary(int index, int base, int high ) {
-		if( this.mWnnWork != 0 ) {
-			switch( index ) {
-			case WnnDictionary.INDEX_USER_DICTIONARY:
+        if( this.mWnnWork != 0 ) {
+            switch( index ) {
+            case WnnDictionary.INDEX_USER_DICTIONARY:
                 if( base < 0 || high < 0 || base > high
                     /* || base < OFFSET_FREQUENCY_OF_USER_DICTIONARY || high >= OFFSET_FREQUENCY_OF_LEARN_DICTIONARY */ ) {
                     mFrequencyOffsetOfUserDictionary = -1;
                 } else {
                     mFrequencyOffsetOfUserDictionary = high;
                 }
-				return 0;
-			case WnnDictionary.INDEX_LEARN_DICTIONARY:
+                return 0;
+            case WnnDictionary.INDEX_LEARN_DICTIONARY:
                 if( base < 0 || high < 0 || base > high
                     /* || base < OFFSET_FREQUENCY_OF_LEARN_DICTIONARY */ ) {
                     mFrequencyOffsetOfLearnDictionary = -1;
                 } else {
                     mFrequencyOffsetOfLearnDictionary = high;
                 }
-				return 0;
-			default:
+                return 0;
+            default:
                 return OpenWnnDictionaryImplJni.setDictionaryParameter( this.mWnnWork, index, base, high );
-			}
-		} else {
-			return -1;
-		}
-	}
+            }
+        } else {
+            return -1;
+        }
+    }
 
     /**
      * Query to the database
      *
-     * @param keyString		The key string
+     * @param keyString     The key string
      * @param wnnWord      The previous word for link search
      * @param operation    The search operation
-     * @param order			The type of sort order
+     * @param order         The type of sort order
      */
     protected void createQuery( String keyString, WnnWord wnnWord, int operation, int order) {
         int newTypeOfQuery, maxBindsOfQuery;
@@ -422,45 +422,45 @@
         switch( operation ) {
         case WnnDictionary.SEARCH_EXACT:
             querySqlOrderByFreq = mExactQuerySqlOrderByFreq; 
-            querySqlOrderByKey	= mExactQuerySqlOrderByKey;
+            querySqlOrderByKey  = mExactQuerySqlOrderByKey;
             newTypeOfQuery      = 0;
-            queryArgs			= mExactQueryArgs;
+            queryArgs           = mExactQueryArgs;
 
             queryArgs[ 0 ]      = keyString;
             break;
 
         case WnnDictionary.SEARCH_PREFIX:
         case WnnDictionary.SEARCH_LINK:
-        	/* Select the suitable parameters for the query */
-        	if( keyString.length() <= FAST_QUERY_LENGTH ) {
+            /* Select the suitable parameters for the query */
+            if( keyString.length() <= FAST_QUERY_LENGTH ) {
                 if( wnnWord != null ) {
-            		querySqlOrderByFreq = mFastLinkQuerySqlOrderByFreq; 
-            		querySqlOrderByKey	= mFastLinkQuerySqlOrderByKey;
-            		newTypeOfQuery      = 1;
+                    querySqlOrderByFreq = mFastLinkQuerySqlOrderByFreq; 
+                    querySqlOrderByKey  = mFastLinkQuerySqlOrderByKey;
+                    newTypeOfQuery      = 1;
                 } else {
-            		querySqlOrderByFreq = mFastPrefixQuerySqlOrderByFreq; 
-            		querySqlOrderByKey	= mFastPrefixQuerySqlOrderByKey;
-            		newTypeOfQuery      = 2;
+                    querySqlOrderByFreq = mFastPrefixQuerySqlOrderByFreq; 
+                    querySqlOrderByKey  = mFastPrefixQuerySqlOrderByKey;
+                    newTypeOfQuery      = 2;
                 }
-        		maxBindsOfQuery		= FAST_QUERY_LENGTH;
-        		queryArgs			= mFastQueryArgs;
-        	} else {
+                maxBindsOfQuery     = FAST_QUERY_LENGTH;
+                queryArgs           = mFastQueryArgs;
+            } else {
                 if( wnnWord != null ) {
-            		querySqlOrderByFreq = mFullLinkQuerySqlOrderByFreq; 
-            		querySqlOrderByKey	= mFullLinkQuerySqlOrderByKey;
-            		newTypeOfQuery      = 3;
+                    querySqlOrderByFreq = mFullLinkQuerySqlOrderByFreq; 
+                    querySqlOrderByKey  = mFullLinkQuerySqlOrderByKey;
+                    newTypeOfQuery      = 3;
                 } else {
-            		querySqlOrderByFreq = mFullPrefixQuerySqlOrderByFreq; 
-            		querySqlOrderByKey	= mFullPrefixQuerySqlOrderByKey;
-            		newTypeOfQuery      = 4;
+                    querySqlOrderByFreq = mFullPrefixQuerySqlOrderByFreq; 
+                    querySqlOrderByKey  = mFullPrefixQuerySqlOrderByKey;
+                    newTypeOfQuery      = 4;
                 }
-        		maxBindsOfQuery		= MAX_LENGTH_OF_QUERY;
-        		queryArgs			= mFullQueryArgs;
-        	}
+                maxBindsOfQuery     = MAX_LENGTH_OF_QUERY;
+                queryArgs           = mFullQueryArgs;
+            }
 
             if( wnnWord != null ) {
                 /* If link search is enabled, insert information of the previous word */
-            	String[] queryArgsTemp = OpenWnnDictionaryImplJni.createBindArray( this.mWnnWork, keyString, maxBindsOfQuery, MAX_PATTERN_OF_APPROX );
+                String[] queryArgsTemp = OpenWnnDictionaryImplJni.createBindArray( this.mWnnWork, keyString, maxBindsOfQuery, MAX_PATTERN_OF_APPROX );
 
                 queryArgs = new String[ queryArgsTemp.length + 2 ];
                 for( int i = 0 ; i < queryArgsTemp.length ; i++ ) {
@@ -470,110 +470,110 @@
                 queryArgs[ 0 ] = wnnWord.stroke;
                 queryArgs[ 1 ] = wnnWord.candidate;
             } else {
-            	queryArgs = OpenWnnDictionaryImplJni.createBindArray( this.mWnnWork, keyString, maxBindsOfQuery, MAX_PATTERN_OF_APPROX );
+                queryArgs = OpenWnnDictionaryImplJni.createBindArray( this.mWnnWork, keyString, maxBindsOfQuery, MAX_PATTERN_OF_APPROX );
             }
             break;
 
         default:
-    		mCountCursor = 0;
+            mCountCursor = 0;
             freeCursor( );
             return;
         }
 
-    	/* Create the cursor and set arguments */
-		mCountCursor = 0;
+        /* Create the cursor and set arguments */
+        mCountCursor = 0;
 
-		if( mDbCursor == null || mTypeOfQuery != newTypeOfQuery ) {
-   			/* If the cursor is not exist or the type of query is changed, compile the query string and query words */
+        if( mDbCursor == null || mTypeOfQuery != newTypeOfQuery ) {
+            /* If the cursor is not exist or the type of query is changed, compile the query string and query words */
             freeCursor( );
 
             try {
-            	switch( order ) {
-            	case WnnDictionary.ORDER_BY_FREQUENCY:
-            		mDbCursor = ( SQLiteCursor )mDbDic.rawQuery( querySqlOrderByFreq, queryArgs );
-        			break;
-            	case WnnDictionary.ORDER_BY_KEY:
-            		mDbCursor = ( SQLiteCursor )mDbDic.rawQuery( querySqlOrderByKey, queryArgs );
-        			break;
-            	default:
-            		return;
-            	}
-        	} catch( SQLException e ) {
-        		return;
-        	}
+                switch( order ) {
+                case WnnDictionary.ORDER_BY_FREQUENCY:
+                    mDbCursor = ( SQLiteCursor )mDbDic.rawQuery( querySqlOrderByFreq, queryArgs );
+                    break;
+                case WnnDictionary.ORDER_BY_KEY:
+                    mDbCursor = ( SQLiteCursor )mDbDic.rawQuery( querySqlOrderByKey, queryArgs );
+                    break;
+                default:
+                    return;
+                }
+            } catch( SQLException e ) {
+                return;
+            }
 
-    		mTypeOfQuery = newTypeOfQuery;
-    	} else {
-    		/* If the cursor is exist, bind new arguments and re-query words (DO NOT recompile the query string) */
+            mTypeOfQuery = newTypeOfQuery;
+        } else {
+            /* If the cursor is exist, bind new arguments and re-query words (DO NOT recompile the query string) */
             try {
-        		mDbCursor.setSelectionArguments( queryArgs );
-        		mDbCursor.requery( );
-        	} catch( SQLException e ) {
-        		return;
-        	}
-    	}
-
-		if( mDbCursor != null ) {
-            /* If querying is succeed, count the number of words */
-			mCountCursor = mDbCursor.getCount();
-            if( mCountCursor == 0 ) {
-                /* If no word is retrieved, deactivate the cursor for reduce the resource */
-        		mDbCursor.deactivate( );
+                mDbCursor.setSelectionArguments( queryArgs );
+                mDbCursor.requery( );
+            } catch( SQLException e ) {
+                return;
             }
         }
 
-		return;
+        if( mDbCursor != null ) {
+            /* If querying is succeed, count the number of words */
+            mCountCursor = mDbCursor.getCount();
+            if( mCountCursor == 0 ) {
+                /* If no word is retrieved, deactivate the cursor for reduce the resource */
+                mDbCursor.deactivate( );
+            }
+        }
+
+        return;
     }
 
     /**
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#searchWord
-	 */
-	public int searchWord( int operation, int order, String keyString ) {
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#searchWord
+     */
+    public int searchWord( int operation, int order, String keyString ) {
         /* Unset the previous word information */
         OpenWnnDictionaryImplJni.clearResult( this.mWnnWork );
 
         /* Search to user/learn dictionary */
         if( mDbDic != null && ( mFrequencyOffsetOfUserDictionary  >= 0 ||
                                 mFrequencyOffsetOfLearnDictionary >= 0 ) ) {
-			try {
-    			if( keyString.length() > 0 ) {
-    				createQuery( keyString, null, operation, order );
-    				if( mDbCursor != null ) {
-        				mDbCursor.moveToFirst();
-    				}
-   				} else {
+            try {
+                if( keyString.length() > 0 ) {
+                    createQuery( keyString, null, operation, order );
+                    if( mDbCursor != null ) {
+                        mDbCursor.moveToFirst();
+                    }
+                } else {
                     /* If the key string is "", no word is retrieved */
                     if( mDbCursor != null ) {
                         mDbCursor.deactivate();
                     }
                     mCountCursor = 0;
-   				}
-			} catch( SQLException e ) {
+                }
+            } catch( SQLException e ) {
                 if( mDbCursor != null ) {
                     mDbCursor.deactivate();
                 }
                 mCountCursor = 0;
-	        }
+            }
         } else {
             mCountCursor = 0;
         }
 
         /* Search to fixed dictionary */
-		if( this.mWnnWork != 0 ) {
-			int ret = OpenWnnDictionaryImplJni.searchWord( this.mWnnWork, operation, order, keyString );
-			if (mCountCursor > 0) {
-				ret = 1;
-			}
-			return ret;
-		} else {
-			return -1;
-		}
-	}
+        if( this.mWnnWork != 0 ) {
+            int ret = OpenWnnDictionaryImplJni.searchWord( this.mWnnWork, operation, order, keyString );
+            if (mCountCursor > 0) {
+                ret = 1;
+            }
+            return ret;
+        } else {
+            return -1;
+        }
+    }
 
-	/**
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#searchWord
-	 */
-	public int searchWord( int operation, int order, String keyString, WnnWord wnnWord ) {
+    /**
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#searchWord
+     */
+    public int searchWord( int operation, int order, String keyString, WnnWord wnnWord ) {
         if( wnnWord == null || wnnWord.partOfSpeech == null ) {
             return -1;
         }
@@ -581,17 +581,17 @@
         /* Search to user/learn dictionary with link information */
         if( mDbDic != null && ( mFrequencyOffsetOfUserDictionary  >= 0 ||
                                 mFrequencyOffsetOfLearnDictionary >= 0 ) ) {
-			try {
-				createQuery( keyString, wnnWord, operation, order );
-				if( mDbCursor != null ) {
-    				mDbCursor.moveToFirst();
-				}
-			} catch( SQLException e ) {
+            try {
+                createQuery( keyString, wnnWord, operation, order );
+                if( mDbCursor != null ) {
+                    mDbCursor.moveToFirst();
+                }
+            } catch( SQLException e ) {
                 if( mDbCursor != null ) {
                     mDbCursor.deactivate();
                 }
                 mCountCursor = 0;
-	        }
+            }
         } else {
             mCountCursor = 0;
         }
@@ -604,33 +604,33 @@
         OpenWnnDictionaryImplJni.setRightPartOfSpeech( this.mWnnWork, wnnWord.partOfSpeech.right );
         OpenWnnDictionaryImplJni.selectWord( this.mWnnWork );
 
-		if( this.mWnnWork != 0 ) {
-			int ret = OpenWnnDictionaryImplJni.searchWord( this.mWnnWork, operation, order, keyString );
-			if (mCountCursor > 0) {
-				ret = 1;
-			}
-			return ret;
-		} else {
-			return -1;
-		}
-	}
+        if( this.mWnnWork != 0 ) {
+            int ret = OpenWnnDictionaryImplJni.searchWord( this.mWnnWork, operation, order, keyString );
+            if (mCountCursor > 0) {
+                ret = 1;
+            }
+            return ret;
+        } else {
+            return -1;
+        }
+    }
 
-	/**
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#getNextWord
-	 */
-	public WnnWord getNextWord( ) {
+    /**
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#getNextWord
+     */
+    public WnnWord getNextWord( ) {
         return getNextWord( 0 );
     }
 
-	/**
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#getNextWord
-	 */
-	public WnnWord getNextWord( int length ) {
-		if( this.mWnnWork != 0 ) {
+    /**
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#getNextWord
+     */
+    public WnnWord getNextWord( int length ) {
+        if( this.mWnnWork != 0 ) {
             if( mDbDic != null && mDbCursor != null && mCountCursor > 0 ) {
                 /* If the user/learn dictionary is queried, get the result from the user/learn dictionary */
-				WnnWord result = new WnnWord( );
-            	try {
+                WnnWord result = new WnnWord( );
+                try {
                     /* Skip results if that is not contained the type of search or length of stroke is not equal specified length */
                     while( mCountCursor > 0 &&
                            ( ( mFrequencyOffsetOfUserDictionary < 0  && mDbCursor.getInt( 4 ) == TYPE_NAME_USER      ) ||
@@ -642,8 +642,8 @@
 
                     if( mCountCursor > 0 ) {
                         /* Get the information of word */
-        				result.stroke		        = mDbCursor.getString( 0 );
-        				result.candidate	        = mDbCursor.getString( 1 );
+                        result.stroke               = mDbCursor.getString( 0 );
+                        result.candidate            = mDbCursor.getString( 1 );
                         result.partOfSpeech.left    = mDbCursor.getInt( 2 );
                         result.partOfSpeech.right   = mDbCursor.getInt( 3 );
 
@@ -663,46 +663,46 @@
                     } else {
                         /* if no result is found, terminate the searching of user/learn dictionary */
                         mDbCursor.deactivate();
-                		result = null;
+                        result = null;
                     }
-            	} catch( SQLException e ) {
+                } catch( SQLException e ) {
                     mDbCursor.deactivate();
                     mCountCursor = 0;
-            		result = null;
-            	}
+                    result = null;
+                }
             }
 
             /* Get the result from fixed dictionary */
-			int res = OpenWnnDictionaryImplJni.getNextWord( this.mWnnWork, length );
-			if( res > 0 ) {
-				WnnWord result = new WnnWord( );
+            int res = OpenWnnDictionaryImplJni.getNextWord( this.mWnnWork, length );
+            if( res > 0 ) {
+                WnnWord result = new WnnWord( );
                 if( result != null ) {
-    				result.stroke		        = OpenWnnDictionaryImplJni.getStroke( this.mWnnWork );
-    				result.candidate	        = OpenWnnDictionaryImplJni.getCandidate( this.mWnnWork );
-    				result.frequency	        = OpenWnnDictionaryImplJni.getFrequency( this.mWnnWork );
+                    result.stroke               = OpenWnnDictionaryImplJni.getStroke( this.mWnnWork );
+                    result.candidate            = OpenWnnDictionaryImplJni.getCandidate( this.mWnnWork );
+                    result.frequency            = OpenWnnDictionaryImplJni.getFrequency( this.mWnnWork );
                     result.partOfSpeech.left    = OpenWnnDictionaryImplJni.getLeftPartOfSpeech( this.mWnnWork );
                     result.partOfSpeech.right   = OpenWnnDictionaryImplJni.getRightPartOfSpeech( this.mWnnWork );
                 }
-				return result;
-			} else if ( res == 0 ) {
-				/* No result is found. */
-				return null;
-			} else {
-				/* An error occur (It is regarded as "No result is found".) */
-				return null;
-			}
-		} else {
-			return null;
-		}
-	}
+                return result;
+            } else if ( res == 0 ) {
+                /* No result is found. */
+                return null;
+            } else {
+                /* An error occur (It is regarded as "No result is found".) */
+                return null;
+            }
+        } else {
+            return null;
+        }
+    }
 
-	/**
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#getUserDictionaryWords
-	 */
+    /**
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#getUserDictionaryWords
+     */
     public WnnWord[] getUserDictionaryWords( ) {
-		if( this.mWnnWork != 0 && mDbDic != null ) {
+        if( this.mWnnWork != 0 && mDbDic != null ) {
             int numOfWords, i;
-    		SQLiteCursor cursor = null;
+            SQLiteCursor cursor = null;
 
             try {
                 /* Count all words in the user dictionary */
@@ -720,16 +720,16 @@
                     cursor.moveToFirst();
                     for( i = 0 ; i < numOfWords ; i++ ) {
                         words[ i ] = new WnnWord();
-        				words[ i ].stroke       = cursor.getString( 0 );
-        				words[ i ].candidate    = cursor.getString( 1 );
+                        words[ i ].stroke       = cursor.getString( 0 );
+                        words[ i ].candidate    = cursor.getString( 1 );
                         cursor.moveToNext();
                     }
 
                     return words;
                 }
             } catch( SQLException e ) {
-            	/* An error occurs */
-            	return null;
+                /* An error occurs */
+                return null;
             } finally {
                 if( cursor != null ) {
                     cursor.close( );
@@ -739,67 +739,67 @@
         return null;
     }
 
-	/**
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#clearApproxPattern
-	 */
-	public void clearApproxPattern( ) {
-		if( this.mWnnWork != 0 ) {
-			OpenWnnDictionaryImplJni.clearApproxPatterns( this.mWnnWork );
-		}
-	}
+    /**
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#clearApproxPattern
+     */
+    public void clearApproxPattern( ) {
+        if( this.mWnnWork != 0 ) {
+            OpenWnnDictionaryImplJni.clearApproxPatterns( this.mWnnWork );
+        }
+    }
 
-	/**
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#setApproxPattern
-	 */
-	public int setApproxPattern( String src, String dst ) {
-		if( this.mWnnWork != 0 ) {
-			return OpenWnnDictionaryImplJni.setApproxPattern( this.mWnnWork, src, dst );
-		} else {
-			return -1;
-		}
-	}
+    /**
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#setApproxPattern
+     */
+    public int setApproxPattern( String src, String dst ) {
+        if( this.mWnnWork != 0 ) {
+            return OpenWnnDictionaryImplJni.setApproxPattern( this.mWnnWork, src, dst );
+        } else {
+            return -1;
+        }
+    }
 
-	/**
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#setApproxPattern
-	 */
-	public int setApproxPattern( int approxPattern ) {
-		if( this.mWnnWork != 0 ) {
-			return OpenWnnDictionaryImplJni.setApproxPattern( this.mWnnWork, approxPattern );
-		} else {
-			return -1;
-		}
-	}
+    /**
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#setApproxPattern
+     */
+    public int setApproxPattern( int approxPattern ) {
+        if( this.mWnnWork != 0 ) {
+            return OpenWnnDictionaryImplJni.setApproxPattern( this.mWnnWork, approxPattern );
+        } else {
+            return -1;
+        }
+    }
 
-	/**
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#getConnectMatrix
-	 */
+    /**
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#getConnectMatrix
+     */
     public byte[][] getConnectMatrix( ) {
         byte[][]    result;
         int         lcount, i;
 
         if (this.mWnnWork != 0) {
-        	/* 1-origin */
-        	lcount = OpenWnnDictionaryImplJni.getNumberOfLeftPOS( this.mWnnWork );
-        	result = new byte[ lcount + 1 ][ ];
+            /* 1-origin */
+            lcount = OpenWnnDictionaryImplJni.getNumberOfLeftPOS( this.mWnnWork );
+            result = new byte[ lcount + 1 ][ ];
 
-        	if( result != null ) {
-        		for( i = 0 ; i < lcount + 1 ; i++ ) {
-        			result[ i ] = OpenWnnDictionaryImplJni.getConnectArray( this.mWnnWork, i );
+            if( result != null ) {
+                for( i = 0 ; i < lcount + 1 ; i++ ) {
+                    result[ i ] = OpenWnnDictionaryImplJni.getConnectArray( this.mWnnWork, i );
 
-        			if( result[ i ] == null ) {
-        				return null;
-        			}
-        		}
-        	}
+                    if( result[ i ] == null ) {
+                        return null;
+                    }
+                }
+            }
         } else {
-        	result = new byte[1][1];
+            result = new byte[1][1];
         }
         return result;
     }
 
-	/**
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#getPOS
-	 */
+    /**
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#getPOS
+     */
     public WnnPOS getPOS( int type ) {
         WnnPOS result = new WnnPOS( );
 
@@ -814,38 +814,38 @@
         return result;
     }
 
-	/**
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#clearUserDictionary
-	 */
+    /**
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#clearUserDictionary
+     */
     public int clearUserDictionary() {
         if( mDbDic != null ) {
-        	mDbDic.execSQL( String.format( "delete from %s where %s=%d", TABLE_NAME_DIC, COLUMN_NAME_TYPE, TYPE_NAME_USER ) );
+            mDbDic.execSQL( String.format( "delete from %s where %s=%d", TABLE_NAME_DIC, COLUMN_NAME_TYPE, TYPE_NAME_USER ) );
         }
 
         /* If no writable dictionary exists, no error occurs. */
         return 0;
     }
 
-	/**
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#clearLearnDictionary
-	 */
+    /**
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#clearLearnDictionary
+     */
     public int clearLearnDictionary() {
         if( mDbDic != null ) {
-        	mDbDic.execSQL( String.format( "delete from %s where %s=%d", TABLE_NAME_DIC, COLUMN_NAME_TYPE, TYPE_NAME_LEARN ) );
+            mDbDic.execSQL( String.format( "delete from %s where %s=%d", TABLE_NAME_DIC, COLUMN_NAME_TYPE, TYPE_NAME_LEARN ) );
         }
         
         /* If no writable dictionary exists, no error occurs. */
         return 0;
     }
 
-	/**
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#addWordToUserDictionary
-	 */
+    /**
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#addWordToUserDictionary
+     */
     public int addWordToUserDictionary( WnnWord[] word ) {
-		int result = 0;
+        int result = 0;
 
-		if( mDbDic != null ) {
-    		SQLiteCursor cursor;
+        if( mDbDic != null ) {
+            SQLiteCursor cursor;
 
             /* Count all words in the user dictionary */
             cursor = ( SQLiteCursor )mDbDic.query(
@@ -855,18 +855,18 @@
                 null, null, null, null);
 
             int count = cursor.getCount();
-           	cursor.close();
+            cursor.close();
 
             if( count + word.length > MAX_WORDS_IN_USER_DICTIONARY ) {
                 /* If user dictionary is full, an error occurs. */
                 return -1;
             } else {
-            	mDbDic.beginTransaction();
+                mDbDic.beginTransaction();
                 try {
                     StringBuilder strokeSQL    = new StringBuilder();
                     StringBuilder candidateSQL = new StringBuilder();
 
-                	for( int index = 0 ; index < word.length ; index++ ) {
+                    for( int index = 0 ; index < word.length ; index++ ) {
                         if( word[index].stroke.length()    > 0 && word[index].stroke.length()    <= MAX_STROKE_LENGTH &&
                             word[index].candidate.length() > 0 && word[index].candidate.length() <= MAX_CANDIDATE_LENGTH ) {
                             strokeSQL.setLength( 0 );
@@ -874,7 +874,7 @@
                             DatabaseUtils.appendEscapedSQLString( strokeSQL, word[index].stroke );
                             DatabaseUtils.appendEscapedSQLString( candidateSQL, word[index].candidate );
 
-    	                	cursor = ( SQLiteCursor )mDbDic.query(
+                            cursor = ( SQLiteCursor )mDbDic.query(
                                 TABLE_NAME_DIC,
                                 new String[] { COLUMN_NAME_ID },
                                 String.format( "%s=%d and %s=%s and %s=%s",
@@ -882,31 +882,31 @@
                                                COLUMN_NAME_STROKE, strokeSQL.toString(),
                                                COLUMN_NAME_CANDIDATE, candidateSQL.toString() ),
                                 null, null, null, null );
-    		
-    		                if( cursor.getCount() > 0 ) {
-    		                	/* if the specified word is exist, an error reported and skipped that word. */
-    		                	result = -2;
-    		                } else {
-    			            	ContentValues content = new ContentValues();
-    			
-    			                content.clear();
-    			                content.put( COLUMN_NAME_TYPE,      TYPE_NAME_USER );
-    			                content.put( COLUMN_NAME_STROKE,    word[index].stroke );
-    			                content.put( COLUMN_NAME_CANDIDATE, word[index].candidate );
-    			                content.put( COLUMN_NAME_POS_LEFT,  word[index].partOfSpeech.left );
-    			                content.put( COLUMN_NAME_POS_RIGHT, word[index].partOfSpeech.right );
-    		
-    		                    mDbDic.insert( TABLE_NAME_DIC, null, content );
-    		                }
+            
+                            if( cursor.getCount() > 0 ) {
+                                /* if the specified word is exist, an error reported and skipped that word. */
+                                result = -2;
+                            } else {
+                                ContentValues content = new ContentValues();
+                
+                                content.clear();
+                                content.put( COLUMN_NAME_TYPE,      TYPE_NAME_USER );
+                                content.put( COLUMN_NAME_STROKE,    word[index].stroke );
+                                content.put( COLUMN_NAME_CANDIDATE, word[index].candidate );
+                                content.put( COLUMN_NAME_POS_LEFT,  word[index].partOfSpeech.left );
+                                content.put( COLUMN_NAME_POS_RIGHT, word[index].partOfSpeech.right );
+            
+                                mDbDic.insert( TABLE_NAME_DIC, null, content );
+                            }
 
                             cursor.close( );
                             cursor = null;
                         }
-                	}
+                    }
                     mDbDic.setTransactionSuccessful();
                 } catch( SQLException e ) {
-                	/* An error occurs */
-                	return -1;
+                    /* An error occurs */
+                    return -1;
                 } finally {
                     mDbDic.endTransaction();
                     if( cursor != null ) {
@@ -920,28 +920,28 @@
         return result;
     }
 
-	/**
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#addWordToUserDictionary
-	 */
+    /**
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#addWordToUserDictionary
+     */
     public int addWordToUserDictionary( WnnWord word ) {
-    	WnnWord[] words = new WnnWord[1];
-    	words[0] = word;
+        WnnWord[] words = new WnnWord[1];
+        words[0] = word;
    
-    	return addWordToUserDictionary( words );
+        return addWordToUserDictionary( words );
     }
 
-	/**
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#removeWordFromUserDictionary
-	 */
+    /**
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#removeWordFromUserDictionary
+     */
     public int removeWordFromUserDictionary( WnnWord[] word ) {
-    	if( mDbDic != null ) {
-        	/* Remove the specified word */
-        	mDbDic.beginTransaction();
+        if( mDbDic != null ) {
+            /* Remove the specified word */
+            mDbDic.beginTransaction();
             try {
                 StringBuilder strokeSQL    = new StringBuilder();
                 StringBuilder candidateSQL = new StringBuilder();
 
-            	for( int index = 0 ; index < word.length ; index++ ) {
+                for( int index = 0 ; index < word.length ; index++ ) {
                     if( word[index].stroke.length()    > 0 && word[index].stroke.length()    <= MAX_STROKE_LENGTH &&
                         word[index].candidate.length() > 0 && word[index].candidate.length() <= MAX_CANDIDATE_LENGTH ) {
                         strokeSQL.setLength( 0 );
@@ -949,18 +949,18 @@
                         DatabaseUtils.appendEscapedSQLString( strokeSQL, word[index].stroke );
                         DatabaseUtils.appendEscapedSQLString( candidateSQL, word[index].candidate );
 
-    	            	mDbDic.delete( TABLE_NAME_DIC,
+                        mDbDic.delete( TABLE_NAME_DIC,
                             String.format( "%s=%d and %s=%s and %s=%s",
                                            COLUMN_NAME_TYPE, TYPE_NAME_USER,
                                            COLUMN_NAME_STROKE, strokeSQL,
                                            COLUMN_NAME_CANDIDATE, candidateSQL ),
                             null );
                     }
-            	}
-            	mDbDic.setTransactionSuccessful();
+                }
+                mDbDic.setTransactionSuccessful();
             } catch( SQLException e ) {
-            	/* An error occurs */
-            	return -1;
+                /* An error occurs */
+                return -1;
             } finally {
                 mDbDic.endTransaction();
             }
@@ -970,9 +970,9 @@
         return 0;
     }
 
-	/**
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#removeWordFromUserDictionary
-	 */
+    /**
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#removeWordFromUserDictionary
+     */
     public int removeWordFromUserDictionary( WnnWord word ) {
         WnnWord[] words = new WnnWord[1];
         words[0] = word;
@@ -980,9 +980,9 @@
         return removeWordFromUserDictionary( words );
     }
 
-	/**
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#learnWord
-	 */
+    /**
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#learnWord
+     */
     public int learnWord( WnnWord word ) {
         return learnWord( word, null );
     }
@@ -990,9 +990,9 @@
     /**
      * Learn the word with connection.
      * 
-     * @param word           	The word to learn
-     * @param previousWord   	The word which is selected previously.
-     * @return					0 if success; minus value if fail.
+     * @param word              The word to learn
+     * @param previousWord      The word which is selected previously.
+     * @return                  0 if success; minus value if fail.
      */
     public int learnWord( WnnWord word, WnnWord previousWord ) {
         if( mDbDic != null ) {
@@ -1016,7 +1016,7 @@
                 DatabaseUtils.appendEscapedSQLString( strokeSQL, word.stroke );
                 DatabaseUtils.appendEscapedSQLString( candidateSQL, word.candidate );
 
-            	SQLiteCursor cursor;
+                SQLiteCursor cursor;
 
                 /* If the words which have same stroke and same candidate is already learned, move to the tail */
                 cursor = ( SQLiteCursor )mDbDic.query(
@@ -1047,7 +1047,7 @@
 
                     boolean isExistConnectLearnData = false;
 
-                	mDbDic.beginTransaction();
+                    mDbDic.beginTransaction();
                     try {
                         do {
                             /* Record the ID that is removed later */
@@ -1092,7 +1092,7 @@
                         return -1;
                     } finally {
                         mDbDic.endTransaction();
-                    	cursor.close();
+                        cursor.close();
                     }
                 } else {
                     cursor.close();
@@ -1129,7 +1129,7 @@
                         return -1;
                     } finally {
                         mDbDic.endTransaction();
-                    	cursor.close();
+                        cursor.close();
                     }
                 } else {
                     cursor.close();
diff --git a/src/jp/co/omronsoft/openwnn/OpenWnnDictionaryImplJni.java b/src/jp/co/omronsoft/openwnn/OpenWnnDictionaryImplJni.java
index b813724..34d533f 100644
--- a/src/jp/co/omronsoft/openwnn/OpenWnnDictionaryImplJni.java
+++ b/src/jp/co/omronsoft/openwnn/OpenWnnDictionaryImplJni.java
@@ -22,398 +22,398 @@
  * @author Copyright (C) 2008, 2009 OMRON SOFTWARE CO., LTD.  All Rights Reserved.
  */
 public class OpenWnnDictionaryImplJni {
-	/*
-	 * DEFINITION OF CONSTANTS
-	 */
-	/**
-	 * Constant about the approximate pattern (for JNI native library)
+    /*
+     * DEFINITION OF CONSTANTS
+     */
+    /**
+     * Constant about the approximate pattern (for JNI native library)
      *
-   	 * @see jp.co.omronsoft.openwnn.WnnDictionary#APPROX_PATTERN_EN_TOUPPER
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#APPROX_PATTERN_EN_TOUPPER
      * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#setApproxPattern
-	 */
-	public static final int APPROX_PATTERN_EN_TOUPPER               = WnnDictionary.APPROX_PATTERN_EN_TOUPPER;
-	/**
-	 * Constant about the approximate pattern (for JNI native library)
+     */
+    public static final int APPROX_PATTERN_EN_TOUPPER               = WnnDictionary.APPROX_PATTERN_EN_TOUPPER;
+    /**
+     * Constant about the approximate pattern (for JNI native library)
      *
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#APPROX_PATTERN_EN_TOLOWER
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#APPROX_PATTERN_EN_TOLOWER
      * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#setApproxPattern
-	 */
-	public static final int APPROX_PATTERN_EN_TOLOWER               = WnnDictionary.APPROX_PATTERN_EN_TOLOWER;
-	/**
-	 * Constant about the approximate pattern (for JNI native library)
+     */
+    public static final int APPROX_PATTERN_EN_TOLOWER               = WnnDictionary.APPROX_PATTERN_EN_TOLOWER;
+    /**
+     * Constant about the approximate pattern (for JNI native library)
      *
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#APPROX_PATTERN_EN_QWERTY_NEAR
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#APPROX_PATTERN_EN_QWERTY_NEAR
      * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#setApproxPattern
-	 */
-	public static final int APPROX_PATTERN_EN_QWERTY_NEAR           = WnnDictionary.APPROX_PATTERN_EN_QWERTY_NEAR;
-	/**
-	 * Constant about the approximate pattern (for JNI native library)
+     */
+    public static final int APPROX_PATTERN_EN_QWERTY_NEAR           = WnnDictionary.APPROX_PATTERN_EN_QWERTY_NEAR;
+    /**
+     * Constant about the approximate pattern (for JNI native library)
      *
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#APPROX_PATTERN_EN_QWERTY_NEAR_UPPER
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#APPROX_PATTERN_EN_QWERTY_NEAR_UPPER
      * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#setApproxPattern
-	 */
-	public static final int APPROX_PATTERN_EN_QWERTY_NEAR_UPPER     = WnnDictionary.APPROX_PATTERN_EN_QWERTY_NEAR_UPPER;
-	/**
-	 * Constant about the approximate pattern (for JNI native library)
+     */
+    public static final int APPROX_PATTERN_EN_QWERTY_NEAR_UPPER     = WnnDictionary.APPROX_PATTERN_EN_QWERTY_NEAR_UPPER;
+    /**
+     * Constant about the approximate pattern (for JNI native library)
      *
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#APPROX_PATTERN_JAJP_12KEY_NORMAL
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#APPROX_PATTERN_JAJP_12KEY_NORMAL
      * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#setApproxPattern
-	 */
-	public static final int APPROX_PATTERN_JAJP_12KEY_NORMAL        = WnnDictionary.APPROX_PATTERN_JAJP_12KEY_NORMAL;
+     */
+    public static final int APPROX_PATTERN_JAJP_12KEY_NORMAL        = WnnDictionary.APPROX_PATTERN_JAJP_12KEY_NORMAL;
 
-	/**
-	 * Constant about the search operation (for JNI native library)
+    /**
+     * Constant about the search operation (for JNI native library)
      *
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#SEARCH_EXACT
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#SEARCH_EXACT
      * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#searchWord
-	 */
-	public static final int SEARCH_EXACT                           = WnnDictionary.SEARCH_EXACT;
-	/**
-	 * Constant about the search operation (for JNI native library)
+     */
+    public static final int SEARCH_EXACT                           = WnnDictionary.SEARCH_EXACT;
+    /**
+     * Constant about the search operation (for JNI native library)
      *
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#SEARCH_PREFIX
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#SEARCH_PREFIX
      * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#searchWord
-	 */
-	public static final int SEARCH_PREFIX                          = WnnDictionary.SEARCH_PREFIX;
-	/**
-	 * Constant about the search operation (for JNI native library)
+     */
+    public static final int SEARCH_PREFIX                          = WnnDictionary.SEARCH_PREFIX;
+    /**
+     * Constant about the search operation (for JNI native library)
      *
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#SEARCH_LINK
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#SEARCH_LINK
      * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#searchWord
-	 */
-	public static final int SEARCH_LINK                            = WnnDictionary.SEARCH_LINK;
+     */
+    public static final int SEARCH_LINK                            = WnnDictionary.SEARCH_LINK;
 
-	/**
-	 * Constant about the sort order (for JNI native library)
+    /**
+     * Constant about the sort order (for JNI native library)
      *
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#ORDER_BY_FREQUENCY
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#ORDER_BY_FREQUENCY
      * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#searchWord
-	 */
-	public static final int ORDER_BY_FREQUENCY                     = WnnDictionary.ORDER_BY_FREQUENCY;
-	/**
-	 * Constant about the sort order (for JNI native library)
+     */
+    public static final int ORDER_BY_FREQUENCY                     = WnnDictionary.ORDER_BY_FREQUENCY;
+    /**
+     * Constant about the sort order (for JNI native library)
      *
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#ORDER_BY_KEY
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#ORDER_BY_KEY
      * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#searchWord
-	 */
-	public static final int ORDER_BY_KEY                           = WnnDictionary.ORDER_BY_KEY;
+     */
+    public static final int ORDER_BY_KEY                           = WnnDictionary.ORDER_BY_KEY;
 
-	/**
-	 * Type of a part of speech (for JNI native library)
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#POS_TYPE_V1
+    /**
+     * Type of a part of speech (for JNI native library)
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#POS_TYPE_V1
      * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#getLeftPartOfSpeechSpecifiedType
      * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#getRightPartOfSpeechSpecifiedType
-	 */
+     */
     public static final int POS_TYPE_V1                             = WnnDictionary.POS_TYPE_V1;
-	/**
-	 * Type of a part of speech (for JNI native library)
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#POS_TYPE_V2
+    /**
+     * Type of a part of speech (for JNI native library)
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#POS_TYPE_V2
      * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#getLeftPartOfSpeechSpecifiedType
      * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#getRightPartOfSpeechSpecifiedType
-	 */
+     */
     public static final int POS_TYPE_V2                             = WnnDictionary.POS_TYPE_V2;
-	/**
-	 * Type of a part of speech (for JNI native library)
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#POS_TYPE_V3
+    /**
+     * Type of a part of speech (for JNI native library)
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#POS_TYPE_V3
      * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#getLeftPartOfSpeechSpecifiedType
      * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#getRightPartOfSpeechSpecifiedType
-	 */
+     */
     public static final int POS_TYPE_V3                             = WnnDictionary.POS_TYPE_V3;
-	/**
-	 * Type of a part of speech (for JNI native library)
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#POS_TYPE_BUNTOU
+    /**
+     * Type of a part of speech (for JNI native library)
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#POS_TYPE_BUNTOU
      * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#getLeftPartOfSpeechSpecifiedType
      * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#getRightPartOfSpeechSpecifiedType
-	 */
+     */
     public static final int POS_TYPE_BUNTOU                         = WnnDictionary.POS_TYPE_BUNTOU;
-	/**
-	 * Type of a part of speech (for JNI native library)
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#POS_TYPE_TANKANJI
+    /**
+     * Type of a part of speech (for JNI native library)
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#POS_TYPE_TANKANJI
      * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#getLeftPartOfSpeechSpecifiedType
      * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#getRightPartOfSpeechSpecifiedType
-	 */
+     */
     public static final int POS_TYPE_TANKANJI                       = WnnDictionary.POS_TYPE_TANKANJI;
-	/**
-	 * Type of a part of speech (for JNI native library)
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#POS_TYPE_SUUJI
+    /**
+     * Type of a part of speech (for JNI native library)
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#POS_TYPE_SUUJI
      * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#getLeftPartOfSpeechSpecifiedType
      * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#getRightPartOfSpeechSpecifiedType
-	 */
+     */
     public static final int POS_TYPE_SUUJI                          = WnnDictionary.POS_TYPE_SUUJI;
-	/**
-	 * Type of a part of speech (for JNI native library)
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#POS_TYPE_MEISI
+    /**
+     * Type of a part of speech (for JNI native library)
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#POS_TYPE_MEISI
      * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#getLeftPartOfSpeechSpecifiedType
      * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#getRightPartOfSpeechSpecifiedType
-	 */
+     */
     public static final int POS_TYPE_MEISI                          = WnnDictionary.POS_TYPE_MEISI;
-	/**
-	 * Type of a part of speech (for JNI native library)
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#POS_TYPE_JINMEI
+    /**
+     * Type of a part of speech (for JNI native library)
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#POS_TYPE_JINMEI
      * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#getLeftPartOfSpeechSpecifiedType
      * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#getRightPartOfSpeechSpecifiedType
-	 */
+     */
     public static final int POS_TYPE_JINMEI                         = WnnDictionary.POS_TYPE_JINMEI;
-	/**
-	 * Type of a part of speech (for JNI native library)
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#POS_TYPE_CHIMEI
+    /**
+     * Type of a part of speech (for JNI native library)
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#POS_TYPE_CHIMEI
      * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#getLeftPartOfSpeechSpecifiedType
      * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#getRightPartOfSpeechSpecifiedType
-	 */
+     */
     public static final int POS_TYPE_CHIMEI                         = WnnDictionary.POS_TYPE_CHIMEI;
-	/**
-	 * Type of a part of speech (for JNI native library)
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#POS_TYPE_KIGOU
+    /**
+     * Type of a part of speech (for JNI native library)
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#POS_TYPE_KIGOU
      * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#getLeftPartOfSpeechSpecifiedType
      * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#getRightPartOfSpeechSpecifiedType
-	 */
+     */
     public static final int POS_TYPE_KIGOU                          = WnnDictionary.POS_TYPE_KIGOU;
 
     /*
      * METHODS
      */
-	/**
-	 * Create a internal work area. 
+    /**
+     * Create a internal work area. 
      * A internal work area is allocated dynamically, and the specified dictionary library is loaded.
      *
-	 * @param dicLibPath    The path of the dictionary library file
-	 * @return              The internal work area or null
-	 */
-	public static final native long createWnnWork( String dicLibPath );
+     * @param dicLibPath    The path of the dictionary library file
+     * @return              The internal work area or null
+     */
+    public static final native long createWnnWork( String dicLibPath );
 
-	/**
-	 * Free the internal work area.
+    /**
+     * Free the internal work area.
      * The specified work area and the loaded dictionary library is free.
      *
-	 * @param work      The internal work area
-	 * @return          0 if processing is successful; <0 if an error occur
-	 */
-	public static final native int freeWnnWork( long work );
+     * @param work      The internal work area
+     * @return          0 if processing is successful; <0 if an error occur
+     */
+    public static final native int freeWnnWork( long work );
 
-	/**
-	 * Clear all dictionary information.
+    /**
+     * Clear all dictionary information.
      *
      * @see jp.co.omronsoft.openwnn.WnnDictionary#clearDictionary
-	 * @param work      The internal work area
-	 * @return          0 if processing is successful; <0 if an error occur
-	 */
-	public static final native int clearDictionaryParameters( long work );
+     * @param work      The internal work area
+     * @return          0 if processing is successful; <0 if an error occur
+     */
+    public static final native int clearDictionaryParameters( long work );
 
-	/**
-	 * Set a dictionary information.
+    /**
+     * Set a dictionary information.
      *
      * @see jp.co.omronsoft.openwnn.WnnDictionary#setDictionary
-	 * @param work      The internal work area
-	 * @param index     The index of dictionary
-	 * @param base      The base frequency or -1
-	 * @param high      The maximum frequency or -1
-	 * @return			 0 if processing is successful; <0 otherwise
-	 */
-	public static final native int setDictionaryParameter( long work, int index, int base, int high );
+     * @param work      The internal work area
+     * @param index     The index of dictionary
+     * @param base      The base frequency or -1
+     * @param high      The maximum frequency or -1
+     * @return           0 if processing is successful; <0 otherwise
+     */
+    public static final native int setDictionaryParameter( long work, int index, int base, int high );
 
-	/**
-	 * Search a word from dictionaries.
+    /**
+     * Search a word from dictionaries.
      *
      * @see jp.co.omronsoft.openwnn.WnnDictionary#searchWord
-	 * @param work          The internal work area
-	 * @param operation     The search operation (see "Constant about the search operation")
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#SEARCH_EXACT
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#SEARCH_PREFIX
-	 * @param order         The sort order (see "Constant about the sort order")
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#ORDER_BY_FREQUENCY
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#ORDER_BY_KEY
-	 * @param keyString     The key string
-	 * @return              0 if no result is found; 1 if a result is found; <0 if an error occur
-	 *
-	 */
-	public static final native int searchWord(long work, int operation, int order, String keyString );
+     * @param work          The internal work area
+     * @param operation     The search operation (see "Constant about the search operation")
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#SEARCH_EXACT
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#SEARCH_PREFIX
+     * @param order         The sort order (see "Constant about the sort order")
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#ORDER_BY_FREQUENCY
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#ORDER_BY_KEY
+     * @param keyString     The key string
+     * @return              0 if no result is found; 1 if a result is found; <0 if an error occur
+     *
+     */
+    public static final native int searchWord(long work, int operation, int order, String keyString );
 
-	/**
-	 * Retrieve a word information.
+    /**
+     * Retrieve a word information.
      * A word information is stored to the internal work area. To retrieve a detail information,
      * use {@code getStroke()}, {@code getCandidate()}, {@code getFreqeuency(),} or other {@code get...()} method.
      *
      * @see jp.co.omronsoft.openwnn.WnnDictionary#getNextWord
-	 * @param work      The internal work area
+     * @param work      The internal work area
      * @param length    >0 if only the result of specified length is retrieved; 0 if no condition exist
-	 * @return          0 if no result is retrieved; >0 if a result is retrieved; <0 if an error occur
-	 */
-	public static final native int getNextWord( long work, int length );
+     * @return          0 if no result is retrieved; >0 if a result is retrieved; <0 if an error occur
+     */
+    public static final native int getNextWord( long work, int length );
 
-	/**
-	 * Retrieve the key string from the current word information.
+    /**
+     * Retrieve the key string from the current word information.
      *
-	 * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#getNextWord
-	 * @param work      The internal work area
-	 * @return          The Key string
-	 */
-	public static final native String getStroke( long work );
+     * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#getNextWord
+     * @param work      The internal work area
+     * @return          The Key string
+     */
+    public static final native String getStroke( long work );
 
-	/**
-	 * Retrieve the candidate string from the current word information.
+    /**
+     * Retrieve the candidate string from the current word information.
      *
-	 * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#getNextWord
-	 * @param work      The internal work area
-	 * @return          The candidate string
-	 */
-	public static final native String getCandidate( long work );
+     * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#getNextWord
+     * @param work      The internal work area
+     * @return          The candidate string
+     */
+    public static final native String getCandidate( long work );
 
-	/**
-	 * Retrieve the frequency from the current word information.
+    /**
+     * Retrieve the frequency from the current word information.
      *
-	 * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#getNextWord
-	 * @param work      The internal work area
-	 * @return          The frequency
-	 */
-	public static final native int getFrequency( long work );
+     * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#getNextWord
+     * @param work      The internal work area
+     * @return          The frequency
+     */
+    public static final native int getFrequency( long work );
 
-	/**
-	 * Retrieve the part of speech at left side from the current word information.
+    /**
+     * Retrieve the part of speech at left side from the current word information.
      *
-	 * @param work      The internal work area
-	 * @return          The part of speech
-	 */
-	public static final native int getLeftPartOfSpeech( long work );
+     * @param work      The internal work area
+     * @return          The part of speech
+     */
+    public static final native int getLeftPartOfSpeech( long work );
 
-	/**
-	 * Retrieve the part of speech at right side from the current word information.
+    /**
+     * Retrieve the part of speech at right side from the current word information.
      *
-	 * @param work      The internal work area
-	 * @return          The part of speech
-	 */
-	public static final native int getRightPartOfSpeech( long work );
+     * @param work      The internal work area
+     * @return          The part of speech
+     */
+    public static final native int getRightPartOfSpeech( long work );
 
-	/**
-	 * Clear approximate patterns.
+    /**
+     * Clear approximate patterns.
      *
      * @see jp.co.omronsoft.openwnn.WnnDictionary#clearApproxPattern
-	 * @param work      The internal work area.
-	 */
-	public static final native void clearApproxPatterns( long work );
+     * @param work      The internal work area.
+     */
+    public static final native void clearApproxPatterns( long work );
 
-	/**
-	 * Set a approximate pattern.
+    /**
+     * Set a approximate pattern.
      *
      * @see jp.co.omronsoft.openwnn.WnnDictionary#setApproxPattern
-	 * @param work      The internal work area
-	 * @param src       The string (before)
-	 * @param dst       The string (after)
-	 * @return          0 if processing is successful; <0 if an error occur
-	 */
-	public static final native int setApproxPattern( long work, String src, String dst );
+     * @param work      The internal work area
+     * @param src       The string (before)
+     * @param dst       The string (after)
+     * @return          0 if processing is successful; <0 if an error occur
+     */
+    public static final native int setApproxPattern( long work, String src, String dst );
 
-	/**
-	 * Set a predefined approximate pattern.
+    /**
+     * Set a predefined approximate pattern.
      *
      * @see jp.co.omronsoft.openwnn.WnnDictionary#setApproxPattern
-	 * @param work              The internal work area
-	 * @param approxPattern     The index of predefined approximate pattern (See "Constant about the approximate pattern")
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#APPROX_PATTERN_EN_TOUPPER
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#APPROX_PATTERN_EN_TOLOWER
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#APPROX_PATTERN_EN_QWERTY_NEAR
-	 * @see jp.co.omronsoft.openwnn.WnnDictionary#APPROX_PATTERN_EN_QWERTY_NEAR_UPPER
-	 * @return                  0 if processing is successful; <0 if an error occur
-	 */
-	public static final native int setApproxPattern( long work, int approxPattern );
+     * @param work              The internal work area
+     * @param approxPattern     The index of predefined approximate pattern (See "Constant about the approximate pattern")
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#APPROX_PATTERN_EN_TOUPPER
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#APPROX_PATTERN_EN_TOLOWER
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#APPROX_PATTERN_EN_QWERTY_NEAR
+     * @see jp.co.omronsoft.openwnn.WnnDictionary#APPROX_PATTERN_EN_QWERTY_NEAR_UPPER
+     * @return                  0 if processing is successful; <0 if an error occur
+     */
+    public static final native int setApproxPattern( long work, int approxPattern );
 
-	/**
-	 * Get the specified approximate pattern.
-	 * @param work		The internal work area
-	 * @param src		The string (before)
-	 * @return			The string array (after)
-	 */
-	public static final native String[] getApproxPattern( long work, String src );
-	
-	/**
-	 * Clear the current word information.
+    /**
+     * Get the specified approximate pattern.
+     * @param work      The internal work area
+     * @param src       The string (before)
+     * @return          The string array (after)
+     */
+    public static final native String[] getApproxPattern( long work, String src );
+    
+    /**
+     * Clear the current word information.
      *
-	 * @param work      The internal work area
-	 */
+     * @param work      The internal work area
+     */
     public static final native void clearResult( long work );
 
-	/**
-	 * Set the part of speech at left side to the current word information.
+    /**
+     * Set the part of speech at left side to the current word information.
      *
-	 * @param work          The internal work area
+     * @param work          The internal work area
      * @param partOfSpeech  The part of speech
-	 * @return              0 if processing is successful; <0 if an error occur
+     * @return              0 if processing is successful; <0 if an error occur
      *
-	 */
+     */
     public static final native int setLeftPartOfSpeech( long work, int partOfSpeech );
-	/**
-	 * Set the part of speech at right side to the current word information.
+    /**
+     * Set the part of speech at right side to the current word information.
      *
-	 * @param work          The internal work area
+     * @param work          The internal work area
      * @param partOfSpeech  The part of speech
-	 * @return              0 if processing is successful; <0 if an error occur
+     * @return              0 if processing is successful; <0 if an error occur
      *
-	 */
+     */
     public static final native int setRightPartOfSpeech( long work, int partOfSpeech );
 
-	/**
-	 * Set the key string to the current word information.
+    /**
+     * Set the key string to the current word information.
      *
-	 * @param work          The internal work area
+     * @param work          The internal work area
      * @param stroke        The key string
-	 * @return              0 if processing is successful; <0 if an error occur
+     * @return              0 if processing is successful; <0 if an error occur
      *
-	 */
+     */
     public static final native int setStroke( long work, String stroke );
-	/**
-	 * Set the candidate string to the current word information.
+    /**
+     * Set the candidate string to the current word information.
      *
-	 * @param work          The internal work area
+     * @param work          The internal work area
      * @param candidate     The candidate string
-	 * @return              0 if processing is successful; <0 if an error occur
+     * @return              0 if processing is successful; <0 if an error occur
      *
-	 */
+     */
     public static final native int setCandidate( long work, String candidate );
 
-	/**
-	 * Set the previous word information from the current word information.
+    /**
+     * Set the previous word information from the current word information.
      *
-	 * @param work          The internal work area
-	 * @return              0 if processing is successful; <0 if an error occur
-	 */
-	public static final native int selectWord( long work );
+     * @param work          The internal work area
+     * @return              0 if processing is successful; <0 if an error occur
+     */
+    public static final native int selectWord( long work );
 
-	/**
-	 * Retrieve the connect array
+    /**
+     * Retrieve the connect array
      *
-	 * @param work                  The internal work area
+     * @param work                  The internal work area
      * @param leftPartOfSpeech      The part of speech at left side
-	 * @return                      The connect array
-	 */
+     * @return                      The connect array
+     */
     public static final native byte[] getConnectArray( long work, int leftPartOfSpeech );
 
-	/**
-	 * Retrieve the number of the part of speeches at left side.
+    /**
+     * Retrieve the number of the part of speeches at left side.
      *
-	 * @return              The number
-	 */
+     * @return              The number
+     */
     public static final native int getNumberOfLeftPOS( long work );
-	/**
-	 * Retrieve the number of the part of speeches at right side.
+    /**
+     * Retrieve the number of the part of speeches at right side.
      *
-	 * @return              The number
-	 */
+     * @return              The number
+     */
     public static final native int getNumberOfRightPOS( long work );
 
-	/**
-	 * Retrieve the specified part of speech at left side.
+    /**
+     * Retrieve the specified part of speech at left side.
      *
-	 * @param work          The internal work area
+     * @param work          The internal work area
      * @param type          The type of a part of speech
-	 * @return              0 if type is not found; <0 if an error occur; >0 The part of speech
-	 */
+     * @return              0 if type is not found; <0 if an error occur; >0 The part of speech
+     */
     public static final native int getLeftPartOfSpeechSpecifiedType( long work, int type );
 
-	/**
-	 * Retrieve the specified part of speech at right side.
+    /**
+     * Retrieve the specified part of speech at right side.
      *
-	 * @param work          The internal work area
+     * @param work          The internal work area
      * @param type          The type of a part of speech
-	 * @return              0 if type is not found; <0 if an error occur; >0 The part of speech
+     * @return              0 if type is not found; <0 if an error occur; >0 The part of speech
      * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#POS_TYPE_V1
      * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#POS_TYPE_V2
      * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#POS_TYPE_V3
@@ -424,26 +424,26 @@
      * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#POS_TYPE_JINMEI
      * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#POS_TYPE_CHIMEI
      * @see jp.co.omronsoft.openwnn.OpenWnnDictionaryImplJni#POS_TYPE_KIGOU
-	 */
+     */
     public static final native int getRightPartOfSpeechSpecifiedType( long work, int type );
 
     /**
      * Create the string array that is used by operation of query
-     * 	
-     * @param work					The internal work area
-     * @param keyString				The key string
-     * @param maxBindsOfQuery		The maximum number of binds of query
-     * @param maxPatternOfApprox	The maximum number of approximate patterns per character
+     *  
+     * @param work                  The internal work area
+     * @param keyString             The key string
+     * @param maxBindsOfQuery       The maximum number of binds of query
+     * @param maxPatternOfApprox    The maximum number of approximate patterns per character
      * @return                     The string array for binding
      */
     public static final native String[] createBindArray( long work, String keyString, int maxBindsOfQuery, int maxPatternOfApprox );
 
     /**
      * Create the string which used query parameter
-     * 	
-     * @param work					The internal work area
-     * @param maxBindsOfQuery		The maximum number of binds of query
-     * @param maxPatternOfApprox	The maximum number of approximate patterns per character
+     *  
+     * @param work                  The internal work area
+     * @param maxBindsOfQuery       The maximum number of binds of query
+     * @param maxPatternOfApprox    The maximum number of approximate patterns per character
      * @param keyColumnName        The name of the key column
      * @return                     The string for querying
      */
diff --git a/src/jp/co/omronsoft/openwnn/OpenWnnEN.java b/src/jp/co/omronsoft/openwnn/OpenWnnEN.java
index 0b25b29..ab0754d 100644
--- a/src/jp/co/omronsoft/openwnn/OpenWnnEN.java
+++ b/src/jp/co/omronsoft/openwnn/OpenWnnEN.java
@@ -42,96 +42,96 @@
  * @author Copyright (C) 2009 OMRON SOFTWARE CO., LTD.  All Rights Reserved.
  */
 public class OpenWnnEN extends OpenWnn {
-	/** A space character */
-	private static final char[] SPACE = {' '};
-	
-	/** Character style of underline */
-	private static final CharacterStyle SPAN_UNDERLINE   = new UnderlineSpan();
+    /** A space character */
+    private static final char[] SPACE = {' '};
+    
+    /** Character style of underline */
+    private static final CharacterStyle SPAN_UNDERLINE   = new UnderlineSpan();
     /** Highlight color style for the selected string  */
     private static final CharacterStyle SPAN_EXACT_BGCOLOR_HL     = new BackgroundColorSpan(0xFF66CDAA);
     /** Highlight color style for the composing text */
     private static final CharacterStyle SPAN_REMAIN_BGCOLOR_HL    = new BackgroundColorSpan(0xFFF0FFFF);
 
-	/** A private area code(ALT+SHIFT+X) to be ignore (G1 specific). */
-	private static final int PRIVATE_AREA_CODE = 61184;
-	/** Never move cursor in to the composing text (adapting to IMF's specification change) */
+    /** A private area code(ALT+SHIFT+X) to be ignore (G1 specific). */
+    private static final int PRIVATE_AREA_CODE = 61184;
+    /** Never move cursor in to the composing text (adapting to IMF's specification change) */
     private static final boolean FIX_CURSOR_TEXT_END = true;
 
-	/** Whether using Emoji or not */
+    /** Whether using Emoji or not */
     private static final boolean ENABLE_EMOJI_LIMITATION = true;
-	
-	/** Spannable string for the composing text */
-	protected SpannableStringBuilder mDisplayText;
+    
+    /** Spannable string for the composing text */
+    protected SpannableStringBuilder mDisplayText;
 
-	/** Handler for drawing the candidates view */
-	private Handler mDelayUpdateHandler;
-	/** Characters treated as a separator */
-	private String mWordSeparators;
-	/** Previous event's code */
-	private int mPreviousEventCode;
+    /** Handler for drawing the candidates view */
+    private Handler mDelayUpdateHandler;
+    /** Characters treated as a separator */
+    private String mWordSeparators;
+    /** Previous event's code */
+    private int mPreviousEventCode;
 
-	/** Array of words from the user dictionary */
-	private WnnWord[] mUserDictionaryWords = null;
+    /** Array of words from the user dictionary */
+    private WnnWord[] mUserDictionaryWords = null;
 
-	/** The converter for English prediction/spell correction */
-	private OpenWnnEngineEN mConverterEN;
-	/** The symbol list generator */
-	private SymbolList mSymbolList;
-	/** Whether it is displaying symbol list */
-	private boolean mSymbolMode;
-	/** Whether prediction is enabled */
-	private boolean mOptPrediction;
-	/** Whether spell correction is enabled */
-	private boolean mOptSpellCorrection;
-	/** Whether learning is enabled */
-	private boolean mOptLearning;
-	
-	/** SHIFT key state */
-	private int mHardShift;
+    /** The converter for English prediction/spell correction */
+    private OpenWnnEngineEN mConverterEN;
+    /** The symbol list generator */
+    private SymbolList mSymbolList;
+    /** Whether it is displaying symbol list */
+    private boolean mSymbolMode;
+    /** Whether prediction is enabled */
+    private boolean mOptPrediction;
+    /** Whether spell correction is enabled */
+    private boolean mOptSpellCorrection;
+    /** Whether learning is enabled */
+    private boolean mOptLearning;
+    
+    /** SHIFT key state */
+    private int mHardShift;
     /** SHIFT key state (pressing) */
-	private boolean mShiftPressing;
-	/** ALT key state */
-	private int mHardAlt;
+    private boolean mShiftPressing;
+    /** ALT key state */
+    private int mHardAlt;
     /** ALT key state (pressing) */
-	private boolean mAltPressing;
+    private boolean mAltPressing;
 
-	/** Instance of this service */
-	private static OpenWnnEN mSelf = null;
+    /** Instance of this service */
+    private static OpenWnnEN mSelf = null;
 
-	/** Shift lock toggle definition */
-	private static final int[] mShiftKeyToggle = {0, MetaKeyKeyListener.META_SHIFT_ON, MetaKeyKeyListener.META_CAP_LOCKED};
-	/** Alt lock toggle definition */
-	private static final int[] mAltKeyToggle = {0, MetaKeyKeyListener.META_ALT_ON, MetaKeyKeyListener.META_ALT_LOCKED};
-	/** Auto caps mode */
-	private boolean mAutoCaps = false;
-	
-	private CandidateFilter mFilter;
+    /** Shift lock toggle definition */
+    private static final int[] mShiftKeyToggle = {0, MetaKeyKeyListener.META_SHIFT_ON, MetaKeyKeyListener.META_CAP_LOCKED};
+    /** Alt lock toggle definition */
+    private static final int[] mAltKeyToggle = {0, MetaKeyKeyListener.META_ALT_ON, MetaKeyKeyListener.META_ALT_LOCKED};
+    /** Auto caps mode */
+    private boolean mAutoCaps = false;
+    
+    private CandidateFilter mFilter;
 
     /**
      * Constructor
      */
-	public OpenWnnEN() {
-		super();
+    public OpenWnnEN() {
+        super();
         mSelf = this;
 
-		/* used by OpenWnn */
-		mComposingText = new ComposingText();
-		mCandidatesViewManager = new TextCandidatesViewManager(-1);
-		mInputViewManager = new DefaultSoftKeyboardEN();
-		mConverterEN = new OpenWnnEngineEN("/data/data/jp.co.omronsoft.openwnn/writableEN.dic");
-		mConverter = mConverterEN;
-		mFilter = new CandidateFilter();
-		mSymbolList = null;
+        /* used by OpenWnn */
+        mComposingText = new ComposingText();
+        mCandidatesViewManager = new TextCandidatesViewManager(-1);
+        mInputViewManager = new DefaultSoftKeyboardEN();
+        mConverterEN = new OpenWnnEngineEN("/data/data/jp.co.omronsoft.openwnn/writableEN.dic");
+        mConverter = mConverterEN;
+        mFilter = new CandidateFilter();
+        mSymbolList = null;
 
-		/* etc */
-		mDisplayText = new SpannableStringBuilder();
-		mAutoHideMode = false;
-		mDelayUpdateHandler = new Handler();
-		mSymbolMode = false;
-		mOptPrediction = true;
-		mOptSpellCorrection = true;
-		mOptLearning = true;
-	}
+        /* etc */
+        mDisplayText = new SpannableStringBuilder();
+        mAutoHideMode = false;
+        mDelayUpdateHandler = new Handler();
+        mSymbolMode = false;
+        mOptPrediction = true;
+        mOptSpellCorrection = true;
+        mOptLearning = true;
+    }
 
     /**
      * Constructor
@@ -142,51 +142,51 @@
         this();
         attachBaseContext(context);
     }
-	/**
-	 * Get the instance of this service.
-	 * <br>
-	 * Before using this method, the constructor of this service must be invoked.
-	 * 
-	 * @return		The instance of this object
-	 */
-	public static OpenWnnEN getInstance() {
-		return mSelf;
-	}
+    /**
+     * Get the instance of this service.
+     * <br>
+     * Before using this method, the constructor of this service must be invoked.
+     * 
+     * @return      The instance of this object
+     */
+    public static OpenWnnEN getInstance() {
+        return mSelf;
+    }
 
-	/**
-	 * Insert a character into the composing text.
-	 *
-	 * @param chars		A array of character
-	 */
-	private void insertCharToComposingText(char[] chars) {
-		StrSegment seg = new StrSegment(chars);
+    /**
+     * Insert a character into the composing text.
+     *
+     * @param chars     A array of character
+     */
+    private void insertCharToComposingText(char[] chars) {
+        StrSegment seg = new StrSegment(chars);
 
-		if (chars[0] == SPACE[0] || chars[0] == '\u0009') {
-			/* if the character is a space, commit the composing text */
-			commitText(1);
-			commitText(seg.string);
-			mComposingText.clear();
-		} else if (mWordSeparators.contains(seg.string)) {
-			/* if the character is a separator, remove an auto-inserted space and commit the composing text. */
-			if (mPreviousEventCode == OpenWnnEvent.SELECT_CANDIDATE) {
-				mInputConnection.deleteSurroundingText(1, 0);
-			}
-			commitText(1);
-			commitText(seg.string);
-			mComposingText.clear();
-		} else {
-			mComposingText.insertStrSegment(0, 1, seg);
-			updateComposingText(1);
-		}
-	}
+        if (chars[0] == SPACE[0] || chars[0] == '\u0009') {
+            /* if the character is a space, commit the composing text */
+            commitText(1);
+            commitText(seg.string);
+            mComposingText.clear();
+        } else if (mWordSeparators.contains(seg.string)) {
+            /* if the character is a separator, remove an auto-inserted space and commit the composing text. */
+            if (mPreviousEventCode == OpenWnnEvent.SELECT_CANDIDATE) {
+                mInputConnection.deleteSurroundingText(1, 0);
+            }
+            commitText(1);
+            commitText(seg.string);
+            mComposingText.clear();
+        } else {
+            mComposingText.insertStrSegment(0, 1, seg);
+            updateComposingText(1);
+        }
+    }
 
-	/**
-	 * Insert a character into the composing text.
-	 *
-	 * @param charCode		A character code
-     * @return				{@code true} if success; {@code false} if an error occurs.
-	 */
-	private boolean insertCharToComposingText(int charCode) {
+    /**
+     * Insert a character into the composing text.
+     *
+     * @param charCode      A character code
+     * @return              {@code true} if success; {@code false} if an error occurs.
+     */
+    private boolean insertCharToComposingText(int charCode) {
         if (charCode == 0) {
             return false;
         }
@@ -194,198 +194,185 @@
         return true;
     }
 
-	/**
-	 * Get the shift key state from the editor.
-	 *
-	 * @param editor	Editor
-	 *
-	 * @return			State ID of the shift key (0:off, 1:on)
-	 */
-	protected int getShiftKeyState(EditorInfo editor) {
-		return (getCurrentInputConnection().getCursorCapsMode(editor.inputType) == 0) ? 0 : 1;
-	}
+    /**
+     * Get the shift key state from the editor.
+     *
+     * @param editor    Editor
+     *
+     * @return          State ID of the shift key (0:off, 1:on)
+     */
+    protected int getShiftKeyState(EditorInfo editor) {
+        return (getCurrentInputConnection().getCursorCapsMode(editor.inputType) == 0) ? 0 : 1;
+    }
 
     /**
      * Set the mode of the symbol list.
      * 
-     * @param mode 		{@code SymbolList.SYMBOL_ENGLISH} or {@code null}.
+     * @param mode      {@code SymbolList.SYMBOL_ENGLISH} or {@code null}.
      */
-	private void setSymbolMode(String mode) {
-		if (mode != null) {
-			mDelayUpdateHandler.removeCallbacks(updatePredictionRunnable);
-			mSymbolMode = true;
-			mSymbolList.setDictionary(mode);
-			mConverter = mSymbolList;
-		} else {
-			if (!mSymbolMode) {
-				return;
-			}
-			mDelayUpdateHandler.removeCallbacks(updatePredictionRunnable);
-			mSymbolMode = false;
-			mConverter = mConverterEN;
-		}
-	}
+    private void setSymbolMode(String mode) {
+        if (mode != null) {
+            mDelayUpdateHandler.removeCallbacks(updatePredictionRunnable);
+            mSymbolMode = true;
+            mSymbolList.setDictionary(mode);
+            mConverter = mSymbolList;
+        } else {
+            if (!mSymbolMode) {
+                return;
+            }
+            mDelayUpdateHandler.removeCallbacks(updatePredictionRunnable);
+            mSymbolMode = false;
+            mConverter = mConverterEN;
+        }
+    }
 
-	/***********************************************************************
-	 * InputMethodServer
-	 ***********************************************************************/
+    /***********************************************************************
+     * InputMethodServer
+     ***********************************************************************/
     /** @see jp.co.omronsoft.openwnn.OpenWnn#onCreate */
-	@Override public void onCreate() {
-		super.onCreate();
-		mWordSeparators = getResources().getString(R.string.en_word_separators);
+    @Override public void onCreate() {
+        super.onCreate();
+        mWordSeparators = getResources().getString(R.string.en_word_separators);
 
-		if (mSymbolList == null) {
-			mSymbolList = new SymbolList(this, SymbolList.LANG_EN);
-		}
-	}
-	
+        if (mSymbolList == null) {
+            mSymbolList = new SymbolList(this, SymbolList.LANG_EN);
+        }
+    }
+    
     /** @see jp.co.omronsoft.openwnn.OpenWnn#onCreateInputView */
     @Override public View onCreateInputView() {
-    	int hiddenState = getResources().getConfiguration().hardKeyboardHidden;
-    	boolean hidden = (hiddenState == Configuration.HARDKEYBOARDHIDDEN_YES);
-    	((DefaultSoftKeyboardEN) mInputViewManager).setHardKeyboardHidden(hidden);
-    	((TextCandidatesViewManager)
-    			mCandidatesViewManager).setHardKeyboardHidden(hidden);
+        int hiddenState = getResources().getConfiguration().hardKeyboardHidden;
+        boolean hidden = (hiddenState == Configuration.HARDKEYBOARDHIDDEN_YES);
+        ((DefaultSoftKeyboardEN) mInputViewManager).setHardKeyboardHidden(hidden);
+        ((TextCandidatesViewManager)
+                mCandidatesViewManager).setHardKeyboardHidden(hidden);
 
         return super.onCreateInputView();
     }
 
     /** @see jp.co.omronsoft.openwnn.OpenWnn#onStartInputView */
-	@Override public void onStartInputView(EditorInfo attribute, boolean restarting) {
-		super.onStartInputView(attribute, restarting);
+    @Override public void onStartInputView(EditorInfo attribute, boolean restarting) {
+        super.onStartInputView(attribute, restarting);
 
-		/* initialize views */
-		mCandidatesViewManager.clearCandidates();
+        /* initialize views */
+        mCandidatesViewManager.clearCandidates();
+        mCandidatesViewManager.setViewType(CandidatesViewManager.VIEW_TYPE_CLOSE);
 
-		mHardShift = 0;
-		mHardAlt   = 0;
+        mHardShift = 0;
+        mHardAlt   = 0;
         updateMetaKeyStateDisplay();
 
         /* load preferences */
-		SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this);
+        SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this);
 
-		/* auto caps mode */
-		mAutoCaps = pref.getBoolean("auto_caps", true);
+        /* auto caps mode */
+        mAutoCaps = pref.getBoolean("auto_caps", true);
 
-		/* set TextCandidatesViewManager's option */
-		((TextCandidatesViewManager)mCandidatesViewManager).setAutoHide(false);
-
+        /* set TextCandidatesViewManager's option */
+        ((TextCandidatesViewManager)mCandidatesViewManager).setAutoHide(true);
         
-		/* display status icon */
- 		showStatusIcon(R.drawable.immodeic_half_alphabet);
+        /* display status icon */
+        showStatusIcon(R.drawable.immodeic_half_alphabet);
 
-		/* set prediction & spell correction mode */
-		mOptPrediction      = pref.getBoolean("opt_en_prediction", true);
-		mOptSpellCorrection = pref.getBoolean("opt_en_spell_correction", true);
-		mOptLearning        = pref.getBoolean("opt_en_enable_learning", true);
+        /* set prediction & spell correction mode */
+        mOptPrediction      = pref.getBoolean("opt_en_prediction", true);
+        mOptSpellCorrection = pref.getBoolean("opt_en_spell_correction", true);
+        mOptLearning        = pref.getBoolean("opt_en_enable_learning", true);
 
-		/* prediction on/off */
+        /* prediction on/off */
         switch (attribute.inputType & EditorInfo.TYPE_MASK_CLASS) {
         case EditorInfo.TYPE_CLASS_NUMBER:
         case EditorInfo.TYPE_CLASS_DATETIME:
         case EditorInfo.TYPE_CLASS_PHONE:
             mOptPrediction = false;
-    		mOptLearning = false;
+            mOptLearning = false;
             break;
 
         case EditorInfo.TYPE_CLASS_TEXT:
-        	switch (attribute.inputType & EditorInfo.TYPE_MASK_VARIATION) {
-        	case EditorInfo.TYPE_TEXT_VARIATION_PASSWORD:
+            switch (attribute.inputType & EditorInfo.TYPE_MASK_VARIATION) {
+            case EditorInfo.TYPE_TEXT_VARIATION_PASSWORD:
             case EditorInfo.TYPE_TEXT_VARIATION_PHONETIC:
-            	mOptLearning = false;
-        		mOptPrediction = false;
-        		break;
-        	default:
-        		break;
-        	}
+                mOptLearning = false;
+                mOptPrediction = false;
+                break;
+            default:
+                break;
+            }
         }
 
         /* set engine's mode */
         if (mOptSpellCorrection) {
-        	mConverterEN.setDictionary(OpenWnnEngineEN.DICT_FOR_CORRECT_MISTYPE);
+            mConverterEN.setDictionary(OpenWnnEngineEN.DICT_FOR_CORRECT_MISTYPE);
         } else {
-        	mConverterEN.setDictionary(OpenWnnEngineEN.DICT_DEFAULT);
+            mConverterEN.setDictionary(OpenWnnEngineEN.DICT_DEFAULT);
         }
         /* emoji */
         if (ENABLE_EMOJI_LIMITATION) {
             Bundle bundle = attribute.extras;
             if (bundle != null && bundle.getBoolean("allowEmoji")) {
-            	mConverterEN.setFilter(null);
+                mConverterEN.setFilter(null);
             } else {
-            	mFilter.setFilter(CandidateFilter.FILTER_EMOJI);
-            	mConverterEN.setFilter(mFilter);
+                mFilter.setFilter(CandidateFilter.FILTER_EMOJI);
+                mConverterEN.setFilter(mFilter);
             }
         } else {
-        	mConverterEN.setFilter(null);
+            mConverterEN.setFilter(null);
         }
 
         /* doesn't learn any word if it is not prediction mode */
         if (!mOptPrediction) {
-        	mOptLearning = false;
+            mOptLearning = false;
         }
 
         if (mComposingText != null) {
-        	mComposingText.clear();
+            mComposingText.clear();
         }
         /* initialize the engine's state */
         fitInputType(pref, attribute);
-	}
+    }
 
     /** @see jp.co.omronsoft.openwnn.OpenWnn#onComputeInsets */
-	@Override public void onComputeInsets(InputMethodService.Insets outInsets) {
-		if (mCandidatesViewManager.getViewType() == CandidatesViewManager.VIEW_TYPE_FULL) {
-			outInsets.touchableInsets = InputMethodService.Insets.TOUCHABLE_INSETS_FRAME;
-		} else {
-			super.onComputeInsets(outInsets);
-		}
-	}
-
-    /** @see jp.co.omronsoft.openwnn.OpenWnn#isFullscreenMode */
-	@Override public boolean isFullscreenMode() {
-		boolean ret;
-		if (mInputViewManager == null) {
-			ret = (mCandidatesViewManager.getViewType() == CandidatesViewManager.VIEW_TYPE_FULL);
-		} else {
-			ret = false;
-		}
-		return ret;
-	}
+    @Override public void onComputeInsets(InputMethodService.Insets outInsets) {
+        /* use default value. means;
+         * outInsets.touchableInsets = InputMethodService.Insets.TOUCHABLE_INSETS_VISIBLE;
+         */
+    }
 
     /** @see jp.co.omronsoft.openwnn.OpenWnn#onUpdateSelection */
-	@Override public void onUpdateSelection(int oldSelStart, int oldSelEnd,
-			int newSelStart, int newSelEnd, int candidatesStart,
-			int candidatesEnd) {
-		if (mComposingText.size(1) != 0) {
-			updateComposingText(1);
-		}
-	}
+    @Override public void onUpdateSelection(int oldSelStart, int oldSelEnd,
+            int newSelStart, int newSelEnd, int candidatesStart,
+            int candidatesEnd) {
+        if (mComposingText.size(1) != 0) {
+            updateComposingText(1);
+        }
+    }
 
     /** @see jp.co.omronsoft.openwnn.OpenWnn#onConfigurationChanged */
-	@Override public void onConfigurationChanged(Configuration newConfig) {
-		try {
-			super.onConfigurationChanged(newConfig);
-			if (mInputConnection != null) {
-				updateComposingText(1);
-			}
-		} catch (Exception ex) {
-		}
-	}
+    @Override public void onConfigurationChanged(Configuration newConfig) {
+        try {
+            super.onConfigurationChanged(newConfig);
+            if (mInputConnection != null) {
+                updateComposingText(1);
+            }
+        } catch (Exception ex) {
+        }
+    }
 
     /** @see jp.co.omronsoft.openwnn.OpenWnn#onEvaluateFullscreenMode */
-	@Override public boolean onEvaluateFullscreenMode() {
-		return false;
-	}
+    @Override public boolean onEvaluateFullscreenMode() {
+        return false;
+    }
 
     /** @see jp.co.omronsoft.openwnn.OpenWnn#onEvaluateInputViewShown */
-	@Override public boolean onEvaluateInputViewShown() {
-		return true;
-	}
+    @Override public boolean onEvaluateInputViewShown() {
+        return true;
+    }
 
-	/***********************************************************************
-	 * OpenWnn
-	 ***********************************************************************/
+    /***********************************************************************
+     * OpenWnn
+     ***********************************************************************/
     /** @see jp.co.omronsoft.openwnn.OpenWnn#onEvent */
-	@Override synchronized public boolean onEvent(OpenWnnEvent ev) {
+    @Override synchronized public boolean onEvent(OpenWnnEvent ev) {
         /* handling events which are valid when InputConnection is not active. */
         switch (ev.code) {
         
@@ -403,33 +390,33 @@
             mUserDictionaryWords = mConverterEN.getUserDictionaryWords( );
             return true;
 
-		case OpenWnnEvent.GET_WORD:
-			if( mUserDictionaryWords != null ) {
-				ev.word = mUserDictionaryWords[ 0 ];
-				for( int i = 0 ; i < mUserDictionaryWords.length-1 ; i++ ) {
-					mUserDictionaryWords[ i ] = mUserDictionaryWords[ i + 1 ];
-				}
-				mUserDictionaryWords[ mUserDictionaryWords.length-1 ] = null;
-				if( mUserDictionaryWords[ 0 ] == null ) {
-					mUserDictionaryWords = null;
-				}
-				return true;
-			}
+        case OpenWnnEvent.GET_WORD:
+            if( mUserDictionaryWords != null ) {
+                ev.word = mUserDictionaryWords[ 0 ];
+                for( int i = 0 ; i < mUserDictionaryWords.length-1 ; i++ ) {
+                    mUserDictionaryWords[ i ] = mUserDictionaryWords[ i + 1 ];
+                }
+                mUserDictionaryWords[ mUserDictionaryWords.length-1 ] = null;
+                if( mUserDictionaryWords[ 0 ] == null ) {
+                    mUserDictionaryWords = null;
+                }
+                return true;
+            }
             break;
 
-		case OpenWnnEvent.ADD_WORD:
-			mConverterEN.addWord(ev.word);
-			return true;
+        case OpenWnnEvent.ADD_WORD:
+            mConverterEN.addWord(ev.word);
+            return true;
 
-		case OpenWnnEvent.DELETE_WORD:
-			mConverterEN.deleteWord(ev.word);
-			return true;
+        case OpenWnnEvent.DELETE_WORD:
+            mConverterEN.deleteWord(ev.word);
+            return true;
 
-		case OpenWnnEvent.CHANGE_MODE:
+        case OpenWnnEvent.CHANGE_MODE:
             return false;
             
         case OpenWnnEvent.CHANGE_INPUT_VIEW:
-        	setInputView(onCreateInputView());
+            setInputView(onCreateInputView());
             return true;
 
         case OpenWnnEvent.CANDIDATE_VIEW_TOUCH:
@@ -439,84 +426,85 @@
 
         default:
             break;
-		}
+        }
 
-		dismissPopupKeyboard();
+        dismissPopupKeyboard();
         KeyEvent keyEvent = ev.keyEvent;
         int keyCode = 0;
         if (keyEvent != null) {
             keyCode = keyEvent.getKeyCode();
         }
-		if (mDirectInputMode) {
+        if (mDirectInputMode) {
             if (ev.code == OpenWnnEvent.INPUT_SOFT_KEY && mInputConnection != null) {
                 mInputConnection.sendKeyEvent(keyEvent);
-				mInputConnection.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_UP,
+                mInputConnection.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_UP,
                                                            keyEvent.getKeyCode()));
             }
-			return false;
-		}
+            return false;
+        }
 
-		if (ev.code == OpenWnnEvent.LIST_CANDIDATES_FULL) {
-			mCandidatesViewManager.setViewType(CandidatesViewManager.VIEW_TYPE_FULL);
-			return true;
-		}
+        if (ev.code == OpenWnnEvent.LIST_CANDIDATES_FULL) {
+            mCandidatesViewManager.setViewType(CandidatesViewManager.VIEW_TYPE_FULL);
+            return true;
+        }
 
-		boolean ret = false;
-		switch (ev.code) {
-		case OpenWnnEvent.INPUT_CHAR:
-			EditorInfo edit = getCurrentInputEditorInfo();
-			if( edit.inputType == EditorInfo.TYPE_CLASS_PHONE){
-				commitText(new String(ev.chars));			
-			}else{
-				setSymbolMode(null);
-				insertCharToComposingText(ev.chars);
-				ret = true;
-				mPreviousEventCode = ev.code;
-			}
-			break;
-
-		case OpenWnnEvent.INPUT_KEY:
-			keyCode = ev.keyEvent.getKeyCode();
-			/* update shift/alt state */
-			switch (keyCode) {
-			case KeyEvent.KEYCODE_ALT_LEFT:
-			case KeyEvent.KEYCODE_ALT_RIGHT:
-				if (ev.keyEvent.getRepeatCount() == 0) {
-					if (++mHardAlt > 2) { mHardAlt = 0; }
-				}
-                mAltPressing   = true;
-				updateMetaKeyStateDisplay();
-				return true;
-
-			case KeyEvent.KEYCODE_SHIFT_LEFT:
-			case KeyEvent.KEYCODE_SHIFT_RIGHT:
-				if (ev.keyEvent.getRepeatCount() == 0) {
-					if (++mHardShift > 2) { mHardShift = 0; }
-				}
-                mShiftPressing = true;
-				updateMetaKeyStateDisplay();
-				return true;
-			}
-			setSymbolMode(null);
-			updateComposingText(1);
-			/* handle other key event */
-			ret = processKeyEvent(ev.keyEvent);
-			mPreviousEventCode = ev.code;
-			break;
-
-		case OpenWnnEvent.INPUT_SOFT_KEY:
-			setSymbolMode(null);
-			updateComposingText(1);
-			ret = processKeyEvent(ev.keyEvent);
-			if (!ret) {
-				mInputConnection.sendKeyEvent(ev.keyEvent);
-				mInputConnection.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, ev.keyEvent.getKeyCode()));
+        boolean ret = false;
+        switch (ev.code) {
+        case OpenWnnEvent.INPUT_CHAR:
+             ((TextCandidatesViewManager)mCandidatesViewManager).setAutoHide(false);
+            EditorInfo edit = getCurrentInputEditorInfo();
+            if( edit.inputType == EditorInfo.TYPE_CLASS_PHONE){
+                commitText(new String(ev.chars));           
+            }else{
+                setSymbolMode(null);
+                insertCharToComposingText(ev.chars);
                 ret = true;
-			}
-			mPreviousEventCode = ev.code;
-			break;
+                mPreviousEventCode = ev.code;
+            }
+            break;
 
-		case OpenWnnEvent.SELECT_CANDIDATE:
+        case OpenWnnEvent.INPUT_KEY:
+            keyCode = ev.keyEvent.getKeyCode();
+            /* update shift/alt state */
+            switch (keyCode) {
+            case KeyEvent.KEYCODE_ALT_LEFT:
+            case KeyEvent.KEYCODE_ALT_RIGHT:
+                if (ev.keyEvent.getRepeatCount() == 0) {
+                    if (++mHardAlt > 2) { mHardAlt = 0; }
+                }
+                mAltPressing   = true;
+                updateMetaKeyStateDisplay();
+                return true;
+
+            case KeyEvent.KEYCODE_SHIFT_LEFT:
+            case KeyEvent.KEYCODE_SHIFT_RIGHT:
+                if (ev.keyEvent.getRepeatCount() == 0) {
+                    if (++mHardShift > 2) { mHardShift = 0; }
+                }
+                mShiftPressing = true;
+                updateMetaKeyStateDisplay();
+                return true;
+            }
+            setSymbolMode(null);
+            updateComposingText(1);
+            /* handle other key event */
+            ret = processKeyEvent(ev.keyEvent);
+            mPreviousEventCode = ev.code;
+            break;
+
+        case OpenWnnEvent.INPUT_SOFT_KEY:
+            setSymbolMode(null);
+            updateComposingText(1);
+            ret = processKeyEvent(ev.keyEvent);
+            if (!ret) {
+                mInputConnection.sendKeyEvent(ev.keyEvent);
+                mInputConnection.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, ev.keyEvent.getKeyCode()));
+                ret = true;
+            }
+            mPreviousEventCode = ev.code;
+            break;
+
+        case OpenWnnEvent.SELECT_CANDIDATE:
             if (mSymbolMode) {
                 commitText(ev.word, false);
             } else {
@@ -531,79 +519,81 @@
             updateComposingText(1);
             break;
 
-		case OpenWnnEvent.LIST_SYMBOLS:
-			commitText(1);
-			mComposingText.clear();
-			setSymbolMode(SymbolList.SYMBOL_ENGLISH);
-			updateComposingText(1);
-			break;
+        case OpenWnnEvent.LIST_SYMBOLS:
+            commitText(1);
+            mComposingText.clear();
+            setSymbolMode(SymbolList.SYMBOL_ENGLISH);
+            updateComposingText(1);
+            break;
 
-		default:
-			break;
-		}
+        default:
+            break;
+        }
 
-		if (mCandidatesViewManager.getViewType() == CandidatesViewManager.VIEW_TYPE_FULL) {
-			mCandidatesViewManager.setViewType(CandidatesViewManager.VIEW_TYPE_NORMAL);
-		}
+        if (mCandidatesViewManager.getViewType() == CandidatesViewManager.VIEW_TYPE_FULL) {
+            mCandidatesViewManager.setViewType(CandidatesViewManager.VIEW_TYPE_NORMAL);
+        }
 
-		return ret;
-	}
+        return ret;
+    }
 
-	/***********************************************************************
-	 * OpenWnnEN
-	 ***********************************************************************/
-	/**
-	 * Handling KeyEvent
-	 * <br>
-	 * This method is called from {@link #onEvent()}.
-	 *
-	 * @param ev   A key event
-	 * @return		{@code true} if the event is processed in this method; {@code false} if the event is not processed in this method
-	 */
-	private boolean processKeyEvent(KeyEvent ev) {
+    /***********************************************************************
+     * OpenWnnEN
+     ***********************************************************************/
+    /**
+     * Handling KeyEvent
+     * <br>
+     * This method is called from {@link #onEvent()}.
+     *
+     * @param ev   A key event
+     * @return      {@code true} if the event is processed in this method; {@code false} if the event is not processed in this method
+     */
+    private boolean processKeyEvent(KeyEvent ev) {
 
-		int key = ev.getKeyCode();
-		EditorInfo edit = getCurrentInputEditorInfo();
-		/* keys which produce a glyph */
-		if (ev.isPrintingKey()) {
-			/* do nothing if the character is not able to display or the character is dead key */
-			if ((mHardShift > 0 && mHardAlt > 0) || (ev.isAltPressed() && ev.isShiftPressed())) {
-				int charCode = ev.getUnicodeChar(MetaKeyKeyListener.META_SHIFT_ON | MetaKeyKeyListener.META_ALT_ON);
-				if (charCode == 0 || (charCode & KeyCharacterMap.COMBINING_ACCENT) != 0 || charCode == PRIVATE_AREA_CODE) {
+        int key = ev.getKeyCode();
+        EditorInfo edit = getCurrentInputEditorInfo();
+        /* keys which produce a glyph */
+        if (ev.isPrintingKey()) {
+            /* do nothing if the character is not able to display or the character is dead key */
+            if ((mHardShift > 0 && mHardAlt > 0) || (ev.isAltPressed() && ev.isShiftPressed())) {
+                int charCode = ev.getUnicodeChar(MetaKeyKeyListener.META_SHIFT_ON | MetaKeyKeyListener.META_ALT_ON);
+                if (charCode == 0 || (charCode & KeyCharacterMap.COMBINING_ACCENT) != 0 || charCode == PRIVATE_AREA_CODE) {
                     if(mHardShift == 1){
                         mShiftPressing = false;
                     }
                     if(mHardAlt == 1){
                         mAltPressing   = false;
                     }
-	            	if(!ev.isAltPressed()){
-	            		if (mHardAlt == 1) {
-	            			mHardAlt = 0;
-	            		}
-	            	}
-	            	if(!ev.isShiftPressed()){
-	            		if (mHardShift == 1) {
-	            			mHardShift = 0;
-	            		}
-	            	}
-	            	if(!ev.isShiftPressed() && !ev.isAltPressed()){
-	                    updateMetaKeyStateDisplay();
-	            	}
-					return true;
-				}
-			}
+                    if(!ev.isAltPressed()){
+                        if (mHardAlt == 1) {
+                            mHardAlt = 0;
+                        }
+                    }
+                    if(!ev.isShiftPressed()){
+                        if (mHardShift == 1) {
+                            mHardShift = 0;
+                        }
+                    }
+                    if(!ev.isShiftPressed() && !ev.isAltPressed()){
+                        updateMetaKeyStateDisplay();
+                    }
+                    return true;
+                }
+            }
+            
+            ((TextCandidatesViewManager)mCandidatesViewManager).setAutoHide(false);
 
             /* get the key character */
-			if (mHardShift== 0  && mHardAlt == 0) {
+            if (mHardShift== 0  && mHardAlt == 0) {
                 /* no meta key is locked */
-				int shift = (mAutoCaps) ? getShiftKeyState(edit) : 0;
-				if (shift != mHardShift && (key >= KeyEvent.KEYCODE_A && key <= KeyEvent.KEYCODE_Z)) {
+                int shift = (mAutoCaps) ? getShiftKeyState(edit) : 0;
+                if (shift != mHardShift && (key >= KeyEvent.KEYCODE_A && key <= KeyEvent.KEYCODE_Z)) {
                     /* handling auto caps for a alphabet character */
                     insertCharToComposingText(ev.getUnicodeChar(MetaKeyKeyListener.META_SHIFT_ON));
                 } else {
                     insertCharToComposingText(ev.getUnicodeChar());
                 }
-			} else {
+            } else {
                 insertCharToComposingText(ev.getUnicodeChar(mShiftKeyToggle[mHardShift]
                                                             | mAltKeyToggle[mHardAlt]));
                 if(mHardShift == 1){
@@ -613,234 +603,234 @@
                     mAltPressing   = false;
                 }
                 /* back to 0 (off) if 1 (on/not locked) */
-            	if(!ev.isAltPressed()){
-            		if (mHardAlt == 1) {
-            			mHardAlt = 0;
-            		}
-            	}
-            	if(!ev.isShiftPressed()){
-            		if (mHardShift == 1) {
-            			mHardShift = 0;
-            		}
-            	}
-            	if(!ev.isShiftPressed() && !ev.isAltPressed()){
+                if(!ev.isAltPressed()){
+                    if (mHardAlt == 1) {
+                        mHardAlt = 0;
+                    }
+                }
+                if(!ev.isShiftPressed()){
+                    if (mHardShift == 1) {
+                        mHardShift = 0;
+                    }
+                }
+                if(!ev.isShiftPressed() && !ev.isAltPressed()){
                     updateMetaKeyStateDisplay();
-            	}
-			}
+                }
+            }
 
             if (edit.inputType == EditorInfo.TYPE_CLASS_PHONE) {
-				commitText(1);
-				mComposingText.clear();
-				return true;
-			}
-			return true;
+                commitText(1);
+                mComposingText.clear();
+                return true;
+            }
+            return true;
 
-		} else if (key == KeyEvent.KEYCODE_SPACE) {
-			if (ev.isAltPressed()) {
+        } else if (key == KeyEvent.KEYCODE_SPACE) {
+            if (ev.isAltPressed()) {
                 /* display the symbol list (G1 specific. same as KEYCODE_SYM) */
-				commitText(1);
-				mComposingText.clear();
-				setSymbolMode(SymbolList.SYMBOL_ENGLISH);
-				updateComposingText(1);		
-				mHardAlt = 0;
+                commitText(1);
+                mComposingText.clear();
+                setSymbolMode(SymbolList.SYMBOL_ENGLISH);
+                updateComposingText(1);     
+                mHardAlt = 0;
                 updateMetaKeyStateDisplay();
-			} else {
-				insertCharToComposingText(SPACE);	
-			}
-			return true;
+            } else {
+                insertCharToComposingText(SPACE);   
+            }
+            return true;
         } else if (key == KeyEvent.KEYCODE_SYM) {
             /* display the symbol list */
             commitText(1);
             mComposingText.clear();
             setSymbolMode(SymbolList.SYMBOL_ENGLISH);
-            updateComposingText(1);		
+            updateComposingText(1);     
             mHardAlt = 0;
             updateMetaKeyStateDisplay();
-		} 
+        } 
 
 
-		/* Functional key */
-		if (mComposingText.size(1) > 0) {
-			switch (key) {
-			case KeyEvent.KEYCODE_DEL:
-				mComposingText.delete(1, false);
-				updateComposingText(1);
-				return true;
+        /* Functional key */
+        if (mComposingText.size(1) > 0) {
+            switch (key) {
+            case KeyEvent.KEYCODE_DEL:
+                mComposingText.delete(1, false);
+                updateComposingText(1);
+                return true;
 
-			case KeyEvent.KEYCODE_BACK:
-				if (mCandidatesViewManager.getViewType() == CandidatesViewManager.VIEW_TYPE_FULL) {
-					mCandidatesViewManager.setViewType(CandidatesViewManager.VIEW_TYPE_NORMAL);
-				} else {
-					mComposingText.clear();
-					updateComposingText(1);
-				}
-				return true;
+            case KeyEvent.KEYCODE_BACK:
+                if (mCandidatesViewManager.getViewType() == CandidatesViewManager.VIEW_TYPE_FULL) {
+                    mCandidatesViewManager.setViewType(CandidatesViewManager.VIEW_TYPE_NORMAL);
+                } else {
+                    mComposingText.clear();
+                    updateComposingText(1);
+                }
+                return true;
 
-			case KeyEvent.KEYCODE_DPAD_LEFT:
-				mComposingText.moveCursor(1, -1);
-				updateComposingText(1);
-				return true;
+            case KeyEvent.KEYCODE_DPAD_LEFT:
+                mComposingText.moveCursor(1, -1);
+                updateComposingText(1);
+                return true;
 
-			case KeyEvent.KEYCODE_DPAD_RIGHT:
-				mComposingText.moveCursor(1, 1);
-				updateComposingText(1);
-				return true;
+            case KeyEvent.KEYCODE_DPAD_RIGHT:
+                mComposingText.moveCursor(1, 1);
+                updateComposingText(1);
+                return true;
 
-			case KeyEvent.KEYCODE_ENTER:
-			case KeyEvent.KEYCODE_DPAD_CENTER:
-				commitText(1);
-				mComposingText.clear();
-				return true;
+            case KeyEvent.KEYCODE_ENTER:
+            case KeyEvent.KEYCODE_DPAD_CENTER:
+                commitText(1);
+                mComposingText.clear();
+                return true;
 
-			default:
-				break;
-			}
-		}
-
-		return false;
-	}
-
-	/**
-	 * Runnable for a thread getting and displaying candidates.
-	 */
-	private final Runnable updatePredictionRunnable = new Runnable() {
-		public void run() {
-			int candidates = 0;
-			if (mConverter != null) {
-				/* normal prediction */
-				candidates = mConverter.predict(mComposingText, 0, -1);
-			}
-			/* update the candidates view */
-			if (candidates > 0) {
-				mCandidatesViewManager.displayCandidates(mConverter);
-			} else {
-				mCandidatesViewManager.clearCandidates();
-			}
-		}
-	};
-
-	/**
-	 * Update the composing text.
-	 *
-	 * @param layer  {@link mComposingText}'s layer to display
-	 */
-	private void updateComposingText(int layer) {
-		/* update the candidates view */
-		if (!mOptPrediction) {
-			commitText(1);
-			mComposingText.clear();
-            if (mSymbolMode) {
-				mDelayUpdateHandler.removeCallbacks(updatePredictionRunnable);
-				mDelayUpdateHandler.postDelayed(updatePredictionRunnable, 0);         
+            default:
+                break;
             }
-		} else {
-			if (mComposingText.size(1) != 0) {
-				mDelayUpdateHandler.removeCallbacks(updatePredictionRunnable);
-				mDelayUpdateHandler.postDelayed(updatePredictionRunnable, 250);
-			} else {
-				mDelayUpdateHandler.removeCallbacks(updatePredictionRunnable);
-				mDelayUpdateHandler.postDelayed(updatePredictionRunnable, 0);         
-			}
+        }
 
-			/* notice to the input view */
-			this.mInputViewManager.onUpdateState(this);
+        return false;
+    }
 
-			/* set the candidates view to the normal size */
-			if (mCandidatesViewManager.getViewType() != CandidatesViewManager.VIEW_TYPE_NORMAL) {
-				mCandidatesViewManager.setViewType(CandidatesViewManager.VIEW_TYPE_NORMAL);
-			}
-			/* set the text for displaying as the composing text */
-			SpannableStringBuilder disp = mDisplayText;
-			disp.clear();
-			disp.insert(0, mComposingText.toString(layer));
+    /**
+     * Runnable for a thread getting and displaying candidates.
+     */
+    private final Runnable updatePredictionRunnable = new Runnable() {
+        public void run() {
+            int candidates = 0;
+            if (mConverter != null) {
+                /* normal prediction */
+                candidates = mConverter.predict(mComposingText, 0, -1);
+            }
+            /* update the candidates view */
+            if (candidates > 0) {
+                mCandidatesViewManager.displayCandidates(mConverter);
+            } else {
+                mCandidatesViewManager.clearCandidates();
+            }
+        }
+    };
 
-			/* add decoration to the text */
-			int cursor = mComposingText.getCursor(layer);
-			if (disp.length() != 0) {
-				if (cursor > 0 && cursor < disp.length()) {
-					disp.setSpan(SPAN_EXACT_BGCOLOR_HL, 0, cursor,
-							Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
-				}
-				if (cursor < disp.length()) {
+    /**
+     * Update the composing text.
+     *
+     * @param layer  {@link mComposingText}'s layer to display
+     */
+    private void updateComposingText(int layer) {
+        /* update the candidates view */
+        if (!mOptPrediction) {
+            commitText(1);
+            mComposingText.clear();
+            if (mSymbolMode) {
+                mDelayUpdateHandler.removeCallbacks(updatePredictionRunnable);
+                mDelayUpdateHandler.postDelayed(updatePredictionRunnable, 0);         
+            }
+        } else {
+            if (mComposingText.size(1) != 0) {
+                mDelayUpdateHandler.removeCallbacks(updatePredictionRunnable);
+                mDelayUpdateHandler.postDelayed(updatePredictionRunnable, 250);
+            } else {
+                mDelayUpdateHandler.removeCallbacks(updatePredictionRunnable);
+                mDelayUpdateHandler.postDelayed(updatePredictionRunnable, 0);         
+            }
+
+            /* notice to the input view */
+            this.mInputViewManager.onUpdateState(this);
+
+            /* set the candidates view to the normal size */
+            if (mCandidatesViewManager.getViewType() != CandidatesViewManager.VIEW_TYPE_NORMAL) {
+                mCandidatesViewManager.setViewType(CandidatesViewManager.VIEW_TYPE_NORMAL);
+            }
+            /* set the text for displaying as the composing text */
+            SpannableStringBuilder disp = mDisplayText;
+            disp.clear();
+            disp.insert(0, mComposingText.toString(layer));
+
+            /* add decoration to the text */
+            int cursor = mComposingText.getCursor(layer);
+            if (disp.length() != 0) {
+                if (cursor > 0 && cursor < disp.length()) {
+                    disp.setSpan(SPAN_EXACT_BGCOLOR_HL, 0, cursor,
+                            Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
+                }
+                if (cursor < disp.length()) {
                     mDisplayText.setSpan(SPAN_REMAIN_BGCOLOR_HL, cursor, disp.length(),
                             Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
-				}
-				
-				disp.setSpan(SPAN_UNDERLINE, 0, disp.length(),
-						Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
-			}
-			
+                }
+                
+                disp.setSpan(SPAN_UNDERLINE, 0, disp.length(),
+                        Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
+            }
+            
             int displayCursor = cursor;
             if (FIX_CURSOR_TEXT_END) {
                 displayCursor = (cursor == 0) ?  0 : 1;
             } 
-			/* update the composing text on the EditView */
-			mInputConnection.setComposingText(disp, displayCursor);
-		}
-	}
+            /* update the composing text on the EditView */
+            mInputConnection.setComposingText(disp, displayCursor);
+        }
+    }
 
-	/**
-	 * Commit the composing text.
-	 *
-	 * @param layer  {@link mComposingText}'s layer to commit.
-	 */
-	private void commitText(int layer) {
-		String tmp = mComposingText.toString(layer);
+    /**
+     * Commit the composing text.
+     *
+     * @param layer  {@link mComposingText}'s layer to commit.
+     */
+    private void commitText(int layer) {
+        String tmp = mComposingText.toString(layer);
 
-		if (mOptLearning && mConverter != null && tmp.length() > 0) {
-			WnnWord word = new WnnWord(tmp, tmp);
-			mConverter.learn(word);
-		}
+        if (mOptLearning && mConverter != null && tmp.length() > 0) {
+            WnnWord word = new WnnWord(tmp, tmp);
+            mConverter.learn(word);
+        }
 
         mInputConnection.commitText(tmp, (FIX_CURSOR_TEXT_END ? 1 : tmp.length()));
-		mCandidatesViewManager.clearCandidates();
-	}
+        mCandidatesViewManager.clearCandidates();
+    }
 
-	/**
-	 * Commit a word
-	 *
-	 * @param word 		 	A word to commit
-	 * @param withSpace		Append a space after the word if {@code true}.
-	 */
-	private void commitText(WnnWord word, boolean withSpace) {
+    /**
+     * Commit a word
+     *
+     * @param word          A word to commit
+     * @param withSpace     Append a space after the word if {@code true}.
+     */
+    private void commitText(WnnWord word, boolean withSpace) {
 
-		if (mOptLearning && mConverter != null) {
-			mConverter.learn(word);
-		}
+        if (mOptLearning && mConverter != null) {
+            mConverter.learn(word);
+        }
 
         mInputConnection.commitText(word.candidate, (FIX_CURSOR_TEXT_END ? 1 : word.candidate.length()));
 
-		if (withSpace) {
-			commitText(" ");
-		}		
-	}
+        if (withSpace) {
+            commitText(" ");
+        }       
+    }
 
-	/**
-	 * Commit a string
+    /**
+     * Commit a string
      * <br>
      * The string is not registered into the learning dictionary.
-	 *
-	 * @param str  A string to commit
-	 */
-	private void commitText(String str) {
+     *
+     * @param str  A string to commit
+     */
+    private void commitText(String str) {
         mInputConnection.commitText(str, (FIX_CURSOR_TEXT_END ? 1 : str.length()));
-		mCandidatesViewManager.clearCandidates();
-	}
+        mCandidatesViewManager.clearCandidates();
+    }
 
-	/**
-	 * Dismiss the pop-up keyboard
-	 */
-	protected void dismissPopupKeyboard() {
-		DefaultSoftKeyboardEN kbd = (DefaultSoftKeyboardEN)mInputViewManager;
-		if (kbd != null) {
-			kbd.dismissPopupKeyboard();
-		}
-	}
+    /**
+     * Dismiss the pop-up keyboard
+     */
+    protected void dismissPopupKeyboard() {
+        DefaultSoftKeyboardEN kbd = (DefaultSoftKeyboardEN)mInputViewManager;
+        if (kbd != null) {
+            kbd.dismissPopupKeyboard();
+        }
+    }
 
-	/**
-	 * Display current meta-key state.
-	 */
-	private void updateMetaKeyStateDisplay() {
+    /**
+     * Display current meta-key state.
+     */
+    private void updateMetaKeyStateDisplay() {
         int mode = 0;
         if(mHardShift == 0 && mHardAlt == 0){
             mode = DefaultSoftKeyboard.HARD_KEYMODE_SHIFT_OFF_ALT_OFF;
@@ -865,15 +855,15 @@
         }
 
         ((DefaultSoftKeyboard) mInputViewManager).updateIndicator(mode);
-	}
+    }
 
-	/**
-	 * Handling KeyEvent(KEYUP)
-	 * <br>
-	 * This method is called from {@link #onEvent()}.
-	 *
-	 * @param ev   An up key event
-	 */
+    /**
+     * Handling KeyEvent(KEYUP)
+     * <br>
+     * This method is called from {@link #onEvent()}.
+     *
+     * @param ev   An up key event
+     */
     private void onKeyUpEvent(KeyEvent ev) {
         int key = ev.getKeyCode();
         if(!mShiftPressing){
@@ -895,7 +885,7 @@
      * Fits an editor info.
      * 
      * @param preferences  The preference data.
-     * @param info  		The editor info.
+     * @param info          The editor info.
      */
     private void fitInputType(SharedPreferences preference, EditorInfo info) {
         if (info.inputType == EditorInfo.TYPE_NULL) {
@@ -904,11 +894,3 @@
         }
     }
 }
-
-
-
-
-
-
-
-
diff --git a/src/jp/co/omronsoft/openwnn/OpenWnnJAJP.java b/src/jp/co/omronsoft/openwnn/OpenWnnJAJP.java
index 72c8306..6db1817 100644
--- a/src/jp/co/omronsoft/openwnn/OpenWnnJAJP.java
+++ b/src/jp/co/omronsoft/openwnn/OpenWnnJAJP.java
@@ -337,6 +337,18 @@
     /** Regular expression pattern for English separators */
     private  Pattern mEnglishAutoCommitDelimiter = null;
 
+    /** Lenght of committed text */
+    private int mCommitLength = 0;
+
+    /** Last cursor position */
+    private int mLastSelectionEnd = 0;
+
+    /** Cursor position before committing text */
+    private int mCommitStartCursor = 0;
+
+    /** Previous committed text */
+    private StringBuffer mPrevCommitText = null;
+
     /** List of words in the user dictionary */
     private WnnWord[] mUserDictionaryWords = null;
 
@@ -344,13 +356,13 @@
     private int mHardShift;
 
     /** SHIFT key state (pressing) */
-	private boolean mShiftPressing;
+    private boolean mShiftPressing;
 
     /** Alt lock status of the Hardware keyboard */
     private int mHardAlt;
 
     /** ALT key state (pressing) */
-	private boolean mAltPressing;
+    private boolean mAltPressing;
 
     /** Shift lock toggle definition */
     private static final int[] mShiftKeyToggle = {0, MetaKeyKeyListener.META_SHIFT_ON, MetaKeyKeyListener.META_CAP_LOCKED};
@@ -384,6 +396,7 @@
         mAutoHideMode = false;
 
         mDelayUpdateHandler = new Handler();
+        mPrevCommitText = new StringBuffer();
     }
 
     /**
@@ -409,11 +422,11 @@
 
     /** @see jp.co.omronsoft.openwnn.OpenWnn#onCreateInputView */
     @Override public View onCreateInputView() {
-    	int hiddenState = getResources().getConfiguration().hardKeyboardHidden;
-    	boolean hidden = (hiddenState == Configuration.HARDKEYBOARDHIDDEN_YES);
-    	((DefaultSoftKeyboardJAJP) mInputViewManager).setHardKeyboardHidden(hidden);
-    	((TextCandidatesViewManager)
-    			mCandidatesViewManager).setHardKeyboardHidden(hidden);
+        int hiddenState = getResources().getConfiguration().hardKeyboardHidden;
+        boolean hidden = (hiddenState == Configuration.HARDKEYBOARDHIDDEN_YES);
+        ((DefaultSoftKeyboardJAJP) mInputViewManager).setHardKeyboardHidden(hidden);
+        ((TextCandidatesViewManager)
+         mCandidatesViewManager).setHardKeyboardHidden(hidden);
 
         return super.onCreateInputView();
     }
@@ -425,6 +438,8 @@
         state.temporaryMode = EngineState.TEMPORARY_DICTIONARY_MODE_NONE;
         updateEngineState(state);
 
+        clearCommitInfo();
+
         if (mDirectInputMode) {
             DefaultSoftKeyboardJAJP inputManager = ((DefaultSoftKeyboardJAJP)mInputViewManager);
             inputManager.setDefaultKeyboard();
@@ -450,40 +465,50 @@
         fitInputType(pref, attribute);
 
         ((TextCandidatesViewManager)mCandidatesViewManager).setAutoHide(true);
+
+        if (isEnableL2Converter()) {
+            mEnableAutoDeleteSpace = false;
+            mConverter.breakSequence();
+        }
     }
 
     /** @see jp.co.omronsoft.openwnn.OpenWnn#hideWindow */
     @Override public void hideWindow() {
         mComposingText.clear();
         mInputViewManager.onUpdateState(this);
+        clearCommitInfo();
         mInputViewManager.closing();
         super.hideWindow();
     }
 
     /** @see jp.co.omronsoft.openwnn.OpenWnn#onComputeInsets */
     @Override public void onComputeInsets(InputMethodService.Insets outInsets) {
-        if (mCandidatesViewManager.getViewType() == CandidatesViewManager.VIEW_TYPE_FULL) {
-            outInsets.touchableInsets = InputMethodService.Insets.TOUCHABLE_INSETS_FRAME;
-        } else {
-            super.onComputeInsets(outInsets);
-        }
-    }
-
-    /** @see jp.co.omronsoft.openwnn.OpenWnn#isFullscreenMode */
-    @Override public boolean isFullscreenMode() {
-        boolean ret;
-        if (mInputViewManager == null) {
-            ret = (mCandidatesViewManager.getViewType() == CandidatesViewManager.VIEW_TYPE_FULL);
-        } else {
-            ret = false;
-        }
-        return ret;
+        /* use default value. means;
+         * outInsets.touchableInsets = InputMethodService.Insets.TOUCHABLE_INSETS_VISIBLE;
+         */
     }
 
     /** @see jp.co.omronsoft.openwnn.OpenWnn#onUpdateSelection */
     @Override public void onUpdateSelection(int oldSelStart, int oldSelEnd, int newSelStart, int newSelEnd, int candidatesStart, int candidatesEnd) {
+
+        mLastSelectionEnd = newSelEnd;
+
         if (mComposingText.size(ComposingText.LAYER1) != 0) {
             updateViewStatus(mTargetLayer, false, true);
+        } else {
+            int commitEnd = mCommitStartCursor + mCommitLength;
+            if ((mCommitLength != 0)
+                && (commitEnd != newSelEnd)
+                && ((newSelEnd < oldSelEnd) || (commitEnd < newSelEnd))) {
+
+                if (isEnableL2Converter()) {
+                    mEnableAutoDeleteSpace = false;
+                    mConverter.breakSequence();
+                }
+
+                clearCommitInfo();
+                initializeScreen();
+            }
         }
     }
 
@@ -508,8 +533,8 @@
                 int hiddenState = newConfig.hardKeyboardHidden;
                 boolean hidden = (hiddenState == Configuration.HARDKEYBOARDHIDDEN_YES);
                 ((DefaultSoftKeyboardJAJP) mInputViewManager).setHardKeyboardHidden(hidden);
-                    ((TextCandidatesViewManager)
-                     mCandidatesViewManager).setHardKeyboardHidden(hidden);
+                ((TextCandidatesViewManager)
+                 mCandidatesViewManager).setHardKeyboardHidden(hidden);
             }
         } catch (Exception ex) {
             /* do nothing if an error occurs. */
@@ -565,7 +590,7 @@
         case OpenWnnEvent.CHANGE_MODE:
             changeEngineMode(ev.mode);
             if (!(ev.mode == ENGINE_MODE_SYMBOL || ev.mode == ENGINE_MODE_EISU_KANA)) {
-            	initializeScreen();
+                initializeScreen();
             }
             
             if (ev.mode != ENGINE_MODE_SYMBOL) {
@@ -587,12 +612,12 @@
             return true;
 
         case OpenWnnEvent.CHANGE_INPUT_VIEW:
-        	setInputView(onCreateInputView());
+            setInputView(onCreateInputView());
             return true;
 
         case OpenWnnEvent.CANDIDATE_VIEW_TOUCH:
             boolean ret;
-                ret = ((TextCandidatesViewManager)mCandidatesViewManager).onTouchSync();
+            ret = ((TextCandidatesViewManager)mCandidatesViewManager).onTouchSync();
             return ret;
 
         default:
@@ -616,27 +641,31 @@
             return false;
         }
         
-        /* notice a break the sequence of input to the converter */
-        View candidateView = mCandidatesViewManager.getCurrentView();
-        if ((candidateView != null) && !candidateView.isShown()
-            && (mComposingText.size(0) == 0)) {
-            if (isEnableL2Converter()) {
-                disableAutoDeleteSpace(ev);
-                mConverter.breakSequence();
-            }
-        }
+        if (!((ev.code == OpenWnnEvent.COMMIT_COMPOSING_TEXT)
+              || ((keyEvent != null)
+                  && ((keyCode == KeyEvent.KEYCODE_SHIFT_LEFT)
+                      || (keyCode == KeyEvent.KEYCODE_SHIFT_RIGHT)
+                      || (keyCode == KeyEvent.KEYCODE_ALT_LEFT)
+                      || (keyCode == KeyEvent.KEYCODE_ALT_RIGHT)
+                      || (keyEvent.isAltPressed() && (keyCode == KeyEvent.KEYCODE_SPACE)))))) {
 
+            clearCommitInfo();
+        }       
+                
         /* change back the dictionary if necessary */
         if (!((ev.code == OpenWnnEvent.SELECT_CANDIDATE)
-        		|| (ev.code == OpenWnnEvent.LIST_CANDIDATES_NORMAL)
-        		|| (ev.code == OpenWnnEvent.LIST_CANDIDATES_FULL)
-        		|| ((keyEvent != null)
-        				&& ((keyCode == KeyEvent.KEYCODE_ALT_LEFT)
-        						||(keyCode == KeyEvent.KEYCODE_ALT_RIGHT)
-        						||(keyEvent.isAltPressed() && (keyCode == KeyEvent.KEYCODE_SPACE)))))) {
-        	state = new EngineState();
-        	state.temporaryMode = EngineState.TEMPORARY_DICTIONARY_MODE_NONE;
-        	updateEngineState(state);
+              || (ev.code == OpenWnnEvent.LIST_CANDIDATES_NORMAL)
+              || (ev.code == OpenWnnEvent.LIST_CANDIDATES_FULL)
+              || ((keyEvent != null)
+                  && ((keyCode == KeyEvent.KEYCODE_SHIFT_LEFT)
+                      ||(keyCode == KeyEvent.KEYCODE_SHIFT_RIGHT)
+                      ||(keyCode == KeyEvent.KEYCODE_ALT_LEFT)
+                      ||(keyCode == KeyEvent.KEYCODE_ALT_RIGHT)
+                      ||(keyEvent.isAltPressed() && (keyCode == KeyEvent.KEYCODE_SPACE)))))) {
+
+            state = new EngineState();
+            state.temporaryMode = EngineState.TEMPORARY_DICTIONARY_MODE_NONE;
+            updateEngineState(state);
         }
 
         if (ev.code == OpenWnnEvent.LIST_CANDIDATES_FULL) {
@@ -737,16 +766,28 @@
             ret = processKeyEvent(keyEvent);
             if (!ret) {
                 mInputConnection.sendKeyEvent(keyEvent);
-				mInputConnection.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, keyEvent.getKeyCode()));
+                mInputConnection.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, keyEvent.getKeyCode()));
                 ret = true;
             }
             break;
 
         case OpenWnnEvent.SELECT_CANDIDATE:
+            boolean hasSetInfo = false;
+            if (isEnableL2Converter()) {
+                setCommitInfo(ev.word.candidate.length());
+                hasSetInfo = true;
+            }
             if (isEnglishPrediction()) {
                 mComposingText.clear();
             }
             mStatus = commitText(ev.word);
+            if (hasSetInfo) {
+                checkCommitInfo();
+            }
+
+            if (mEngineState.isSymbolList()) {
+                mEnableAutoDeleteSpace = false;
+            }
             break;
 
         case OpenWnnEvent.CONVERT:           
@@ -786,8 +827,8 @@
     /**
      * Create a {@link StrSegment} from a character code.
      * <br>
-     * @param charCode		 A character code
-     * @return 			{@link StrSegment} created; {@code null} if an error occurs.
+     * @param charCode           A character code
+     * @return                  {@link StrSegment} created; {@code null} if an error occurs.
      */
     private StrSegment createStrSegment(int charCode) {
         if (charCode == 0) {
@@ -799,8 +840,8 @@
     /**
      * Key event handler.
      *
-     * @param ev  	A key event
-     * @return 	{@code true} if the event is handled in this method.
+     * @param ev        A key event
+     * @return  {@code true} if the event is handled in this method.
      */
     private boolean processKeyEvent(KeyEvent ev) {
         int key = ev.getKeyCode();
@@ -872,7 +913,7 @@
                 }
                 if (!ev.isShiftPressed() && !ev.isShiftPressed()) {
                     updateMetaKeyStateDisplay();
-            	}
+                }
             }
             
             if (str == null) {
@@ -885,11 +926,11 @@
                 return true;
             } else {
                 mEnableAutoInsertSpace = false;
-            	commitText(true);
+                commitText(true);
                 mEnableAutoInsertSpace = true;
-            	commitText(str.string);
+                commitText(str.string);
                 initializeScreen();
-            	return true;
+                return true;
             }
 
         } else if (key == KeyEvent.KEYCODE_SPACE) {
@@ -947,7 +988,7 @@
                 return true;
 
             case KeyEvent.KEYCODE_DPAD_LEFT:
-            	if (!isEnableL2Converter()) {
+                if (!isEnableL2Converter()) {
                     commitText(false);
                     return false;
                 } else {
@@ -956,7 +997,7 @@
                 }
 
             case KeyEvent.KEYCODE_DPAD_RIGHT:
-            	if (!isEnableL2Converter()) {
+                if (!isEnableL2Converter()) {
                     commitText(false);
                     return false;
                 } else {
@@ -966,7 +1007,24 @@
 
             case KeyEvent.KEYCODE_DPAD_CENTER:
             case KeyEvent.KEYCODE_ENTER:
+                boolean hasSetInfo = false;
+            	if (isEnableL2Converter()) {
+                    if (isEnglishPrediction()) {
+                        setCommitInfo(mComposingText.toString(mTargetLayer).length());
+                    } else {
+                        int layer = mTargetLayer;
+                        int cursor = mComposingText.getCursor(layer);
+                        if (0 < cursor) {
+                            String tmp = mComposingText.toString(layer, 0, cursor - 1);
+                            setCommitInfo(tmp.length());
+                        }
+                    }
+                    hasSetInfo = true;
+                }
                 mStatus = commitText(true);
+            	if (hasSetInfo) {
+                    checkCommitInfo();
+                }
                 return true;
 
             case KeyEvent.KEYCODE_CALL:
@@ -1029,10 +1087,10 @@
             updateMetaKeyStateDisplay();
             if (mEngineState.isEnglish()) {
                 ((DefaultSoftKeyboardJAJP) mInputViewManager).changeKeyMode(DefaultSoftKeyboard.KEYMODE_JA_FULL_HIRAGANA);
-            mConverter = mConverterJAJP;
+                mConverter = mConverterJAJP;
             } else {
                 ((DefaultSoftKeyboardJAJP) mInputViewManager).changeKeyMode(DefaultSoftKeyboard.KEYMODE_JA_HALF_ALPHABET);
-            mConverter = mConverterEN;
+                mConverter = mConverterEN;
             }
             mCandidatesViewManager.clearCandidates();
 
@@ -1050,9 +1108,12 @@
                 commitText(" ");
                 mCandidatesViewManager.clearCandidates();
             } else {
+                setCommitInfo(mComposingText.toString(mTargetLayer).length());
                 commitText(true);
                 commitSpaceJustOne();
+                checkCommitInfo();
             }
+            mEnableAutoDeleteSpace = false;
 
         } else {
             /* start consecutive clause conversion if Japanese mode */
@@ -1114,7 +1175,7 @@
             public void run() {
                 int candidates = 0;
                 int cursor = mComposingText.getCursor(ComposingText.LAYER1);
-            if (isEnableL2Converter() || mEngineState.isSymbolList()) {
+                if (isEnableL2Converter() || mEngineState.isSymbolList()) {
                     if (mExactMatchMode) {
                         /* exact matching */
                         candidates = mConverter.predict(mComposingText, 0, cursor);
@@ -1181,7 +1242,7 @@
             }
         } else {
             if (mComposingText.getCursor(ComposingText.LAYER1)
-                    < mComposingText.size(ComposingText.LAYER1)) {
+                < mComposingText.size(ComposingText.LAYER1)) {
                 mComposingText.moveCursor(ComposingText.LAYER1, 1);
             }
         }
@@ -1196,8 +1257,8 @@
      * Handle a key event which is not right or left key when the
      * composing text is empty and some candidates are shown.
      *
-     * @param ev  	A key event
-     * @return		{@code true} if this consumes the event; {@code false} if not.
+     * @param ev        A key event
+     * @return          {@code true} if this consumes the event; {@code false} if not.
      */
     boolean processKeyEventNoInputCandidateShown(KeyEvent ev) {
         boolean ret = true;
@@ -1218,7 +1279,7 @@
             
         case KeyEvent.KEYCODE_DPAD_CENTER:
         case KeyEvent.KEYCODE_BACK:
-        	ret = true;
+            ret = true;
             break;
         
         default:
@@ -1249,7 +1310,7 @@
     /**
      * Update views and the display of the composing text.
      *
-     * @param layer  			 Display layer of the composing text
+     * @param layer                      Display layer of the composing text
      * @param updateCandidates  {@code true} to update the candidates view
      * @param updateEmptyText   {@code false} to update the composing text if it is not empty; {@code true} to update always.
      */
@@ -1360,7 +1421,7 @@
      * Commit the displaying composing text.
      *
      * @param learn  {@code true} to register the committed string to the learning dictionary.
-     * @return 		IME's status after commit
+     * @return          IME's status after commit
      */
     private int commitText(boolean learn) {
         if (isEnglishPrediction()) {
@@ -1398,6 +1459,11 @@
      * Commit all uncommitted words.
      */
     private void commitAllText() {
+        boolean hasSetInfo = false;
+        if (isEnableL2Converter()) {
+            setCommitInfo(mComposingText.toString(mTargetLayer).length());
+            hasSetInfo = true;
+        }
         if (mEngineState.isConvertState()) {
             commitConvertingText();
         } else {
@@ -1405,13 +1471,16 @@
                                      mComposingText.size(ComposingText.LAYER1));
             mStatus = commitText(true);
         }
+        if (hasSetInfo) {
+            checkCommitInfo();
+        }
     }
 
     /**
      * Commit a word.
      *
-     * @param word		A word to commit
-     * @return			IME's status after commit
+     * @param word              A word to commit
+     * @return                  IME's status after commit
      */
     private int commitText(WnnWord word) {
         if (mConverter != null) {
@@ -1427,6 +1496,8 @@
      */
     private void commitText(String str) {
         mInputConnection.commitText(str, (FIX_CURSOR_TEXT_END ? 1 : str.length()));
+        mPrevCommitText.append(str);
+        mCommitLength += str.length();
         mEnableAutoDeleteSpace = true;
         updateViewStatusForPrediction(false, false);
     }
@@ -1435,12 +1506,14 @@
      * Commit a string through {@link InputConnection}.
      *
      * @param string  A string to commit
-     * @return			IME's status after commit
+     * @return                  IME's status after commit
      */
     private int commitTextThroughInputConnection(String string) {
         int layer = mTargetLayer;
 
         mInputConnection.commitText(string, (FIX_CURSOR_TEXT_END ? 1 : string.length()));
+        mPrevCommitText.append(string);
+        
         int cursor = mComposingText.getCursor(layer);
         if (cursor > 0) {
             mComposingText.deleteStrSegment(layer, 0, mComposingText.getCursor(layer) - 1);
@@ -1475,7 +1548,7 @@
     /**
      * Returns whether it is English prediction mode or not.
      *
-     * @return 	{@code true} if it is English prediction mode; otherwise, {@code false}.
+     * @return  {@code true} if it is English prediction mode; otherwise, {@code false}.
      */
     private boolean isEnglishPrediction() {
         return (mEngineState.isEnglish() && isEnableL2Converter());
@@ -1495,11 +1568,13 @@
         case ENGINE_MODE_OPT_TYPE_QWERTY:
             state.keyboard = EngineState.KEYBOARD_QWERTY;
             updateEngineState(state);
+            clearCommitInfo();
             return;
 
         case ENGINE_MODE_OPT_TYPE_12KEY:
             state.keyboard = EngineState.KEYBOARD_12KEY;
             updateEngineState(state);
+            clearCommitInfo();
             return;
 
         case ENGINE_MODE_EISU_KANA:
@@ -1514,7 +1589,6 @@
 
         case ENGINE_MODE_SYMBOL:
             if (mEnableSymbolList && !mDirectInputMode) {
-                initializeScreen();
                 state.temporaryMode = EngineState.TEMPORARY_DICTIONARY_MODE_SYMBOL;
                 updateEngineState(state);
                 updateViewStatusForPrediction(true, true);
@@ -1525,8 +1599,6 @@
             break;
         }
 
-        initializeScreen();
-
         state = new EngineState();
         state.temporaryMode = EngineState.TEMPORARY_DICTIONARY_MODE_NONE;
         updateEngineState(state);
@@ -1732,7 +1804,7 @@
             break;
         }
  
-        switch (target) {
+        switch (mode) {
         case OpenWnnEngineJAJP.DIC_LANG_JP:
         case OpenWnnEngineJAJP.DIC_LANG_EN:
             mPrevDictionarySet = mode;
@@ -1838,12 +1910,15 @@
                 commitText(new String(chars));
             } else {
                 if (isEnglishPrediction()) {
+                    setCommitInfo(mComposingText.toString(mTargetLayer).length());
                     commitText(true);
                     commitSpaceJustOne();
+                    checkCommitInfo();
                 } else {
                     startConvert(EngineState.CONVERT_TYPE_RENBUN);
                 }
             }
+            mEnableAutoDeleteSpace = false;
         } else {
             commitConvertingText();
 
@@ -1879,7 +1954,7 @@
     /**
      * Start consecutive clause conversion or EISU-KANA conversion mode.
      *
-     * @param convertType 		The conversion type({@code EngineState.CONVERT_TYPE_*})
+     * @param convertType               The conversion type({@code EngineState.CONVERT_TYPE_*})
      */
     private void startConvert(int convertType) {
         if (!isEnableL2Converter()) {
@@ -1938,7 +2013,9 @@
             if (m.matches()) {
                 if ((seq.charAt(0) == ' ') && mEnableAutoDeleteSpace) {
                     mInputConnection.deleteSurroundingText(2, 0);
-                    mInputConnection.commitText(seq.subSequence(1, 2), 1);
+                    CharSequence str = seq.subSequence(1, 2);
+                    mInputConnection.commitText(str, 1);
+                    mPrevCommitText.append(str);
                 }
 
                 mDelayUpdateHandler.removeCallbacks(updatePredictionRunnable);
@@ -1967,8 +2044,8 @@
     /**
      * Get the shift key state from the editor.
      *
-     * @param editor	The editor
-     * @return 		State ID of the shift key (0:off, 1:on)
+     * @param editor    The editor
+     * @return          State ID of the shift key (0:off, 1:on)
      */
     protected int getShiftKeyState(EditorInfo editor) {
         return (getCurrentInputConnection().getCursorCapsMode(editor.inputType) == 0) ? 0 : 1;
@@ -2037,7 +2114,7 @@
      * Fits an editor info.
      * 
      * @param preferences  The preference data.
-     * @param info  		The editor info.
+     * @param info              The editor info.
      */
     private void fitInputType(SharedPreferences preference, EditorInfo info) {
         if (info.inputType == EditorInfo.TYPE_NULL) {
@@ -2108,12 +2185,12 @@
             mEnableEmoji = true;
         }
         if (mEnableEmoji) {
-        	mConverterEN.setFilter(null);
-        	mConverterJAJP.setFilter(null);
+            mConverterEN.setFilter(null);
+            mConverterJAJP.setFilter(null);
         } else {
-        	mFilter.setFilter(CandidateFilter.FILTER_EMOJI);
-        	mConverterEN.setFilter(mFilter);
-        	mConverterJAJP.setFilter(mFilter);
+            mFilter.setFilter(CandidateFilter.FILTER_EMOJI);
+            mConverterEN.setFilter(mFilter);
+            mConverterJAJP.setFilter(mFilter);
         }
 
         EngineState state = new EngineState();
@@ -2177,52 +2254,14 @@
     /**
      * Whether the tail of the string is alphabet or not.
      *
-     * @param  str  	The string
-     * @return 		{@code true} if the tail is alphabet; {@code false} if otherwise.
+     * @param  str      The string
+     * @return          {@code true} if the tail is alphabet; {@code false} if otherwise.
      */
     private boolean isAlphabetLast(String str) {
         Matcher m = ENGLISH_CHARACTER.matcher(str);
         return m.matches();
     }
 
-    /**
-     * Disable auto-delete-space.
-     * 
-     * @param ev  An event
-     */
-    private void disableAutoDeleteSpace(OpenWnnEvent ev) {
-        if (mEnableAutoDeleteSpace) {
-            if (!isEnglishPrediction()) {
-                mEnableAutoDeleteSpace = false;
-                return;
-            }
-
-            String input = null;
-            if (ev.code == OpenWnnEvent.TOGGLE_CHAR) {
-                input = ev.toggleTable[0];
-            }
-            
-            try {
-                if ((ev.code == OpenWnnEvent.INPUT_KEY) || (ev.code == OpenWnnEvent.INPUT_SOFT_KEY)) {
-                    input = new String(Character.toChars(ev.keyEvent.getUnicodeChar(0)));
-                } else if (ev.code == OpenWnnEvent.INPUT_CHAR) {
-                	input = new String(ev.chars);
-                }
-            } catch (Exception e) {
-                input = null;
-            }
-            
-            if (input != null) {
-                Matcher m = mEnglishAutoCommitDelimiter.matcher(input);
-                if (!m.matches()) {
-                    mEnableAutoDeleteSpace = false;
-                }
-            } else {
-                mEnableAutoDeleteSpace = false;
-            }
-        }
-    }
-
     /** @see jp.co.omronsoft.openwnn.OpenWnn#onFinishInput */
     @Override public void onFinishInput() {
         if (mInputConnection != null) {
@@ -2248,13 +2287,13 @@
         return true;
     }
 
-	/**
-	 * Handling KeyEvent(KEYUP)
-	 * <br>
-	 * This method is called from {@link #onEvent()}.
-	 *
-	 * @param ev   An up key event
-	 */
+    /**
+     * Handling KeyEvent(KEYUP)
+     * <br>
+     * This method is called from {@link #onEvent()}.
+     *
+     * @param ev   An up key event
+     */
     private void onKeyUpEvent(KeyEvent ev) {
         int key = ev.getKeyCode();
         if(!mShiftPressing){
@@ -2273,6 +2312,42 @@
         }
     }
 
+    /**
+     * Remember the commit test's info.
+     * @param length  length of commit text
+     */
+    private void setCommitInfo(int length) {
+        if (length == 0) {
+            return;
+        }
+        mCommitLength = length;
+        mCommitStartCursor = mLastSelectionEnd - mComposingText.size(mTargetLayer);
+        mPrevCommitText.delete(0, mPrevCommitText.length());
+    }
+    
+    /**
+     * Clear the commit text's info.
+     */
+    private void clearCommitInfo() {
+        mCommitLength = 0;
+        mCommitStartCursor = 0;
+    }
+
+    /**
+     * Verify the commit text.
+     */
+    private void checkCommitInfo() {
+        if (mCommitLength == 0) {
+            return;
+        }
+
+        int composingLength = mComposingText.toString(mTargetLayer).length();
+        CharSequence seq = mInputConnection.getTextBeforeCursor(mCommitLength + composingLength, 0);
+        seq = seq.subSequence(0, seq.length() - composingLength);
+        if (!seq.equals(mPrevCommitText.toString())) {
+            clearCommitInfo();
+    	}
+    }
 }
 
 
diff --git a/src/jp/co/omronsoft/openwnn/OpenWnnZHCN.java b/src/jp/co/omronsoft/openwnn/OpenWnnZHCN.java
index 7295a87..043730c 100644
--- a/src/jp/co/omronsoft/openwnn/OpenWnnZHCN.java
+++ b/src/jp/co/omronsoft/openwnn/OpenWnnZHCN.java
@@ -252,7 +252,7 @@
     /** pre-converter (for symbols) */
     private LetterConverterZH mPreConverterSymbols;
     
-   /** Conversion Engine's state */
+    /** Conversion Engine's state */
     private EngineState mEngineState = new EngineState();
 
     /** Whether learning function is active of not. */
@@ -297,6 +297,18 @@
     /** Regular expression pattern for English separators */
     private  Pattern mEnglishAutoCommitDelimiter = null;
 
+    /** Lenght of committed text */
+    private int mCommitLength = 0;
+
+    /** Last cursor position */
+    private int mLastSelectionEnd = 0;
+
+    /** Cursor position before committing text */
+    private int mCommitStartCursor = 0;
+
+    /** Previous committed text */
+    private StringBuffer mPrevCommitText = null;
+
     /** List of words in the user dictionary */
     private WnnWord[] mUserDictionaryWords = null;
 
@@ -304,13 +316,13 @@
     private int mHardShift;
 
     /** SHIFT key state (pressing) */
-	private boolean mShiftPressing;
+    private boolean mShiftPressing;
 
     /** Alt lock status of the Hardware keyboard */
     private int mHardAlt;
 
     /** ALT key state (pressing) */
-	private boolean mAltPressing;
+    private boolean mAltPressing;
     
     /** Shift lock toggle definition */
     private static final int[] mShiftKeyToggle = {0, MetaKeyKeyListener.META_SHIFT_ON, MetaKeyKeyListener.META_CAP_LOCKED};
@@ -335,8 +347,8 @@
         mInputViewManager  = new DefaultSoftKeyboardZH();
 
         mConverter = mConverterZHCN = new OpenWnnEngineZHCN(
-        		"libWnnZHCNDic.so",
-                "/data/data/jp.co.omronsoft.openwnn/writableZHCN.dic");
+                                                            "libWnnZHCNDic.so",
+                                                            "/data/data/jp.co.omronsoft.openwnn/writableZHCN.dic");
 
         mConverterEN = new OpenWnnEngineEN("/data/data/jp.co.omronsoft.openwnn/writableEN.dic");
         mPreConverter = mPreConverterSymbols = new LetterConverterZH();
@@ -346,6 +358,7 @@
         mAutoHideMode = false;
 
         mDelayUpdateHandler = new Handler();
+        mPrevCommitText = new StringBuffer();
     }
 
     /**
@@ -371,11 +384,11 @@
 
     /** @see jp.co.omronsoft.openwnn.OpenWnn#onCreateInputView */
     @Override public View onCreateInputView() {
-    	int hiddenState = getResources().getConfiguration().hardKeyboardHidden;
-    	boolean hidden = (hiddenState == Configuration.HARDKEYBOARDHIDDEN_YES);
-    	((DefaultSoftKeyboardZH) mInputViewManager).setHardKeyboardHidden(hidden);
-    	((TextCandidatesViewManager)
-    			mCandidatesViewManager).setHardKeyboardHidden(hidden);
+        int hiddenState = getResources().getConfiguration().hardKeyboardHidden;
+        boolean hidden = (hiddenState == Configuration.HARDKEYBOARDHIDDEN_YES);
+        ((DefaultSoftKeyboardZH) mInputViewManager).setHardKeyboardHidden(hidden);
+        ((TextCandidatesViewManager)
+         mCandidatesViewManager).setHardKeyboardHidden(hidden);
 
         return super.onCreateInputView();
     }
@@ -387,6 +400,8 @@
         state.temporaryMode = EngineState.TEMPORARY_DICTIONARY_MODE_NONE;
         updateEngineState(state);
 
+        clearCommitInfo();
+
         if (mDirectInputMode) {
             DefaultSoftKeyboardZH inputManager = ((DefaultSoftKeyboardZH)mInputViewManager);
             inputManager.setDefaultKeyboard();
@@ -412,40 +427,50 @@
         fitInputType(pref, attribute);
 
         ((TextCandidatesViewManager)mCandidatesViewManager).setAutoHide(true);
+
+        if (isEnableL2Converter()) {
+            mEnableAutoDeleteSpace = false;
+            mConverter.breakSequence();
+        }
     }
 
     /** @see jp.co.omronsoft.openwnn.OpenWnn#hideWindow */
     @Override public void hideWindow() {
         mComposingText.clear();
         mInputViewManager.onUpdateState(this);
+        clearCommitInfo();
         mInputViewManager.closing();
         super.hideWindow();
     }
 
     /** @see jp.co.omronsoft.openwnn.OpenWnn#onComputeInsets */
     @Override public void onComputeInsets(InputMethodService.Insets outInsets) {
-        if (mCandidatesViewManager.getViewType() == CandidatesViewManager.VIEW_TYPE_FULL) {
-            outInsets.touchableInsets = InputMethodService.Insets.TOUCHABLE_INSETS_FRAME;
-        } else {
-            super.onComputeInsets(outInsets);
-        }
-    }
-
-    /** @see jp.co.omronsoft.openwnn.OpenWnn#isFullscreenMode */
-    @Override public boolean isFullscreenMode() {
-        boolean ret;
-        if (mInputViewManager == null) {
-            ret = (mCandidatesViewManager.getViewType() == CandidatesViewManager.VIEW_TYPE_FULL);
-        } else {
-            ret = false;
-        }
-        return ret;
+        /* use default value. means;
+         * outInsets.touchableInsets = InputMethodService.Insets.TOUCHABLE_INSETS_VISIBLE;
+         */
     }
 
     /** @see jp.co.omronsoft.openwnn.OpenWnn#onUpdateSelection */
     @Override public void onUpdateSelection(int oldSelStart, int oldSelEnd, int newSelStart, int newSelEnd, int candidatesStart, int candidatesEnd) {
+
+        mLastSelectionEnd = newSelEnd;
+
         if (mComposingText.size(ComposingText.LAYER1) != 0) {
             updateViewStatus(mTargetLayer, false, true);
+        } else {
+            int commitEnd = mCommitStartCursor + mCommitLength;
+            if ((mCommitLength != 0)
+                && (commitEnd != newSelEnd)
+                && ((newSelEnd < oldSelEnd) || (commitEnd < newSelEnd))) {
+
+                if (isEnableL2Converter()) {
+                    mEnableAutoDeleteSpace = false;
+                    mConverter.breakSequence();
+                }
+
+                clearCommitInfo();
+                initializeScreen();
+            }
         }
     }
 
@@ -470,8 +495,8 @@
                 int hiddenState = newConfig.hardKeyboardHidden;
                 boolean hidden = (hiddenState == Configuration.HARDKEYBOARDHIDDEN_YES);
                 ((DefaultSoftKeyboardZH) mInputViewManager).setHardKeyboardHidden(hidden);
-                    ((TextCandidatesViewManager)
-                     mCandidatesViewManager).setHardKeyboardHidden(hidden);
+                ((TextCandidatesViewManager)
+                 mCandidatesViewManager).setHardKeyboardHidden(hidden);
             }
         } catch (Exception ex) {
             /* do nothing if an error occurs. */
@@ -527,7 +552,7 @@
         case OpenWnnEvent.CHANGE_MODE:
             changeEngineMode(ev.mode);
             if (ev.mode != ENGINE_MODE_SYMBOL) {
-            	initializeScreen();
+                initializeScreen();
                 state = new EngineState();
                 state.temporaryMode = EngineState.TEMPORARY_DICTIONARY_MODE_NONE;
                 updateEngineState(state);
@@ -546,12 +571,12 @@
             return true;
 
         case OpenWnnEvent.CHANGE_INPUT_VIEW:
-        	setInputView(onCreateInputView());
+            setInputView(onCreateInputView());
             return true;
 
         case OpenWnnEvent.CANDIDATE_VIEW_TOUCH:
             boolean ret;
-                ret = ((TextCandidatesViewManager)mCandidatesViewManager).onTouchSync();
+            ret = ((TextCandidatesViewManager)mCandidatesViewManager).onTouchSync();
             return ret;
 
         default:
@@ -575,27 +600,31 @@
             return false;
         }
         
-        /* notice a break the sequence of input to the converter */
-        View candidateView = mCandidatesViewManager.getCurrentView();
-        if ((candidateView != null) && !candidateView.isShown()
-            && (mComposingText.size(0) == 0)) {
-            if (isEnableL2Converter()) {
-                disableAutoDeleteSpace(ev);
-                mConverter.breakSequence();
-            }
-        }
+        if (!((ev.code == OpenWnnEvent.COMMIT_COMPOSING_TEXT)
+              || ((keyEvent != null)
+                  && ((keyCode == KeyEvent.KEYCODE_SHIFT_LEFT)
+                      || (keyCode == KeyEvent.KEYCODE_SHIFT_RIGHT)
+                      || (keyCode == KeyEvent.KEYCODE_ALT_LEFT)
+                      || (keyCode == KeyEvent.KEYCODE_ALT_RIGHT)
+                      || (keyEvent.isAltPressed() && (keyCode == KeyEvent.KEYCODE_SPACE)))))) {
+
+            clearCommitInfo();
+        }       
 
         /* change back the dictionary if necessary */
         if (!((ev.code == OpenWnnEvent.SELECT_CANDIDATE)
               || (ev.code == OpenWnnEvent.LIST_CANDIDATES_NORMAL)
-        		|| (ev.code == OpenWnnEvent.LIST_CANDIDATES_FULL)
-        		|| ((keyEvent != null)
-        				&& ((keyCode == KeyEvent.KEYCODE_ALT_LEFT)
-        						||(keyCode == KeyEvent.KEYCODE_ALT_RIGHT)
-        						||(keyEvent.isAltPressed() && (keyCode == KeyEvent.KEYCODE_SPACE)))))) {
-        	state = new EngineState();
-        	state.temporaryMode = EngineState.TEMPORARY_DICTIONARY_MODE_NONE;
-        	updateEngineState(state);
+              || (ev.code == OpenWnnEvent.LIST_CANDIDATES_FULL)
+              || ((keyEvent != null)
+                  && ((keyCode == KeyEvent.KEYCODE_SHIFT_LEFT)
+                      ||(keyCode == KeyEvent.KEYCODE_SHIFT_RIGHT)
+                      ||(keyCode == KeyEvent.KEYCODE_ALT_LEFT)
+                      ||(keyCode == KeyEvent.KEYCODE_ALT_RIGHT)
+                      ||(keyEvent.isAltPressed() && (keyCode == KeyEvent.KEYCODE_SPACE)))))) {
+
+            state = new EngineState();
+            state.temporaryMode = EngineState.TEMPORARY_DICTIONARY_MODE_NONE;
+            updateEngineState(state);
         }
 
         if (ev.code == OpenWnnEvent.LIST_CANDIDATES_FULL) {
@@ -696,16 +725,28 @@
             ret = processKeyEvent(keyEvent);
             if (!ret) {
                 mInputConnection.sendKeyEvent(keyEvent);
-				mInputConnection.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, keyEvent.getKeyCode()));
+                mInputConnection.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, keyEvent.getKeyCode()));
                 ret = true;
             }
             break;
 
         case OpenWnnEvent.SELECT_CANDIDATE:
+            boolean hasSetInfo = false;
+            if (isEnableL2Converter()) {
+                setCommitInfo(ev.word.candidate.length());
+                hasSetInfo = true;
+            }
             if (isEnglishPrediction()) {
                 mComposingText.clear();
             }
             mStatus = commitText(ev.word);
+            if (hasSetInfo) {
+                checkCommitInfo();
+            }
+
+            if (mEngineState.isSymbolList()) {
+                mEnableAutoDeleteSpace = false;
+            }
             break;
 
         case OpenWnnEvent.CONVERT:           
@@ -745,8 +786,8 @@
     /**
      * Create a {@link StrSegment} from a character code.
      * <br>
-     * @param charCode		 A character code
-     * @return 			{@link StrSegment} created; {@code null} if an error occurs.
+     * @param charCode           A character code
+     * @return                  {@link StrSegment} created; {@code null} if an error occurs.
      */
     private StrSegment createStrSegment(int charCode) {
         if (charCode == 0) {
@@ -758,8 +799,8 @@
     /**
      * Key event handler.
      *
-     * @param ev  	A key event
-     * @return 	{@code true} if the event is handled in this method.
+     * @param ev        A key event
+     * @return  {@code true} if the event is handled in this method.
      */
     private boolean processKeyEvent(KeyEvent ev) {
         int key = ev.getKeyCode();
@@ -910,7 +951,7 @@
                 return true;
 
             case KeyEvent.KEYCODE_DPAD_LEFT:
-            	if (!isEnableL2Converter()) {
+                if (!isEnableL2Converter()) {
                     commitText(false);
                     return false;
                 } else {
@@ -919,7 +960,7 @@
                 }
 
             case KeyEvent.KEYCODE_DPAD_RIGHT:
-            	if (!isEnableL2Converter()) {
+                if (!isEnableL2Converter()) {
                     commitText(false);
                     return false;
                 } else {
@@ -929,7 +970,24 @@
 
             case KeyEvent.KEYCODE_DPAD_CENTER:
             case KeyEvent.KEYCODE_ENTER:
+                boolean hasSetInfo = false;
+            	if (isEnableL2Converter()) {
+                    if (isEnglishPrediction()) {
+                        setCommitInfo(mComposingText.toString(mTargetLayer).length());
+                    } else {
+                        int layer = mTargetLayer;
+                        int cursor = mComposingText.getCursor(layer);
+                        if (0 < cursor) {
+                            String tmp = mComposingText.toString(layer, 0, cursor - 1);
+                            setCommitInfo(tmp.length());
+                        }
+                    }
+                    hasSetInfo = true;
+                }
                 mStatus = commitText(true);
+            	if (hasSetInfo) {
+                    checkCommitInfo();
+                }
                 return true;
 
             case KeyEvent.KEYCODE_CALL:
@@ -991,13 +1049,11 @@
             mHardShift = 0;
             updateMetaKeyStateDisplay();
             if (mEngineState.isEnglish()) {
-            
-            	((DefaultSoftKeyboardZH) mInputViewManager).changeKeyMode(DefaultSoftKeyboard.KEYMODE_CN_PINYIN);
-            	mConverter = mConverterZHCN;
+                ((DefaultSoftKeyboardZH) mInputViewManager).changeKeyMode(DefaultSoftKeyboard.KEYMODE_CN_PINYIN);
+                mConverter = mConverterZHCN;
             } else {
-            
-            	((DefaultSoftKeyboardZH) mInputViewManager).changeKeyMode(DefaultSoftKeyboard.KEYMODE_CN_ALPHABET);
-            	mConverter = mConverterEN;
+                ((DefaultSoftKeyboardZH) mInputViewManager).changeKeyMode(DefaultSoftKeyboard.KEYMODE_CN_ALPHABET);
+                mConverter = mConverterEN;
             }
             mCandidatesViewManager.clearCandidates();
 
@@ -1015,9 +1071,12 @@
                 commitText(" ");
                 mCandidatesViewManager.clearCandidates();
             } else {
+                setCommitInfo(mComposingText.toString(mTargetLayer).length());
                 commitText(true);
                 commitSpaceJustOne();
+                checkCommitInfo();
             }
+            mEnableAutoDeleteSpace = false;
 
         } else {
             /* start consecutive clause conversion if Chinese mode */
@@ -1033,8 +1092,8 @@
     /**
      * Handle the character code from the hardware keyboard except the space key.
      *
-     * @param str  		The input character
-     * @param caps 		The state of Caps.
+     * @param str               The input character
+     * @param caps              The state of Caps.
      */
     private void processHardwareKeyboardInputChar(StrSegment str, int caps) {
         if (isEnableL2Converter()) {
@@ -1080,7 +1139,7 @@
             public void run() {
                 int candidates = 0;
                 int cursor = mComposingText.getCursor(ComposingText.LAYER1);
-            if (isEnableL2Converter() || mEngineState.isSymbolList()) {
+                if (isEnableL2Converter() || mEngineState.isSymbolList()) {
                     if (mExactMatchMode) {
                         /* exact matching */
                         candidates = mConverter.predict(mComposingText, 0, cursor);
@@ -1140,7 +1199,7 @@
             }
         } else {
             if (mComposingText.getCursor(ComposingText.LAYER1)
-                    < mComposingText.size(ComposingText.LAYER1)) {
+                < mComposingText.size(ComposingText.LAYER1)) {
                 mComposingText.moveCursor(ComposingText.LAYER1, 1);
             }
         }
@@ -1155,8 +1214,8 @@
      * Handle a key event which is not right or left key when the
      * composing text is empty and some candidates are shown.
      *
-     * @param ev  	A key event
-     * @return		{@code true} if this consumes the event; {@code false} if not.
+     * @param ev        A key event
+     * @return          {@code true} if this consumes the event; {@code false} if not.
      */
     boolean processKeyEventNoInputCandidateShown(KeyEvent ev) {
         boolean ret = true;
@@ -1177,7 +1236,7 @@
             
         case KeyEvent.KEYCODE_DPAD_CENTER:
         case KeyEvent.KEYCODE_BACK:
-        	ret = true;
+            ret = true;
             break;
         
         default:
@@ -1208,7 +1267,7 @@
     /**
      * Update views and the display of the composing text.
      *
-     * @param layer  			 Display layer of the composing text
+     * @param layer                      Display layer of the composing text
      * @param updateCandidates  {@code true} to update the candidates view
      * @param updateEmptyText   {@code false} to update the composing text if it is not empty; {@code true} to update always.
      */
@@ -1314,7 +1373,7 @@
      * Commit the displaying composing text.
      *
      * @param learn  {@code true} to register the committed string to the learning dictionary.
-     * @return 		IME's status after commit
+     * @return          IME's status after commit
      */
     private int commitText(boolean learn) {
         if (isEnglishPrediction()) {
@@ -1352,6 +1411,11 @@
      * Commit all uncommitted words.
      */
     private void commitAllText() {
+        boolean hasSetInfo = false;
+        if (isEnableL2Converter()) {
+            setCommitInfo(mComposingText.toString(mTargetLayer).length());
+            hasSetInfo = true;
+        }
         if (mEngineState.isConvertState()) {
             commitConvertingText();
         } else {
@@ -1359,13 +1423,16 @@
                                      mComposingText.size(ComposingText.LAYER1));
             mStatus = commitText(true);
         }
+        if (hasSetInfo) {
+            checkCommitInfo();
+        }
     }
 
     /**
      * Commit a word.
      *
-     * @param word		A word to commit
-     * @return			IME's status after commit
+     * @param word              A word to commit
+     * @return                  IME's status after commit
      */
     private int commitText(WnnWord word) {
         if (mConverter != null) {
@@ -1381,6 +1448,8 @@
      */
     private void commitText(String str) {
         mInputConnection.commitText(str, (FIX_CURSOR_TEXT_END ? 1 : str.length()));
+        mPrevCommitText.append(str);
+        mCommitLength += str.length();
         mEnableAutoDeleteSpace = true;
         updateViewStatusForPrediction(false, false);
     }
@@ -1388,13 +1457,15 @@
     /**
      * Commit a string through {@link InputConnection}.
      *
-     * @param string	A string to commit
-     * @return			IME's status after commit
+     * @param string    A string to commit
+     * @return                  IME's status after commit
      */
     private int commitTextThroughInputConnection(String string) {
         int layer = mTargetLayer;
 
         mInputConnection.commitText(string, (FIX_CURSOR_TEXT_END ? 1 : string.length()));
+        mPrevCommitText.append(string);
+        
         int cursor = mComposingText.getCursor(layer);
         if (cursor > 0) {
             mComposingText.deleteStrSegment(layer, 0, mComposingText.getCursor(layer) - 1);
@@ -1429,13 +1500,14 @@
     /**
      * Commit a string through {@link InputConnection}.
      *
-     * @param word		A word to commit
-     * @return			IME's status after commit
+     * @param word              A word to commit
+     * @return                  IME's status after commit
      */
     private int commitTextThroughInputConnection(WnnWord word) {
         String string = word.candidate;
         int layer = mTargetLayer;
         mInputConnection.commitText(string, (FIX_CURSOR_TEXT_END ? 1 : string.length()));
+        mPrevCommitText.append(string);
 
         int cursor = word.stroke.length();
         int position = mComposingText.getCursor(layer);
@@ -1477,7 +1549,7 @@
     /**
      * Returns whether it is English prediction mode or not.
      *
-     * @return 	{@code true} if it is English prediction mode; otherwise, {@code false}.
+     * @return  {@code true} if it is English prediction mode; otherwise, {@code false}.
      */
     private boolean isEnglishPrediction() {
         return (mEngineState.isEnglish() && isEnableL2Converter());
@@ -1497,16 +1569,17 @@
         case ENGINE_MODE_OPT_TYPE_QWERTY:
             state.keyboard = EngineState.KEYBOARD_QWERTY;
             updateEngineState(state);
+            clearCommitInfo();
             return;
 
         case ENGINE_MODE_OPT_TYPE_12KEY:
             state.keyboard = EngineState.KEYBOARD_12KEY;
             updateEngineState(state);
+            clearCommitInfo();
             return;
 
         case ENGINE_MODE_SYMBOL:
             if (mEnableSymbolList && !mDirectInputMode) {
-                initializeScreen();
                 state.temporaryMode = EngineState.TEMPORARY_DICTIONARY_MODE_SYMBOL;
                 updateEngineState(state);
                 updateViewStatusForPrediction(true, true);
@@ -1517,8 +1590,6 @@
             break;
         }
 
-        initializeScreen();
-
         state = new EngineState();
         state.temporaryMode = EngineState.TEMPORARY_DICTIONARY_MODE_NONE;
         updateEngineState(state);
@@ -1711,7 +1782,7 @@
             break;
         }
  
-        switch (target) {
+        switch (mode) {
         case OpenWnnEngineZHCN.DIC_LANG_ZHCN:
         case OpenWnnEngineZHCN.DIC_LANG_EN:
             mPrevDictionarySet = mode;
@@ -1809,19 +1880,22 @@
                 commitText(new String(chars));
             } else {
                 if (isEnglishPrediction()) {
+                    setCommitInfo(mComposingText.toString(mTargetLayer).length());
                     commitText(true);
                     commitSpaceJustOne();
+                    checkCommitInfo();
                 } else {
                     startConvert(EngineState.CONVERT_TYPE_RENBUN);
                 }
             }
+            mEnableAutoDeleteSpace = false;
         } else {
             commitConvertingText();
 
             /* Auto-commit a word if it is English and Qwerty mode */
             boolean commit = false;
             if (isEnglishPrediction()
-                    && (mEngineState.keyboard == EngineState.KEYBOARD_QWERTY)) {
+                && (mEngineState.keyboard == EngineState.KEYBOARD_QWERTY)) {
 
                 Matcher m = mEnglishAutoCommitDelimiter.matcher(new String(chars));
                 if (m.matches()) {
@@ -1850,7 +1924,7 @@
     /**
      * Start consecutive clause conversion or EISU-KANA conversion mode.
      *
-     * @param convertType 		The conversion type({@code EngineState.CONVERT_TYPE_*})
+     * @param convertType               The conversion type({@code EngineState.CONVERT_TYPE_*})
      */
     private void startConvert(int convertType) {
         if (!isEnableL2Converter()) {
@@ -1902,7 +1976,9 @@
             if (m.matches()) {
                 if ((seq.charAt(0) == ' ') && mEnableAutoDeleteSpace) {
                     mInputConnection.deleteSurroundingText(2, 0);
-                    mInputConnection.commitText(seq.subSequence(1, 2), 1);
+                    CharSequence str = seq.subSequence(1, 2);
+                    mInputConnection.commitText(str, 1);
+                    mPrevCommitText.append(str);
                 }
 
                 mDelayUpdateHandler.removeCallbacks(updatePredictionRunnable);
@@ -1931,8 +2007,8 @@
     /**
      * Get the shift key state from the editor.
      *
-     * @param editor	The editor
-     * @return 		State ID of the shift key (0:off, 1:on)
+     * @param editor    The editor
+     * @return          State ID of the shift key (0:off, 1:on)
      */
     protected int getShiftKeyState(EditorInfo editor) {
         return (getCurrentInputConnection().getCursorCapsMode(editor.inputType) == 0) ? 0 : 1;
@@ -2001,7 +2077,7 @@
      * Fits an editor info.
      * 
      * @param preferences  The preference data.
-     * @param info  		The editor info.
+     * @param info              The editor info.
      */
     private void fitInputType(SharedPreferences preference, EditorInfo info) {
         if (info.inputType == EditorInfo.TYPE_NULL) {
@@ -2072,12 +2148,12 @@
             mEnableEmoji = true;
         }
         if (mEnableEmoji) {
-        	mConverterEN.setFilter(null);
-        	mConverterZHCN.setFilter(null);
+            mConverterEN.setFilter(null);
+            mConverterZHCN.setFilter(null);
         } else {
-        	mFilter.setFilter(CandidateFilter.FILTER_EMOJI);
-        	mConverterEN.setFilter(mFilter);
-        	mConverterZHCN.setFilter(mFilter);
+            mFilter.setFilter(CandidateFilter.FILTER_EMOJI);
+            mConverterEN.setFilter(mFilter);
+            mConverterZHCN.setFilter(mFilter);
         }
 
         EngineState state = new EngineState();
@@ -2141,52 +2217,14 @@
     /**
      * Whether the tail of the string is alphabet or not.
      *
-     * @param  str  	The string
-     * @return 		{@code true} if the tail is alphabet; {@code false} if otherwise.
+     * @param  str      The string
+     * @return          {@code true} if the tail is alphabet; {@code false} if otherwise.
      */
     private boolean isAlphabetLast(String str) {
         Matcher m = ENGLISH_CHARACTER.matcher(str);
         return m.matches();
     }
 
-    /**
-     * Disable auto-delete-space.
-     * 
-     * @param ev  An event
-     */
-    private void disableAutoDeleteSpace(OpenWnnEvent ev) {
-        if (mEnableAutoDeleteSpace) {
-            if (!isEnglishPrediction()) {
-                mEnableAutoDeleteSpace = false;
-                return;
-            }
-
-            String input = null;
-            if (ev.code == OpenWnnEvent.TOGGLE_CHAR) {
-                input = ev.toggleTable[0];
-            }
-            
-            try {
-                if ((ev.code == OpenWnnEvent.INPUT_KEY) || (ev.code == OpenWnnEvent.INPUT_SOFT_KEY)) {
-                    input = new String(Character.toChars(ev.keyEvent.getUnicodeChar(0)));
-                } else if (ev.code == OpenWnnEvent.INPUT_CHAR) {
-                	input = new String(ev.chars);
-                }
-            } catch (Exception e) {
-                input = null;
-            }
-            
-            if (input != null) {
-                Matcher m = mEnglishAutoCommitDelimiter.matcher(input);
-                if (!m.matches()) {
-                    mEnableAutoDeleteSpace = false;
-                }
-            } else {
-                mEnableAutoDeleteSpace = false;
-            }
-        }
-    }
-
     /** @see jp.co.omronsoft.openwnn.OpenWnn#onFinishInput */
     @Override public void onFinishInput() {
         if (mInputConnection != null) {
@@ -2212,13 +2250,13 @@
         return true;
     }
 
-	/**
-	 * Handling KeyEvent(KEYUP)
-	 * <br>
-	 * This method is called from {@link #onEvent()}.
-	 *
-	 * @param ev   An up key event
-	 */
+    /**
+     * Handling KeyEvent(KEYUP)
+     * <br>
+     * This method is called from {@link #onEvent()}.
+     *
+     * @param ev   An up key event
+     */
     private void onKeyUpEvent(KeyEvent ev) {
         int key = ev.getKeyCode();
         if(!mShiftPressing){
@@ -2237,6 +2275,41 @@
         }
     }
 
+    /**
+     * Remember the commit test's info.
+     * @param length  length of commit text
+     */
+    private void setCommitInfo(int length) {
+        if (length == 0) {
+            return;
+        }
+        mCommitLength = length;
+        mCommitStartCursor = mLastSelectionEnd - mComposingText.size(mTargetLayer);
+    }
+    
+    /**
+     * Clear the commit text's info.
+     */
+    private void clearCommitInfo() {
+        mCommitLength = 0;
+        mCommitStartCursor = 0;
+    }
+
+    /**
+     * Verify the commit text.
+     */
+    private void checkCommitInfo() {
+        if (mCommitLength == 0) {
+            return;
+        }
+
+        int composingLength = mComposingText.toString(mTargetLayer).length();
+        CharSequence seq = mInputConnection.getTextBeforeCursor(mCommitLength + composingLength, 0);
+        seq = seq.subSequence(0, seq.length() - composingLength);
+        if (!seq.equals(mPrevCommitText.toString())) {
+            clearCommitInfo();
+    	}
+    }
 }
 
 
diff --git a/src/jp/co/omronsoft/openwnn/SymbolList.java b/src/jp/co/omronsoft/openwnn/SymbolList.java
index 625c414..7eb6a6f 100644
--- a/src/jp/co/omronsoft/openwnn/SymbolList.java
+++ b/src/jp/co/omronsoft/openwnn/SymbolList.java
@@ -56,12 +56,12 @@
     public static final String SYMBOL_CHINESE = "c1";
 
     /** Key string to get EMOJI symbol list for Japanese */
-	public static final String SYMBOL_JAPANESE_EMOJI = "j_emoji";
+    public static final String SYMBOL_JAPANESE_EMOJI = "j_emoji";
     /** Key string to get face mark list for Japanese */
-	public static final String SYMBOL_JAPANESE_FACE  = "j_face";
+    public static final String SYMBOL_JAPANESE_FACE  = "j_face";
 
     /** The name of XML tag key */
-	private static final String XMLTAG_KEY = "string";
+    private static final String XMLTAG_KEY = "string";
 
     /*
      * DEFINITION OF VARIABLES
@@ -76,7 +76,7 @@
     private ArrayList<String> mCurrentList;
 
     /** Iterator for getting symbols from the list */
-	private Iterator<String> mCurrentListIterator;
+    private Iterator<String> mCurrentListIterator;
 
     /*
      * DEFINITION OF METHODS
@@ -116,14 +116,14 @@
 
         mCurrentList = null;
     }
-	
+    
     /**
      * Get a attribute value from a XML resource.
      *
-     * @param xrp	XML resource
-     * @param name	The attribute name
+     * @param xrp   XML resource
+     * @param name  The attribute name
      *
-     * @return 	The value of the attribute
+     * @return  The value of the attribute
      */
     private String getXmlAttribute(XmlResourceParser xrp, String name) {
         int resId = xrp.getAttributeResourceValue(null, name, 0);
@@ -137,10 +137,10 @@
     /**
      * Load a symbols list from XML resource.
      *
-     * @param id  	XML resource ID
-     * @return		The symbols list
+     * @param id    XML resource ID
+     * @return      The symbols list
      */
-	private ArrayList<String> getXmlfile(int id) {
+    private ArrayList<String> getXmlfile(int id) {
         ArrayList<String> list = new ArrayList<String>();
 
         XmlResourceParser xrp = mWnn.getResources().getXml(id);
@@ -183,10 +183,10 @@
      **********************************************************************/
     /** @see jp.co.omronsoft.openwnn.WnnEngine#init */
     public void init() {}
-	
+    
     /** @see jp.co.omronsoft.openwnn.WnnEngine#close */
     public void close() {}
-	
+    
     /** @see jp.co.omronsoft.openwnn.WnnEngine#predict */
     public int predict(ComposingText text, int minLen, int maxLen) {
         /* ignore if there is no list for the type */
@@ -199,7 +199,7 @@
         mCurrentListIterator = mCurrentList.iterator();
         return 1;
     }
-	
+    
     /** @see jp.co.omronsoft.openwnn.WnnEngine#convert */
     public int convert(ComposingText text) {
         return 0;
@@ -210,7 +210,7 @@
 
     /** @see jp.co.omronsoft.openwnn.WnnEngine#searchWords */
     public int searchWords(WnnWord word) {return 0;}
-	
+    
     /** @see jp.co.omronsoft.openwnn.WnnEngine#getNextCandidate */
     public WnnWord getNextCandidate() {
         if (mCurrentListIterator == null || !mCurrentListIterator.hasNext()) {
@@ -220,16 +220,16 @@
         WnnWord word = new WnnWord(str, str);
         return word;
     }
-	
+    
     /** @see jp.co.omronsoft.openwnn.WnnEngine#learn */
     public boolean learn(WnnWord word) {return false;}
-	
+    
     /** @see jp.co.omronsoft.openwnn.WnnEngine#addWord */
     public int addWord(WnnWord word) {return 0;}
 
     /** @see jp.co.omronsoft.openwnn.WnnEngine#deleteWord */
     public boolean deleteWord(WnnWord word) {return false;}
-	
+    
     /** @see jp.co.omronsoft.openwnn.WnnEngine#setPreferences */
     public void setPreferences(SharedPreferences pref) {}
 
diff --git a/src/jp/co/omronsoft/openwnn/TextCandidatesViewManager.java b/src/jp/co/omronsoft/openwnn/TextCandidatesViewManager.java
index 8de4669..83bec26 100644
--- a/src/jp/co/omronsoft/openwnn/TextCandidatesViewManager.java
+++ b/src/jp/co/omronsoft/openwnn/TextCandidatesViewManager.java
@@ -174,12 +174,13 @@
         this.mEndPositionArray = new ArrayList<Integer>();
         this.mPositionToWordIndexArray = new ArrayList<Integer>();
         this.mWnnWordArray = new ArrayList<WnnWord>();
+        this.mAutoHideMode = true;
     }
 
     /**
      * Set auto-hide mode.
-     * @param hide		{@code true} if the view will hidden when no candidate exists;
-     *					{@code false} if the view is always shown.
+     * @param hide      {@code true} if the view will hidden when no candidate exists;
+     *                  {@code false} if the view is always shown.
      */
     public void setAutoHide(boolean hide) {
         mAutoHideMode = hide;
@@ -208,7 +209,7 @@
         mViewBodyText.setGravity(Gravity.TOP);
         
         mReadMoreText = (TextView)mViewBody.findViewById(R.id.read_more_text);
-    	mReadMoreText.setText(mWnn.getResources().getString(R.string.read_more));
+        mReadMoreText.setText(mWnn.getResources().getString(R.string.read_more));
         mReadMoreText.setTextSize(24.0f);
 
         mPortrait = (height > 450)? true : false;
@@ -231,38 +232,47 @@
         if (readMore) {
             displayCandidates(this.mConverter, false, -1);
         } else { 
-        	if (type == CandidatesViewManager.VIEW_TYPE_NORMAL) {
+            if (type == CandidatesViewManager.VIEW_TYPE_NORMAL) {
                 mIsFullView = false;
-        	    if (mDisplayEndOffset > 0) {
+                if (mDisplayEndOffset > 0) {
                     int maxLine = getMaxLine();
                     displayCandidates(this.mConverter, false, maxLine);
-       	        } else {
-       	        	setReadMore();
-       	        }
-       	    }
+                } else {
+                    setReadMore();
+                }
+            } else {
+                if (mViewBody.isShown()) {
+                	mWnn.setCandidatesViewShown(false);
+                }
+            }
         }
     }
 
     /**
      * Set the view layout
      *
-     * @param type		View type
-     * @return			{@code true} if display is updated; {@code false} if otherwise
+     * @param type      View type
+     * @return          {@code true} if display is updated; {@code false} if otherwise
      */
     private boolean setViewLayout(int type) {
         mViewType = type;
         boolean readMore = false;
         int height;
         if (type == CandidatesViewManager.VIEW_TYPE_CLOSE) {
-            height = 1;
-        } else if (mPortrait) {
+        	mViewBody.setVisibility(View.GONE);
+            return false;
+        }
+        
+        mViewBody.setVisibility(View.VISIBLE);
+
+        if (mPortrait) {
             if (type == CandidatesViewManager.VIEW_TYPE_NORMAL) {
                 mViewBodyScroll.scrollTo(0, 0);
                 height = LINE_HEIGHT * LINE_NUM_PORTRAIT;
                 mViewBodyText.setMaxLines(LINE_NUM_PORTRAIT);
                 mViewBodyText.setLines(LINE_NUM_PORTRAIT);
                 if (mWordCount > 1) {
-                    int displayEndCount = (mWordCountInNormalView != -1)	? mWordCountInNormalView : mWordCount;
+                    int displayEndCount = (mWordCountInNormalView != -1)    ? mWordCountInNormalView : mWordCount;
                     int endPosition = mEndPositionArray.get(displayEndCount - 1);
                     mViewBodyText.setText(mCandidates.subSequence(0, endPosition));
                     mViewBodyText.setSelection(0, 0);
@@ -282,7 +292,7 @@
                 mViewBodyText.setMaxLines(LINE_NUM_LANDSCAPE);
                 mViewBodyText.setLines(LINE_NUM_LANDSCAPE);
                 if (mWordCount > 1) {
-                    int displayEndCount = (mWordCountInNormalView != -1)	? mWordCountInNormalView : mWordCount;
+                    int displayEndCount = (mWordCountInNormalView != -1)    ? mWordCountInNormalView : mWordCount;
                     int endPosition = mEndPositionArray.get(displayEndCount - 1);
                     mViewBodyText.setText(mCandidates.subSequence(0, endPosition));
                     mViewBodyText.setSelection(0, 0);
@@ -311,7 +321,7 @@
 
     /** @see CandidatesViewManager#displayCandidates */
     public void displayCandidates(WnnEngine converter) {
-    	mCanReadMore = false;
+        mCanReadMore = false;
         mDisplayEndOffset = 0;
         mIsFullView = false;
         int maxLine = getMaxLine();
@@ -349,8 +359,8 @@
     /**
      * Count lines using {@link Paint#measureText}.
      *
-     * @param text		The text to display
-     * @return  		Number of lines
+     * @param text      The text to display
+     * @return          Number of lines
      */
     private int countLineUsingMeasureText(CharSequence text) {
         StringBuffer tmpText = new StringBuffer(text);
@@ -404,7 +414,7 @@
         StringBuffer tmp = new StringBuffer();
         tmp.append(mCandidates);
         if ((!dispFirst) && (mLastWord != null) && (mLastWord.candidate.length() != 0)) {
-        	mLineWordCount = -1;
+            mLineWordCount = -1;
 
             StringBuffer displayText = createDisplayText(mLastWord, maxLine);
 
@@ -415,9 +425,9 @@
                 mWnnWordArray.add(mWordCount, mLastWord);
                 int i = 0;
                 for (i = 0 ; i < tmp.length(); i++) {
-                	if (!displayText.subSequence(i, i + 1).equals("\n")) {
-                		break;
-                	}
+                    if (!displayText.subSequence(i, i + 1).equals("\n")) {
+                        break;
+                    }
                 }
                 mStartPositionArray.add(mWordCount, tmp.length() + i);
                 tmp.append(displayText);
@@ -436,15 +446,15 @@
 
             displayText = createDisplayText(result, maxLine);
             if (displayText == null) {
-            	continue;
+                continue;
             }
             
             mWnnWordArray.add(mWordCount, result);
             int i = 0;
             for (i = 0 ; i < tmp.length(); i++) {
-            	if (!displayText.subSequence(i, i + 1).equals("\n")) {
-            		break;
-            	}
+                if (!displayText.subSequence(i, i + 1).equals("\n")) {
+                    break;
+                }
             }
             mStartPositionArray.add(mWordCount, tmp.length() + i);
             tmp.append(displayText);
@@ -455,7 +465,7 @@
             if (mIsFullView) {
                 continue;
             }
-	    
+        
             mViewBodyText.setText(tmp);
             int lineNum = mViewBodyText.getLineCount();
             if (lineNum == 0) {
@@ -465,14 +475,13 @@
                 }
             }
             if (dispFirst &&  lineNum > maxLine) {
-            
                 if (mWordCount == 1) {
-                	setViewLayout(CandidatesViewManager.VIEW_TYPE_FULL);
-                	maxLine = -1;
+                    setViewLayout(CandidatesViewManager.VIEW_TYPE_FULL);
+                    maxLine = -1;
                     mIsFullView = true;
                     continue;
-                }            	
-            	
+                }               
+                
                 mCanReadMore = true;
 
                     mLastWord = result;
@@ -488,10 +497,9 @@
                 mWordCountInNormalView = mWordCount;
                 break;
             } else {
-            
                 if (mWordCount == 1) {
-                	setViewLayout(CandidatesViewManager.VIEW_TYPE_NORMAL);
-                }            	
+                    setViewLayout(CandidatesViewManager.VIEW_TYPE_NORMAL);
+                }               
             }
         }
         
@@ -501,11 +509,11 @@
         int j = 0;
         for (int i = 0; i < mWordCount; i++) {
             while (j <= mEndPositionArray.get(i)) {
-            	if (j < mStartPositionArray.get(i)) {
+                if (j < mStartPositionArray.get(i)) {
                     mPositionToWordIndexArray.add(j,-1);
-            	} else {
+                } else {
                     mPositionToWordIndexArray.add(j,i);
-            	}
+                }
                 j++;
             }
             mPositionToWordIndexArray.add(j,-1);    
@@ -525,10 +533,10 @@
         endPosition += CANDIDATE_SEPARATOR.length();
 
         if (mDisplayEndOffset > 0 && maxLine != -1) {
-        	mCanReadMore = true;
-        	String str = mCandidates.substring(0, mDisplayEndOffset);
-        	StringBuffer sub = new StringBuffer(str);
-        	sub.append(CANDIDATE_SEPARATOR);
+            mCanReadMore = true;
+            String str = mCandidates.substring(0, mDisplayEndOffset);
+            StringBuffer sub = new StringBuffer(str);
+            sub.append(CANDIDATE_SEPARATOR);
             mViewBodyText.setText(sub.subSequence(0, mDisplayEndOffset + CANDIDATE_SEPARATOR.length()));
         } else {
             mViewBodyText.setText(mCandidates.subSequence(0, endPosition));
@@ -554,19 +562,19 @@
      */
     private void setReadMore() {
         if (mCanReadMore && !mIsFullView && !mCandidateDeleteState) {
-        	mReadMoreText.setHeight(mViewHeight);
-        	mReadMoreText.setVisibility(View.VISIBLE);
+            mReadMoreText.setHeight(mViewHeight);
+            mReadMoreText.setVisibility(View.VISIBLE);
         } else {
-        	mReadMoreText.setVisibility(View.GONE);
+            mReadMoreText.setVisibility(View.GONE);
         }
     }
-    	
+        
     /**
      * Create the string to show in the candidate window.
      *
-     * @param word 		A candidate word
-     * @param maxLine	The maximum number of line in the candidate window
-     * @return 		The string to show
+     * @param word      A candidate word
+     * @param maxLine   The maximum number of line in the candidate window
+     * @return      The string to show
      */
     private StringBuffer createDisplayText(WnnWord word, int maxLine) {
         StringBuffer tmp = new StringBuffer();
@@ -579,22 +587,20 @@
         float separatorLength = measureText(p, CANDIDATE_SEPARATOR, 0, CANDIDATE_SEPARATOR.length());
         boolean isFirstWordOfLine = (mLineLength == 0);
 
-   	    int maxWidth = 0;
-  	    int lineLength = 0;
-  	    lineLength += newLineLength;
-  	   
-  	    maxWidth += width - separatorLength;
-  	    
-  	    mLineLength += newLineLength;
+        int maxWidth = 0;
+        int lineLength = 0;
+        lineLength += newLineLength;
+        maxWidth += width - separatorLength;
+        
+        mLineLength += newLineLength;
         mLineLength += separatorLength;
-  	    mLineWordCount++;
+        mLineWordCount++;
 
-  	   
-    	if (mLineWordCount == 0) {
-    		mLineLength = lineLength;
-    		mLineLength += separatorLength;
-    	}
-    	
+        if (mLineWordCount == 0) {
+            mLineLength = lineLength;
+            mLineLength += separatorLength;
+        }
+        
         if (!isFirstWordOfLine && (width < mLineLength) && mLineWordCount != 0) {
             tmp.append("\n");
             mLineLength = lineLength;
@@ -606,61 +612,59 @@
 
     
     /**
-	 * Adjust the width of specified string
+     * Adjust the width of specified string
      *
-     * @param word				A candidate word
-     * @param tmp				A work area
-     * @param newLineLength		The line length to show
-     * @param maxwidth			The maximum number of width that can be displayed in the candidate window
-     * @param maxLine			The maximum number of line in the candidate window
-     * @return 				The string to show
+     * @param word              A candidate word
+     * @param tmp               A work area
+     * @param newLineLength     The line length to show
+     * @param maxwidth          The maximum number of width that can be displayed in the candidate window
+     * @param maxLine           The maximum number of line in the candidate window
+     * @return              The string to show
      */
     private StringBuffer adjustDisplaySize(WnnWord word, StringBuffer tmp, int newLineLength, int maxWidth, int maxLine) {
         StringBuffer string = new StringBuffer(tmp);
-  	   
         if (newLineLength > maxWidth) {
             TextPaint p = mViewBodyText.getPaint();
             float separatorLength = measureText(p, CANDIDATE_SEPARATOR, 0, CANDIDATE_SEPARATOR.length());
-  	        int length = word.candidate.length();
-  	        int size = 0;
-  	        int count = 0;
-  	        int line = 0;
-  	        float LineLength = 0;
-  	        for (int i = 0 ; i < length;i++) {
-  	            string.append(word.candidate.charAt(i));
-   	            LineLength = measureText(p, string, count, count + 1);
-   	            size += LineLength;
-  	            if (size > maxWidth) {
-  	            	line++;
+            int length = word.candidate.length();
+            int size = 0;
+            int count = 0;
+            int line = 0;
+            float LineLength = 0;
+            for (int i = 0 ; i < length;i++) {
+                string.append(word.candidate.charAt(i));
+                LineLength = measureText(p, string, count, count + 1);
+                size += LineLength;
+                if (size > maxWidth) {
+                    line++;
                     string.delete(string.length() - 1, string.length());
                     if (mDisplayEndOffset == 0 && line == maxLine && mWordCount == 0) {
-                    	mDisplayEndOffset = count;
+                        mDisplayEndOffset = count;
                     }
-     	           
                     string.append("\n");
                     string.append(word.candidate.charAt(i));
-     	            size = 0;
-     	            count++;
-       	            LineLength = measureText(p, string, count, count + 1);
-       	            size += LineLength;
-  	    	    }
-   	            count++;
-  	        }
+                    size = 0;
+                    count++;
+                    LineLength = measureText(p, string, count, count + 1);
+                    size += LineLength;
+                }
+                count++;
+            }
 
             mLineWordCount = 0;
             mLineLength = newLineLength;
             mLineLength += separatorLength;
         } else {
-        	string.append(word.candidate);
+            string.append(word.candidate);
         }
         return string;
     }
-    	
-    	
+        
+        
     /** @see CandidatesViewManager#clearCandidates */
     public void clearCandidates() {
         mViewBodyText.setText("");
-	
+    
         mCandidates.delete(0, mCandidates.length());
         mWordCount = 0;
         mWordCountInNormalView = -1;
@@ -669,10 +673,12 @@
         mPositionToWordIndexArray.clear();
         mWnnWordArray.clear();
 
-    	mLineLength = 0;
-    	mLineWordCount = -1;
+        mLineLength = 0;
+        mLineWordCount = -1;
 
-        setViewLayout(CandidatesViewManager.VIEW_TYPE_NORMAL);
+        if (mAutoHideMode) {
+            setViewLayout(CandidatesViewManager.VIEW_TYPE_CLOSE);
+        }
 
         if (mCandidateDeleteState) {
             mViewBodyScroll.removeAllViews();
@@ -685,7 +691,7 @@
         if (mAutoHideMode && mViewBody.isShown()) {
             mWnn.setCandidatesViewShown(false);
         }
-        if(!mAutoHideMode){
+        if (!mAutoHideMode) {
             mCanReadMore = false;
             setReadMore();
         }
@@ -726,7 +732,7 @@
     /**
      * Process CANDIDATE_VIEW_TOUCH event.
      * 
-     * @return		{@code true} if event is processed; {@code false} if otherwise
+     * @return      {@code true} if event is processed; {@code false} if otherwise
      */
     public boolean onTouchSync() {
         if (!mHasCreatedCandidateList) {
@@ -758,28 +764,28 @@
     /**
      * Convert a coordinate into the offset of character
      *
-     * @param x 	The horizontal position
-     * @param y		The vertical position
-     * @return 	The offset of character
+     * @param x     The horizontal position
+     * @param y     The vertical position
+     * @return  The offset of character
      */
-	public int getOffset(int x,int y){
-	    Layout layout = mViewBodyText.getLayout();
-	    int line = layout.getLineForVertical(y);
-	    
-	    if( y >= layout.getLineTop(line+1) ){
-	    	return layout.getText().length();
-	    }
+    public int getOffset(int x,int y){
+        Layout layout = mViewBodyText.getLayout();
+        int line = layout.getLineForVertical(y);
+        
+        if( y >= layout.getLineTop(line+1) ){
+            return layout.getText().length();
+        }
 
-	    int offset = layout.getOffsetForHorizontal(line,x);
+        int offset = layout.getOffsetForHorizontal(line,x);
         offset -= TOUCH_ADJUSTED_VALUE;
         if (offset < 0) {
             offset = 0;
         }
-	    return offset;
-	}
+        return offset;
+    }
 
-	/** from GestureDetector.OnGestureListener class */
-	public boolean onDown(MotionEvent arg0) {
+    /** from GestureDetector.OnGestureListener class */
+    public boolean onDown(MotionEvent arg0) {
         if (!mCandidateDeleteState) {
             int position = getOffset((int)arg0.getX(),(int)arg0.getY());
             int wordIndex = mPositionToWordIndexArray.get(position);
@@ -787,7 +793,7 @@
                 int startPosition = mStartPositionArray.get(wordIndex);
                 int endPosition = 0;
                 if (mDisplayEndOffset > 0 && getViewType() == CandidatesViewManager.VIEW_TYPE_NORMAL) {
-                	endPosition = mDisplayEndOffset + CANDIDATE_SEPARATOR.length();
+                    endPosition = mDisplayEndOffset + CANDIDATE_SEPARATOR.length();
                 } else {
                     endPosition = mEndPositionArray.get(wordIndex);
                 }
@@ -797,11 +803,11 @@
                 mHasStartedSelect = true;
             }
         }
-		return true;
-	}
+        return true;
+    }
 
     /** from GestureDetector.OnGestureListener class */
-	public boolean onFling(MotionEvent arg0, MotionEvent arg1, float arg2, float arg3) {
+    public boolean onFling(MotionEvent arg0, MotionEvent arg1, float arg2, float arg3) {
 
         if (mCandidateDeleteState) {
             return false;
@@ -828,11 +834,11 @@
             }
         }
 
-		return consumed;
-	}
+        return consumed;
+    }
 
     /** from GestureDetector.OnGestureListener class */
-	public void onLongPress(MotionEvent arg0) {
+    public void onLongPress(MotionEvent arg0) {
         if (!mHasStartedSelect) {
             return;
         }
@@ -853,7 +859,7 @@
                 mLinerLayout = new  LinearLayout(mViewBodyScroll.getContext());
                 mLinerLayout.setOrientation(LinearLayout.VERTICAL);
                 Resources r = mViewBodyScroll.getContext().getResources();
-              	int color = r.getColor(R.color.candidate_background);
+                int color = r.getColor(R.color.candidate_background);
                 mLinerLayout.setBackgroundColor(color);
                 TextView text = new TextView(mViewBodyScroll.getContext());
                 text.setText(mWord.candidate);
@@ -873,20 +879,20 @@
                 mViewBodyScroll.addView(mLinerLayout);
             }
         }
-	}
+    }
 
     /** from GestureDetector.OnGestureListener class */
-	public boolean onScroll(MotionEvent arg0, MotionEvent arg1, float arg2,
-			float arg3) {
-		return false;
-	}
+    public boolean onScroll(MotionEvent arg0, MotionEvent arg1, float arg2,
+            float arg3) {
+        return false;
+    }
 
     /** from GestureDetector.OnGestureListener class */
-	public void onShowPress(MotionEvent arg0) {
-	}
+    public void onShowPress(MotionEvent arg0) {
+    }
 
     /** from GestureDetector.OnGestureListener class */
-	public boolean onSingleTapUp(MotionEvent arg0) {
+    public boolean onSingleTapUp(MotionEvent arg0) {
         if (!mHasStartedSelect) {
             return true;
         }
@@ -909,15 +915,15 @@
                 }
             }
         }
-		return false;
-	}
-	
+        return false;
+    }
+    
     /**
      * Create the select button.
      *
      * @return Button The button object
      */
-	private Button createSelectButton(){
+    private Button createSelectButton(){
         final Button selectB;
         selectB= new Button(mViewBodyScroll.getContext()) {
             public boolean onTouchEvent(MotionEvent me) {
@@ -929,10 +935,9 @@
                     break;
                 case MotionEvent.ACTION_UP:
                 default:
-                	d.clearColorFilter();
+                    d.clearColorFilter();
                     break;
                 }
-            
                 return ret;
             }
         };
@@ -943,14 +948,14 @@
         });
         selectB.setText(mSelectBottonText);
         return selectB;
-	}
+    }
 
     /**
      * Create the cancel button
      *
-     * @return Button 		the button object
+     * @return Button       the button object
      */
-	private Button createCancelButton(){
+    private Button createCancelButton(){
         final Button cancelB;
         cancelB= new Button(mViewBodyScroll.getContext()) {
             public boolean onTouchEvent(MotionEvent me) {
@@ -962,18 +967,16 @@
                     break;
                 case MotionEvent.ACTION_UP:
                 default:
-                	d.clearColorFilter();
+                    d.clearColorFilter();
                     break;
                 }
-            
                 return ret;
             }
         };
         cancelB.setOnClickListener(new View.OnClickListener() {
             public void onClick(View v) {
-            	setViewLayout(CandidatesViewManager.VIEW_TYPE_NORMAL);
+                setViewLayout(CandidatesViewManager.VIEW_TYPE_NORMAL);
                 mViewBodyScroll.removeAllViews();
-            
                 mCandidateDeleteState = false;
                 mWnn.onEvent(new OpenWnnEvent(OpenWnnEvent.UPDATE_CANDIDATE));
                 mViewBodyScroll.addView(mViewBodyText);
@@ -981,13 +984,13 @@
         });
         cancelB.setText(mCancelBottonText);
         return cancelB;
-	}
+    }
 
 
     /**
      * Set the show state of hardware keyboard
      * 
-     * @param hidden 	{@code true} if the hardware keyboard is not shown
+     * @param hidden    {@code true} if the hardware keyboard is not shown
      */
     public void setHardKeyboardHidden(boolean hidden) {
         mHardKeyboardHidden = hidden;
@@ -997,11 +1000,11 @@
      * Retrieve the width of string to draw
      * (Emoji is supported by this method)
      * 
-     * @param paint 		The information to draw
-     * @param text			The string
-     * @param start			The start position (specified by the number of character)
-     * @param end 			The end position (specified by the number of character)
-     * @return 			The width of string to draw
+     * @param paint         The information to draw
+     * @param text          The string
+     * @param start         The start position (specified by the number of character)
+     * @param end           The end position (specified by the number of character)
+     * @return          The width of string to draw
      */ 
     public int measureText(TextPaint paint, CharSequence text, int start, int end) {
         return (int)Styled.measureText(paint, new TextPaint(), text, start, end, null);
diff --git a/src/jp/co/omronsoft/openwnn/UserDictionaryToolsEdit.java b/src/jp/co/omronsoft/openwnn/UserDictionaryToolsEdit.java
index bd3355e..40e780f 100644
--- a/src/jp/co/omronsoft/openwnn/UserDictionaryToolsEdit.java
+++ b/src/jp/co/omronsoft/openwnn/UserDictionaryToolsEdit.java
@@ -138,11 +138,11 @@
         Intent intent = getIntent();
         String action = intent.getAction();
         if (action.equals(Intent.ACTION_INSERT)) {
-        	/* add a word */
+            /* add a word */
             mEntryButton.setEnabled(false);
             mRequestState = STATE_INSERT;
         } else if (action.equals(Intent.ACTION_EDIT)) {
-        	/* edit a word */
+            /* edit a word */
             mEntryButton.setEnabled(true);
             mReadEditText.setText(((TextView)sFocusingView).getText());
             mCandidateEditText.setText(((TextView)sFocusingPairView).getText());
@@ -153,7 +153,7 @@
             mBeforeEditWnnWord.stroke = ((TextView)sFocusingView).getText().toString();
             mBeforeEditWnnWord.candidate = ((TextView)sFocusingPairView).getText().toString();
         } else {
-        	/* finish if it is unknown request */
+            /* finish if it is unknown request */
             Log.e("OpenWnn", "onCreate() : Invaled Get Intent. ID=" + intent);
             finish();
             return;
@@ -187,11 +187,11 @@
             public void beforeTextChanged(CharSequence s, int start, int count, int after) {
             }
             public void onTextChanged(CharSequence s, int start, int before, int count) {
-            	if ((mReadEditText.getText().toString().length() != 0) && 
+                if ((mReadEditText.getText().toString().length() != 0) && 
                     (mCandidateEditText.getText().toString().length() != 0)) {
-            		mEntryButton.setEnabled(true);
+                    mEntryButton.setEnabled(true);
                 } else {
-                	mEntryButton.setEnabled(false);
+                    mEntryButton.setEnabled(false);
                 }
             }
         });
@@ -218,21 +218,21 @@
         mEntryButton.setEnabled(false);
         mCancelButton.setEnabled(false);
 
-    	switch (v.getId()) {
+        switch (v.getId()) {
             case R.id.addButton:
-            	/* save the word */
+                /* save the word */
                 doSaveAction();
                 break;
  
             case R.id.cancelButton:
-            	/* cancel the edit */
+                /* cancel the edit */
                 doRevertAction();
                 break;
 
             default:
                 Log.e("OpenWnn", "onClick: Get Invalid ButtonID. ID=" + v.getId());
                 finish();
-            	return;
+                return;
         }
     }
 
@@ -243,7 +243,7 @@
 
         switch (mRequestState) {
         case STATE_INSERT:
-        	/* register a word */
+            /* register a word */
             if (inputDataCheck(mReadEditText) && inputDataCheck(mCandidateEditText)) {
                     String stroke = mReadEditText.getText().toString();
                     String candidate = mCandidateEditText.getText().toString();
@@ -254,7 +254,7 @@
             break;
             
         case STATE_EDIT:
-        	/* edit a word (=delete the word selected & add the word edited) */
+            /* edit a word (=delete the word selected & add the word edited) */
             if (inputDataCheck(mReadEditText) && inputDataCheck(mCandidateEditText)) {
                 deleteDictionary(mBeforeEditWnnWord);
                     String stroke = mReadEditText.getText().toString();
@@ -290,7 +290,7 @@
     @Override protected Dialog onCreateDialog(int id) {
         switch (id) {
             case DIALOG_CONTROL_WORDS_DUPLICATE:
-            	/* there is the same word in the dictionary */
+                /* there is the same word in the dictionary */
                 return new AlertDialog.Builder(UserDictionaryToolsEdit.this)
                         .setIcon(android.R.drawable.ic_dialog_alert)
                         .setMessage(R.string.user_dictionary_words_duplication_message)
@@ -304,8 +304,8 @@
                         .create();
 
             case DIALOG_CONTROL_OVER_MAX_TEXT_SIZE:
-               	/* the length of the word exceeds the limit */
-            	return new AlertDialog.Builder(UserDictionaryToolsEdit.this)
+                /* the length of the word exceeds the limit */
+                return new AlertDialog.Builder(UserDictionaryToolsEdit.this)
                         .setIcon(android.R.drawable.ic_dialog_alert)
                         .setMessage(R.string.user_dictionary_over_max_text_size_message)
                         .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@@ -323,9 +323,9 @@
     /**
      * Add the word
      *
-     * @param  stroke    	The stroke of the word
-     * @param  candidate 	The string of the word
-     * @return           	{@code true} if success; {@code false} if fail.
+     * @param  stroke       The stroke of the word
+     * @param  candidate    The string of the word
+     * @return              {@code true} if success; {@code false} if fail.
      */
     private boolean addDictionary(String stroke, String candidate) {
 
diff --git a/src/jp/co/omronsoft/openwnn/UserDictionaryToolsList.java b/src/jp/co/omronsoft/openwnn/UserDictionaryToolsList.java
index 322f655..e0182bf 100644
--- a/src/jp/co/omronsoft/openwnn/UserDictionaryToolsList.java
+++ b/src/jp/co/omronsoft/openwnn/UserDictionaryToolsList.java
@@ -493,8 +493,8 @@
     /**
      * Delete the specified word
      *
-     * @param  searchword	The information of searching
-     * @return 			{@code true} if success; {@code false} if fail.
+     * @param  searchword   The information of searching
+     * @return          {@code true} if success; {@code false} if fail.
      */
     public boolean deleteWord(WnnWord searchword) {
         OpenWnnEvent event = new OpenWnnEvent(OpenWnnEvent.LIST_WORDS_IN_USER_DICTIONARY,
@@ -620,10 +620,10 @@
     /**
      * Create the list of words.
      *
-     * @param  position		Start position to create the list
-     * @param  max			Maximum number of words to display
-     * @param  self			UserDictionaryToolsList
-     * @return 			{@code true} if more words undisplayed; {@code false} if no more.
+     * @param  position     Start position to create the list
+     * @param  max          Maximum number of words to display
+     * @param  self         UserDictionaryToolsList
+     * @return          {@code true} if more words undisplayed; {@code false} if no more.
      */
     private boolean createWordList(int position ,int max, UserDictionaryToolsList self) {
         boolean ret = true;
@@ -697,7 +697,3 @@
         return ret;
     }
 }
-
-
-
-
diff --git a/src/jp/co/omronsoft/openwnn/WnnDictionary.java b/src/jp/co/omronsoft/openwnn/WnnDictionary.java
index 019b50a..c83d140 100644
--- a/src/jp/co/omronsoft/openwnn/WnnDictionary.java
+++ b/src/jp/co/omronsoft/openwnn/WnnDictionary.java
@@ -23,93 +23,93 @@
  * @author Copyright (C) 2008-2009, OMRON SOFTWARE CO., LTD.  All Rights Reserved.
  */
 public interface WnnDictionary {
-	/*
-	 * DEFINITION OF CONSTANTS
-	 */
+    /*
+     * DEFINITION OF CONSTANTS
+     */
     /**
-	 * Predefined approximate pattern set (capital letters from small letters).
+     * Predefined approximate pattern set (capital letters from small letters).
      * 
      * This pattern includes the rules for ambiguous searching capital letters from small letters.<br>
      * ex. "a" to "A", "b" to "B", ... , "z" to "Z"
      */
-	public static final int APPROX_PATTERN_EN_TOUPPER               = 0;
+    public static final int APPROX_PATTERN_EN_TOUPPER               = 0;
     /**
-	 * Predefined approximate pattern set (small letters from capital letters).
+     * Predefined approximate pattern set (small letters from capital letters).
      *
      * This pattern includes the rules for ambiguous searching small letters from capital letters.<br>
      * ex. "A" to "a", "B" to "b", ... , "Z" to "z"
      */
-	public static final int APPROX_PATTERN_EN_TOLOWER               = 1;
+    public static final int APPROX_PATTERN_EN_TOLOWER               = 1;
     /**
-	 * Predefined approximate pattern set (QWERTY neighbor keys).
+     * Predefined approximate pattern set (QWERTY neighbor keys).
      *
      * This pattern includes the rules for ambiguous searching neighbor keys on QWERTY keyboard.
      * Only alphabet letters are defined; numerical or symbol letters are not defined as the rules.<br>
      * ex. "a" to "q"/"w"/"s"/"z", "b" to "v"/"g"/"h"/"n", ... ,"z" to "a"/"s"/"x"
      */
-	public static final int APPROX_PATTERN_EN_QWERTY_NEAR           = 2;
+    public static final int APPROX_PATTERN_EN_QWERTY_NEAR           = 2;
     /**
-	 * Predefined approximate pattern set (QWERTY neighbor keys/capital letters).
+     * Predefined approximate pattern set (QWERTY neighbor keys/capital letters).
      *
      * This pattern includes the rules for ambiguous searching capital letters of neighbor keys on QWERTY keyboard.
      * Only alphabet letters are defined; numerical or symbol letters are not defined as the rules.<br>
      * ex. "a" to "Q"/"W"/"S"/"Z", "b" to "V"/"G"/"H"/"N", ... ,"z" to "A"/"S"/"X"
      */
-	public static final int APPROX_PATTERN_EN_QWERTY_NEAR_UPPER     = 3;
+    public static final int APPROX_PATTERN_EN_QWERTY_NEAR_UPPER     = 3;
     /**
-	 * Predefined approximate pattern set (for Japanese 12-key keyboard).
+     * Predefined approximate pattern set (for Japanese 12-key keyboard).
      *
      * This pattern includes the standard rules for Japanese multi-tap 12-key keyboard.
      * ex. "&#x306F;" to "&#x3070;"/"&#x3071;", "&#x3064;" to "&#x3063;"/"&#x3065;"
      */
-	public static final int APPROX_PATTERN_JAJP_12KEY_NORMAL        = 4;
+    public static final int APPROX_PATTERN_JAJP_12KEY_NORMAL        = 4;
 
-	/** Search operation mode (exact matching). */
-	public static final int SEARCH_EXACT                            = 0;
-	/** Search operation mode (prefix matching). */
-	public static final int SEARCH_PREFIX                           = 1;
-	/** Search operation mode (link search). */
-	public static final int SEARCH_LINK                             = 2;
+    /** Search operation mode (exact matching). */
+    public static final int SEARCH_EXACT                            = 0;
+    /** Search operation mode (prefix matching). */
+    public static final int SEARCH_PREFIX                           = 1;
+    /** Search operation mode (link search). */
+    public static final int SEARCH_LINK                             = 2;
 
-	/** Sort order (frequency in descending). */
-	public static final int ORDER_BY_FREQUENCY                      = 0;
-	/** Sort order (character code of key string in ascending). */
-	public static final int ORDER_BY_KEY                            = 1;
+    /** Sort order (frequency in descending). */
+    public static final int ORDER_BY_FREQUENCY                      = 0;
+    /** Sort order (character code of key string in ascending). */
+    public static final int ORDER_BY_KEY                            = 1;
 
-	/** Type of a part of speech (V1) */
+    /** Type of a part of speech (V1) */
     public static final int POS_TYPE_V1                             = 0;
-	/** Type of a part of speech (V2) */
+    /** Type of a part of speech (V2) */
     public static final int POS_TYPE_V2                             = 1;
-	/** Type of a part of speech (V3) */
+    /** Type of a part of speech (V3) */
     public static final int POS_TYPE_V3                             = 2;
-	/** Type of a part of speech (Top of sentence) */
+    /** Type of a part of speech (Top of sentence) */
     public static final int POS_TYPE_BUNTOU                         = 3;
-	/** Type of a part of speech (Single chinese character) */
+    /** Type of a part of speech (Single chinese character) */
     public static final int POS_TYPE_TANKANJI                       = 4;
-	/** Type of a part of speech (Numeric) */
+    /** Type of a part of speech (Numeric) */
     public static final int POS_TYPE_SUUJI                          = 5;
-	/** Type of a part of speech (Noun) */
+    /** Type of a part of speech (Noun) */
     public static final int POS_TYPE_MEISI                          = 6;
-	/** Type of a part of speech (Person's name) */
+    /** Type of a part of speech (Person's name) */
     public static final int POS_TYPE_JINMEI                         = 7;
-	/** Type of a part of speech (Place name) */
+    /** Type of a part of speech (Place name) */
     public static final int POS_TYPE_CHIMEI                         = 8;
-	/** Type of a part of speech (Symbol) */
+    /** Type of a part of speech (Symbol) */
     public static final int POS_TYPE_KIGOU                          = 9;
 
-	/** Index of the user dictionary for {@link #setDictionary(int, int, int)} */
+    /** Index of the user dictionary for {@link #setDictionary(int, int, int)} */
     public static final int INDEX_USER_DICTIONARY                   = -1;
     /** Index of the learn dictionary for {@link #setDictionary(int, int, int)} */
     public static final int INDEX_LEARN_DICTIONARY                  = -2;
 
-	
-	/**
-	 * Whether this dictionary module is active.
-	 * @return {@code true} if this dictionary module is active; {@code false} if not.
-	 */
-	public boolean isActive();
-	
-	/**
+    
+    /**
+     * Whether this dictionary module is active.
+     * @return {@code true} if this dictionary module is active; {@code false} if not.
+     */
+    public boolean isActive();
+    
+    /**
      * Set "in use" state.
      *
      * When the flag set true, the user dictionary is locked.
@@ -118,75 +118,75 @@
      */
     public void setInUseState( boolean flag );
 
-	/**
-	 * Clear all dictionary settings.
+    /**
+     * Clear all dictionary settings.
      *
-	 * All the dictionaries are set to be unused.
+     * All the dictionaries are set to be unused.
      *
-	 * @return			0 if success; minus value(error code) if fail.
-	 */
-	public int clearDictionary( );
+     * @return          0 if success; minus value(error code) if fail.
+     */
+    public int clearDictionary( );
 
-	/**
-	 * Sets a dictionary information for using specified dictionary.
+    /**
+     * Sets a dictionary information for using specified dictionary.
      *
      * <p>
-	 * A dictionary information contains parameters:<br>
+     * A dictionary information contains parameters:<br>
      * {@code base} is the bias of frequency for the dictionary.<br>
      * {@code high} is the upper limit of frequency for the dictionary.
      * </p>
      * Searched word's frequency in the dictionary is mapped to the range from {@code base} to {@code high}.
      * <br>
      * The maximum value of {@code base} and {@code high} is 1000.
-	 * To set a dictionary unused, specify -1 to {@code base} and {@code high}.
+     * To set a dictionary unused, specify -1 to {@code base} and {@code high}.
      *
-	 * @param index		A dictionary index
-	 * @param base		The base frequency for the dictionary
-	 * @param high		The maximum frequency for the dictionary
-	 * @return			0 if success; minus value(error code) if fail.
-	 */
-	public int setDictionary(int index, int base, int high );
+     * @param index     A dictionary index
+     * @param base      The base frequency for the dictionary
+     * @param high      The maximum frequency for the dictionary
+     * @return          0 if success; minus value(error code) if fail.
+     */
+    public int setDictionary(int index, int base, int high );
 
-	/**
-	 * Clears approximate patterns.
+    /**
+     * Clears approximate patterns.
      *
-	 * This clears all approximate search patterns in the search condition.
-	 */
-	public void clearApproxPattern( );
+     * This clears all approximate search patterns in the search condition.
+     */
+    public void clearApproxPattern( );
 
-	/**
-	 * Sets a approximate pattern.
+    /**
+     * Sets a approximate pattern.
      *
-	 * This adds an approximate search pattern(replacement of character) to the search condition.
+     * This adds an approximate search pattern(replacement of character) to the search condition.
      * The pattern rule is defined as replacing a character({@code src}) to characters({@code dst}).
      * <br>
      * The length of {@code src} must be 1 and the length of {@code dst} must be lower than 4.<br>
      * The maximum count of approximate patterns is 255.
      *
-	 * @param src		A character replace from
-	 * @param dst		Characters replace to
-	 * @return			0 if success; minus value(error code) if fail.
-	 */
-	public int setApproxPattern( String src, String dst );
+     * @param src       A character replace from
+     * @param dst       Characters replace to
+     * @return          0 if success; minus value(error code) if fail.
+     */
+    public int setApproxPattern( String src, String dst );
 
-	/**
-	 * Sets a predefined approximate pattern.
+    /**
+     * Sets a predefined approximate pattern.
      *
-	 * The patterns included predefined approximate search pattern set specified by
-	 * {@code approxPattern} are added to the search condition.
-	 *
-	 * @param approxPattern		A predefined approximate pattern set
+     * The patterns included predefined approximate search pattern set specified by
+     * {@code approxPattern} are added to the search condition.
+     *
+     * @param approxPattern     A predefined approximate pattern set
      * @see jp.co.omronsoft.openwnn.WnnDictionary#APPROX_PATTERN_EN_TOUPPER
      * @see jp.co.omronsoft.openwnn.WnnDictionary#APPROX_PATTERN_EN_TOLOWER
      * @see jp.co.omronsoft.openwnn.WnnDictionary#APPROX_PATTERN_EN_QWERTY_NEAR
      * @see jp.co.omronsoft.openwnn.WnnDictionary#APPROX_PATTERN_EN_QWERTY_NEAR_UPPER
      *
-	 * @return					0 if success; minus value(error code) if fail.
-	 */
-	public int setApproxPattern( int approxPattern );
+     * @return                  0 if success; minus value(error code) if fail.
+     */
+    public int setApproxPattern( int approxPattern );
 
-	/**
-	 * Search words from dictionaries with specified conditions.
+    /**
+     * Search words from dictionaries with specified conditions.
      * <p>
      * To get the searched word's information, use {@link #getNextWord()}.<br>
      * If a same word existed in the set of dictionary, the search result may contain some same words.<br>
@@ -211,22 +211,22 @@
      * </table>
      * </p>
      *
-	 * @param operation		The search operation
+     * @param operation     The search operation
      * @see jp.co.omronsoft.openwnn.WnnDictionary#SEARCH_EXACT
      * @see jp.co.omronsoft.openwnn.WnnDictionary#SEARCH_PREFIX
-	 * @param order			The sort order
+     * @param order         The sort order
      * @see jp.co.omronsoft.openwnn.WnnDictionary#ORDER_BY_FREQUENCY
      * @see jp.co.omronsoft.openwnn.WnnDictionary#ORDER_BY_KEY
-	 * @param keyString		The key string
+     * @param keyString     The key string
      *
      * @see jp.co.omronsoft.openwnn.WnnDictionary#getNextWord
      *
-	 * @return				0 if no word is found; 1 if some words found; minus value if a error occurs.
-	 */
-	public int searchWord(int operation, int order, String keyString );
+     * @return              0 if no word is found; 1 if some words found; minus value if a error occurs.
+     */
+    public int searchWord(int operation, int order, String keyString );
 
     /**
-	 * Search words from dictionaries with specified conditions and previous word.
+     * Search words from dictionaries with specified conditions and previous word.
      * <p>
      * For using link search function, specify the {@code wnnWord} as previous word and
      * set {@code SEARCH_LINK} mode to {@code operation}. The other arguments are
@@ -235,54 +235,54 @@
      * If the prediction dictionary for reading is set to use, the previous word must contain
      * the {@code stroke} and the {@code candidate} information. If the prediction dictionary
      * for part of speech is set to use, the previous word must contain the {@code partOfSpeech} information.
-	 *
+     *
      * @param wnnWord       The previous word
      * @see jp.co.omronsoft.openwnn.WnnDictionary#searchWord
      * 
-	 * @return				0 if no word is found; 1 if some words found; minus value if a error occurs.
+     * @return              0 if no word is found; 1 if some words found; minus value if a error occurs.
      */
-	public int searchWord(int operation, int order, String keyString, WnnWord wnnWord );
+    public int searchWord(int operation, int order, String keyString, WnnWord wnnWord );
 
-	/**
-	 * Retrieve a searched word information.
+    /**
+     * Retrieve a searched word information.
      *
      * It returns a word information from top of the {@code searchWord()}'s result.
      * To get all word's information of the result, call this method repeatedly until it returns null.
      *
-	 * @return				An instance of WnnWord; null if no result or an error occurs.
-	 */
-	public WnnWord getNextWord( );
+     * @return              An instance of WnnWord; null if no result or an error occurs.
+     */
+    public WnnWord getNextWord( );
 
-	/**
-	 * Retrieve a searched word information with condition of length.
+    /**
+     * Retrieve a searched word information with condition of length.
      *
      * It returns a word information from top of the {@code searchWord()}'s result.
      * To get all word's information of the result, call this method repeatedly until it returns null.
      *
-     * @param length	>0 if only the result of specified length is retrieved; 0 if no condition exist
-	 * @return			An instance of WnnWord; null if no result or an error occurs.
-	 */
-	public WnnWord getNextWord( int length );
+     * @param length    >0 if only the result of specified length is retrieved; 0 if no condition exist
+     * @return          An instance of WnnWord; null if no result or an error occurs.
+     */
+    public WnnWord getNextWord( int length );
 
     /**
      * Retrieve all word in the user dictionary.
      *
-     * @return			The array of WnnWord objects.
+     * @return          The array of WnnWord objects.
      */
     public WnnWord[] getUserDictionaryWords( );
 
     /**
      * Retrieve the connect matrix.
      *
-     * @return			The array of the connect matrix; null if an error occurs.
+     * @return          The array of the connect matrix; null if an error occurs.
      */
     public byte[][] getConnectMatrix( );
 
     /**
      * Retrieve the part of speech information specified POS type.
      *
-     * @param type		The type of a part of speech
-     * @return			The part of speech information; null if invalid type is specified or  an error occurs.
+     * @param type      The type of a part of speech
+     * @return          The part of speech information; null if invalid type is specified or  an error occurs.
      *
      * @see jp.co.omronsoft.openwnn.WnnDictionary#POS_TYPE_V1
      * @see jp.co.omronsoft.openwnn.WnnDictionary#POS_TYPE_V2
@@ -300,60 +300,60 @@
     /**
      * Clear the user dictionary.
      * 
-     * @return		0 if no error occur; <0 if an error occur
+     * @return      0 if no error occur; <0 if an error occur
      */
     public int clearUserDictionary();
     /**
      * Clear the learn dictionary.
      * 
-     * @return		0 if no error occur; <0 if an error occur
+     * @return      0 if no error occur; <0 if an error occur
      */
     public int clearLearnDictionary();
 
     /**
      * Add the words to user dictionary.
      *
-     * @param word		The array of word
-     * @return			0 if no error occur; <0 if an error occur
+     * @param word      The array of word
+     * @return          0 if no error occur; <0 if an error occur
      */
     public int addWordToUserDictionary( WnnWord[] word );
     /**
      * Add the word to user dictionary.
      *
-     * @param word		The word
-     * @return			0 if no error occur; <0 if an error occur
+     * @param word      The word
+     * @return          0 if no error occur; <0 if an error occur
      */
     public int addWordToUserDictionary( WnnWord word );
 
     /**
      * Remove the words from user dictionary.
      *
-     * @param word  	The array of word
-     * @return			0 if no error occur; <0 if an error occur
+     * @param word      The array of word
+     * @return          0 if no error occur; <0 if an error occur
      */
     public int removeWordFromUserDictionary( WnnWord[] word );
     /**
      * Remove the word from user dictionary.
      *
-     * @param word  	The word
-     * @return			0 if no error occur; <0 if an error occur
+     * @param word      The word
+     * @return          0 if no error occur; <0 if an error occur
      */
     public int removeWordFromUserDictionary( WnnWord word );
 
     /**
      * Learn the word.
      *
-     * @param word  	The word for learning
-     * @return			0 if no error occur; <0 if an error occur
+     * @param word      The word for learning
+     * @return          0 if no error occur; <0 if an error occur
      */
     public int learnWord( WnnWord word );
 
     /**
      * Learn the word with connection.
      *
-     * @param word          	The word for learning
-     * @param previousWord		The word for link learning
-     * @return					0 if no error occur; <0 if an error occur
+     * @param word              The word for learning
+     * @param previousWord      The word for link learning
+     * @return                  0 if no error occur; <0 if an error occur
      */
     public int learnWord( WnnWord word, WnnWord previousWord );
 }
diff --git a/src/jp/co/omronsoft/openwnn/WnnEngine.java b/src/jp/co/omronsoft/openwnn/WnnEngine.java
index 491475b..4d23966 100644
--- a/src/jp/co/omronsoft/openwnn/WnnEngine.java
+++ b/src/jp/co/omronsoft/openwnn/WnnEngine.java
@@ -53,10 +53,10 @@
     /**
      * Predict words/phrases.
      * <br>
-     * @param text   	The input string
-     * @param minLen 	The minimum length of a word to predict (0  : no limit)
-     * @param maxLen 	The maximum length of a word to predict (-1 : no limit)
-     * @return			Plus value if there are candidates; 0 if there is no candidate; minus value if a error occurs.
+     * @param text      The input string
+     * @param minLen    The minimum length of a word to predict (0  : no limit)
+     * @param maxLen    The maximum length of a word to predict (-1 : no limit)
+     * @return          Plus value if there are candidates; 0 if there is no candidate; minus value if a error occurs.
      */
     public int predict(ComposingText text, int minLen, int maxLen);
 
@@ -70,24 +70,24 @@
      * The result of conversion is set into the layer 2 in the {@link ComposingText}.
      * To get other candidates of each clause, call {@link #makeCandidateListOf(int)}.
      *
-     * @param text   	The input string
-     * @return 		Plus value if there are candidates; 0 if there is no candidate; minus value if a error occurs.
+     * @param text      The input string
+     * @return      Plus value if there are candidates; 0 if there is no candidate; minus value if a error occurs.
      */
     public int convert(ComposingText text);
 
     /**
      * Search words from the dictionaries.
      * <br>
-     * @param key  		The search key (stroke)
-     * @return 		Plus value if there are candidates; 0 if there is no candidate; minus value if a error occurs.
+     * @param key       The search key (stroke)
+     * @return      Plus value if there are candidates; 0 if there is no candidate; minus value if a error occurs.
      */
     public int searchWords(String key);
 
     /**
      * Search words from the dictionaries.
      * <br>
-     * @param word  	A word to search
-     * @return			Plus value if there are candidates; 0 if there is no candidate; minus value if a error occurs.
+     * @param word      A word to search
+     * @return          Plus value if there are candidates; 0 if there is no candidate; minus value if a error occurs.
      */
     public int searchWords(WnnWord word);
 
@@ -101,14 +101,14 @@
      * {@link #makeCandidateListOf(int)}, in increasing character code order for
      * {@code searchWords()}.
      *
-     * @return			The candidate; {@code null} if there is no more candidate.
+     * @return          The candidate; {@code null} if there is no more candidate.
      */
     public WnnWord getNextCandidate();
 
     /**
      * Retrieve the list of registered words.
      * <br>
-     * @return			{@code null} if no word is registered; the array of {@link WnnWord} if some words is registered.
+     * @return          {@code null} if no word is registered; the array of {@link WnnWord} if some words is registered.
      */
     public WnnWord[] getUserDictionaryWords();
 
@@ -119,41 +119,41 @@
      * candidates to the learning dictionary or update the frequency
      * of the word.
      *
-     * @param word		The selected word
-     * @return			{@code true} if success; {@code false} if fail or not supported.
+     * @param word      The selected word
+     * @return          {@code true} if success; {@code false} if fail or not supported.
      */
     public boolean learn(WnnWord word);
 
     /**
      * Register a word to the user's dictionary.
      * <br>
-     * @param word		A word to register
-     * @return			Number of registered words in the user's dictionary after the operation; minus value if a error occurs.
+     * @param word      A word to register
+     * @return          Number of registered words in the user's dictionary after the operation; minus value if a error occurs.
      */
     public int addWord(WnnWord word);
 
     /**
      * Delete a word from the user's dictionary.
      * <br>
-     * @param word		A word to delete
-     * @return			{@code true} if success; {@code false} if fail or not supported.
+     * @param word      A word to delete
+     * @return          {@code true} if success; {@code false} if fail or not supported.
      */
     public boolean deleteWord(WnnWord word);
 
     /**
      * Delete all words from the user's dictionary.
      * <br>
-     * @param dictionary	{@code DICTIONARY_TYPE_LEARN} or {@code DICTIONARY_TYPE_USER}
-     * @return				{@code true} if success; {@code false} if fail or not supported.
+     * @param dictionary    {@code DICTIONARY_TYPE_LEARN} or {@code DICTIONARY_TYPE_USER}
+     * @return              {@code true} if success; {@code false} if fail or not supported.
      */
     public boolean initializeDictionary(int dictionary);
 
     /**
      * Delete all words from the user's dictionary of the specified language.
      * <br>
-     * @param dictionary		{@code DICTIONARY_TYPE_LEARN} or {@code DICTIONARY_TYPE_USER}
-     * @param type				Dictionary type (language, etc...)
-     * @return					{@code true} if success; {@code false} if fail or not supported.
+     * @param dictionary        {@code DICTIONARY_TYPE_LEARN} or {@code DICTIONARY_TYPE_USER}
+     * @param type              Dictionary type (language, etc...)
+     * @return                  {@code true} if success; {@code false} if fail or not supported.
      */
     public boolean initializeDictionary(int dictionary, int type);
 
@@ -183,7 +183,7 @@
      * To get the elements of the list, call {@link #getNextCandidate()}.
      *
      * @param clausePosition  The position of a clause
-     * @return					Plus value if there are candidates; 0 if there is no candidate; minus value if a error occurs.
+     * @return                  Plus value if there are candidates; 0 if there is no candidate; minus value if a error occurs.
      */
     public int makeCandidateListOf(int clausePosition);
 }
diff --git a/src/jp/co/omronsoft/openwnn/WnnWord.java b/src/jp/co/omronsoft/openwnn/WnnWord.java
index 86c5a57..fb2f7c6 100644
--- a/src/jp/co/omronsoft/openwnn/WnnWord.java
+++ b/src/jp/co/omronsoft/openwnn/WnnWord.java
@@ -22,14 +22,14 @@
  * @author Copyright (C) 2008-2009, OMRON SOFTWARE CO., LTD.  All Rights Reserved.
  */
 public class WnnWord {
-	/** The word's Id */
-	public int      id;
-	/** The string of this word. */
-	public String   candidate;
-	/** The reading of this word. */
-	public String   stroke;
-	/** The score of this word. */
-	public int      frequency;
+    /** The word's Id */
+    public int      id;
+    /** The string of this word. */
+    public String   candidate;
+    /** The reading of this word. */
+    public String   stroke;
+    /** The score of this word. */
+    public int      frequency;
     /** The part of speech this word. */
     public WnnPOS   partOfSpeech;
     /** The attribute of this word when it is assumed a candidate. */
diff --git a/src/jp/co/omronsoft/openwnn/ZH/DefaultSoftKeyboardZH.java b/src/jp/co/omronsoft/openwnn/ZH/DefaultSoftKeyboardZH.java
index 96fa418..139c4a8 100644
--- a/src/jp/co/omronsoft/openwnn/ZH/DefaultSoftKeyboardZH.java
+++ b/src/jp/co/omronsoft/openwnn/ZH/DefaultSoftKeyboardZH.java
@@ -176,6 +176,11 @@
 
     /** @see jp.co.omronsoft.openwnn.DefaultSoftKeyboard#onKey */
     @Override public void onKey(int primaryCode, int[] keyCodes) {
+
+        if (mDisableKeyInput) {
+            return;
+        }
+
         switch (primaryCode) {
         case KEYCODE_QWERTY_TOGGLE_MODE:
             nextKeyMode();
@@ -268,6 +273,8 @@
         mEnableAutoCaps = pref.getBoolean("auto_caps", true);
         mFixedKeyMode = INVALID_KEYMODE;
         mPreferenceKeyMode = INVALID_KEYMODE;
+        mNoInput = true;
+        mDisableKeyInput = false;
 
         switch (inputType & EditorInfo.TYPE_MASK_CLASS) {
 
@@ -312,7 +319,9 @@
     /** @see jp.co.omronsoft.openwnn.DefaultSoftKeyboard#onUpdateState */
     @Override public void onUpdateState(OpenWnn parent) {
         super.onUpdateState(parent);
-        setShiftByEditorInfo();
+        if (!mCapsLock) {
+            setShiftByEditorInfo();
+        }
     }
 
     /**