X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Finput.c;h=9edb55ebdada1576219b90dd540c610f5978648b;hb=6641826b5febdf5917ff0fe97c2515a424c990be;hp=2b31a316ba33c94bf5557b7d2865582509b89b23;hpb=b5b8aa7815757a933f7fc8174781e1df34303de6;p=m17n%2Fm17n-lib.git diff --git a/src/input.c b/src/input.c index 2b31a31..9edb55e 100644 --- a/src/input.c +++ b/src/input.c @@ -174,7 +174,7 @@ static MSymbol Mtitle, Mmacro, Mmodule, Mstate, Minclude; /** Symbols for actions. */ static MSymbol Minsert, Mdelete, Mmark, Mmove, Mpushback, Mundo, Mcall, Mshift; -static MSymbol Mselect, Mshow, Mhide, Mcommit, Munhandle; +static MSymbol Mselect, Mshow, Mhide, Mcommit, Munhandle, Mpop; static MSymbol Mset, Madd, Msub, Mmul, Mdiv, Mequal, Mless, Mgreater; static MSymbol Mless_equal, Mgreater_equal; static MSymbol Mcond; @@ -402,6 +402,7 @@ fully_initialize () Mmove = msymbol ("move"); Mmark = msymbol ("mark"); Mpushback = msymbol ("pushback"); + Mpop = msymbol ("pop"); Mundo = msymbol ("undo"); Mcall = msymbol ("call"); Mshift = msymbol ("shift"); @@ -513,7 +514,7 @@ get_surrounding_text (MInputContext *ic, int len) MText *mt = NULL; mplist_push (ic->plist, Minteger, (void *) len); - if (minput__callback (ic, Minput_get_surrounding_text) >= 0 + if (minput_callback (ic, Minput_get_surrounding_text) >= 0 && MPLIST_MTEXT_P (ic->plist)) mt = MPLIST_MTEXT (ic->plist); mplist_pop (ic->plist); @@ -526,7 +527,7 @@ delete_surrounding_text (MInputContext *ic, int pos) MInputContextInfo *ic_info = (MInputContextInfo *) ic->info; mplist_push (ic->plist, Minteger, (void *) pos); - minput__callback (ic, Minput_delete_surrounding_text); + minput_callback (ic, Minput_delete_surrounding_text); mplist_pop (ic->plist); if (pos < 0) { @@ -564,6 +565,8 @@ get_preceding_char (MInputContext *ic, int pos) M17N_OBJECT_UNREF (ic_info->preceding_text); ic_info->preceding_text = mt; } + else + M17N_OBJECT_UNREF (mt); } else ic_info->preceding_text = mt; @@ -596,6 +599,8 @@ get_following_char (MInputContext *ic, int pos) M17N_OBJECT_UNREF (ic_info->following_text); ic_info->following_text = mt; } + else + M17N_OBJECT_UNREF (mt); } else ic_info->following_text = mt; @@ -654,7 +659,12 @@ integer_value (MInputContext *ic, MPlist *arg, MPlist **value, int surrounding) return get_preceding_char (ic, 0); pos = ic->cursor_pos + pos; if (pos < 0) - return get_preceding_char (ic, - pos); + { + if (ic->produced && mtext_len (ic->produced) + pos >= 0) + return mtext_ref_char (ic->produced, + mtext_len (ic->produced) + pos); + return get_preceding_char (ic, - pos); + } if (pos >= len) return get_following_char (ic, pos - len + 1); } @@ -814,7 +824,7 @@ parse_action_list (MPlist *plist, MPlist *macros) } else if (MPLIST_PLIST_P (pl)) { - MPLIST_DO (pl, pl) + MPLIST_DO (pl, MPLIST_PLIST (pl)) { if (MPLIST_PLIST_P (pl)) { @@ -906,7 +916,8 @@ parse_action_list (MPlist *plist, MPlist *macros) MERROR (MERROR_IM, -1); } else if (action_name == Mshow || action_name == Mhide - || action_name == Mcommit || action_name == Munhandle) + || action_name == Mcommit || action_name == Munhandle + || action_name == Mpop) ; else if (action_name == Mcond) { @@ -1437,14 +1448,12 @@ update_custom_info (void) if (! MPLIST_SYMBOL_P (p)) continue; name = MPLIST_SYMBOL (p); - if (language == Mnil || name == Mnil) - continue; p = MPLIST_NEXT (p); if (MPLIST_TAIL_P (p)) extra = Mnil; else if (MPLIST_SYMBOL_P (p)) extra = MPLIST_SYMBOL (p); - else + if (language == Mnil || (name == Mnil && extra == Mnil)) continue; im_info = new_im_info (NULL, language, name, extra, im_custom_list); load_im_info (im_data, im_info); @@ -1570,6 +1579,19 @@ reload_im_info (MInputMethodInfo *im_info) fini_im_info (im_info); load_im_info (plist, im_info); M17N_OBJECT_UNREF (plist); + if (! im_info->cmds) + im_info->cmds = mplist (); + if (! im_info->vars) + im_info->vars = mplist (); + if (! im_info->title) + { + MSymbol name = im_info->name; + + im_info->title = (name == Mnil ? mtext () + : mtext_from_data (MSYMBOL_NAME (name), + MSYMBOL_NAMELEN (name), + MTEXT_FORMAT_US_ASCII)); + } return 1; } @@ -1722,52 +1744,52 @@ config_command (MPlist *plist, MPlist *global_cmds, MPlist *custom_cmds, MPlist *global = NULL, *custom = NULL, *config = NULL; MSymbol name; MSymbol status; - MPlist *description = NULL, *keyseq; + MPlist *description, *keyseq; + + if (global_cmds && (global = mplist__assq (global_cmds, name))) + global = MPLIST_NEXT (MPLIST_PLIST (global)); name = MPLIST_SYMBOL (plist); plist = MPLIST_NEXT (plist); if (MPLIST_MTEXT_P (plist) || MPLIST_PLIST_P (plist)) - description = plist; - else if (global_cmds && ((global = mplist__assq (global_cmds, name)))) - description = global = MPLIST_NEXT (MPLIST_PLIST (global)); - if (MPLIST_TAIL_P (plist)) { - if (! global - && global_cmds && ((global = mplist__assq (global_cmds, name)))) - global = MPLIST_NEXT (MPLIST_PLIST (global)); - if (global) - { - keyseq = MPLIST_NEXT (global); - status = Minherited; - } - else - { - keyseq = plist; - status = Mnil; - } + description = plist; + plist = MPLIST_NEXT (plist); } else { - keyseq = MPLIST_NEXT (plist); + description = global; + if (! MPLIST_TAIL_P (plist)) + plist = MPLIST_NEXT (plist); + } + if (MPLIST_TAIL_P (plist) && global) + { + keyseq = MPLIST_NEXT (global); + status = Minherited; + } + else + { + keyseq = plist; status = Mnil; } if (config_cmds && (config = mplist__assq (config_cmds, name))) { + status = Mconfigured; config = MPLIST_NEXT (MPLIST_PLIST (config)); if (! MPLIST_TAIL_P (config)) - { - keyseq = MPLIST_NEXT (config); - status = Mconfigured; - } + keyseq = config; } else if (custom_cmds && (custom = mplist__assq (custom_cmds, name))) { - custom = MPLIST_NEXT (MPLIST_PLIST (custom)); - if (! MPLIST_TAIL_P (custom)) + MPlist *this_keyseq = MPLIST_NEXT (MPLIST_NEXT (MPLIST_PLIST (custom))); + + if (MPLIST_TAIL_P (this_keyseq)) + mplist__pop_unref (custom); + else { - keyseq = MPLIST_NEXT (custom); status = Mcustomized; + keyseq = this_keyseq; } } @@ -1887,7 +1909,7 @@ check_variable_value (MPlist *val, MPlist *global) } } - return (MPLIST_TAIL_P (valids)); + return (! MPLIST_TAIL_P (valids)); } /* Load variable defitions from PLIST into IM_INFO->vars. @@ -2045,21 +2067,24 @@ config_variable (MPlist *plist, MPlist *global_vars, MPlist *custom_vars, if (config_vars && (config = mplist__assq (config_vars, name))) { + status = Mconfigured; config = MPLIST_NEXT (MPLIST_PLIST (config)); if (! MPLIST_TAIL_P (config)) { - value = MPLIST_NEXT (config); + value = config; if (MFAILP (check_variable_value (value, global ? global : plist))) value = NULL; - status = Mconfigured; } } else if (custom_vars && (custom = mplist__assq (custom_vars, name))) { - custom = MPLIST_NEXT (MPLIST_PLIST (custom)); - if (! MPLIST_TAIL_P (custom)) + MPlist *this_value = MPLIST_NEXT (MPLIST_NEXT (MPLIST_PLIST (custom))); + + if (MPLIST_TAIL_P (this_value)) + mplist__pop_unref (custom); + else { - value = MPLIST_NEXT (custom); + value = this_value; if (MFAILP (check_variable_value (value, global ? global : plist))) value = NULL; status = Mcustomized; @@ -2482,6 +2507,16 @@ preedit_commit (MInputContext *ic) mtext_put_prop_values (ic->preedit, 0, mtext_nchars (ic->preedit), Mcandidate_index, NULL, 0); mtext_cat (ic->produced, ic->preedit); + if (mdebug__flag & mdebug_mask) + { + int i; + + MDEBUG_PRINT (" (commit"); + for (i = 0; i < mtext_nchars (ic->preedit); i++) + MDEBUG_PRINT1 (" U+%04X", mtext_ref_char (ic->preedit, i)); + MDEBUG_PRINT (")"); + } + mtext_reset (ic->preedit); mtext_reset (ic_info->preedit_saved); MPLIST_DO (p, ic_info->markers) @@ -2494,6 +2529,8 @@ preedit_commit (MInputContext *ic) { M17N_OBJECT_UNREF (ic->candidate_list); ic->candidate_list = NULL; + ic->candidate_index = 0; + ic->candidate_from = ic->candidate_to = 0; ic->candidates_changed = MINPUT_CANDIDATES_LIST_CHANGED; if (ic->candidate_show) { @@ -2721,7 +2758,8 @@ get_candidate_list (MInputContextInfo *ic_info, MPlist *args) next = MPLIST_NEXT (next); } } - M17N_OBJECT_UNREF (plist); + if (charset) + M17N_OBJECT_UNREF (plist); plist = mplist (); len = mtext_nchars (mt); if (len <= column) @@ -2739,47 +2777,42 @@ get_candidate_list (MInputContextInfo *ic_info, MPlist *args) } M17N_OBJECT_UNREF (mt); } - else /* MPLIST_PLIST_P (plist) */ + else if (! MPLIST_TAIL_P (plist)) { - MPlist *pl = MPLIST_PLIST (plist), *p; - MPlist *next = MPLIST_NEXT (plist); - int j; + MPlist *tail = plist; + MPlist *new = mplist (); + MPlist *this = mplist (); + int count = 0; - if (MPLIST_TAIL_P (next)) - M17N_OBJECT_REF (pl); - else + MPLIST_DO (tail, tail) { - pl = mplist_copy (pl); - while (! MPLIST_TAIL_P (next)) - { - p = mplist_copy (MPLIST_PLIST (next)); - pl = mplist__conc (pl, p); - M17N_OBJECT_UNREF (p); - next = MPLIST_NEXT (next); - } - } - M17N_OBJECT_UNREF (plist); - plist = mplist (); - len = mplist_length (pl); - if (len <= column) - mplist_add (plist, Mplist, pl); - else - { - MPlist *p0 = pl; + MPlist *p = MPLIST_PLIST (tail); - for (i = 0; i < len; i += column) + MPLIST_DO (p, p) { - p = mplist (); - mplist_add (plist, Mplist, p); - M17N_OBJECT_UNREF (p); - for (j = 0; j < column && i + j < len; j++) + MText *mt = MPLIST_MTEXT (p); + + if (count == column) { - p = mplist_add (p, Mtext, MPLIST_VAL (p0)); - p0 = MPLIST_NEXT (p0); + mplist_add (new, Mplist, this); + M17N_OBJECT_UNREF (this); + this = mplist (); + count = 0; } + mplist_add (this, Mtext, mt); + count++; } } - M17N_OBJECT_UNREF (pl); + mplist_add (new, Mplist, this); + M17N_OBJECT_UNREF (this); + mplist_set (plist, Mnil, NULL); + MPLIST_DO (tail, new) + { + MPlist *elt = MPLIST_PLIST (tail); + + mplist_add (plist, Mplist, elt); + } + M17N_OBJECT_UNREF (new); } } @@ -2840,7 +2873,7 @@ regularize_action (MPlist *action_list, MInputContextInfo *ic_info) } /* Perform list of actions in ACTION_LIST for the current input - context IC. If all actions are performed without error, return 0. + context IC. If unhandle action was not performed, return 0. Otherwise, return -1. */ static int @@ -2882,7 +2915,7 @@ take_action_list (MInputContext *ic, MPlist *action_list) MPlist *plist = get_candidate_list (ic_info, args); int len; - if (! plist) + if (! plist || (MPLIST_PLIST_P (plist) && MPLIST_TAIL_P (plist))) continue; if (MPLIST_MTEXT_P (plist)) { @@ -2890,6 +2923,8 @@ take_action_list (MInputContext *ic, MPlist *action_list) mtext_ref_char (MPLIST_MTEXT (plist), 0)); len = 1; } + else if (MPLIST_TAIL_P (MPLIST_PLIST (plist))) + continue; else { MText * mt = MPLIST_MTEXT (MPLIST_PLIST (plist)); @@ -3122,6 +3157,11 @@ take_action_list (MInputContext *ic, MPlist *action_list) } } } + else if (name == Mpop) + { + if (ic_info->key_head < ic_info->used) + MLIST_DELETE1 (ic_info, keys, ic_info->key_head, 1); + } else if (name == Mcall) { MInputMethodInfo *im_info = (MInputMethodInfo *) ic->im->info; @@ -3140,8 +3180,8 @@ take_action_list (MInputContext *ic, MPlist *action_list) = (MIMExternalModule *) mplist_get (im_info->externals, module); if (external) - func = (MIMExternalFunc) mplist_get (external->func_list, - func_name); + func = ((MIMExternalFunc) + mplist_get_func (external->func_list, func_name)); } if (! func) continue; @@ -3421,47 +3461,43 @@ handle_key (MInputContext *ic) { /* MAP can not handle KEY. */ - /* If MAP is the root map of the initial state, it means that - the current input method can not handle KEY. */ - if (map == ((MIMState *) MPLIST_VAL (im_info->states))->map) + /* Perform branch actions if any. */ + if (map->branch_actions) { - MDEBUG_PRINT (" unhandled\n"); - return -1; + MDEBUG_PRINT (" branch-actions:"); + if (take_action_list (ic, map->branch_actions) < 0) + { + MDEBUG_PRINT ("\n"); + return -1; + } } - if (map != ic_info->state->map) + if (map == ic_info->map) { - /* If MAP is not the root map... */ - /* If MAP has branch actions, perform them. */ - if (map->branch_actions) + /* The above branch actions didn't change the state. */ + + /* If MAP is the root map of the initial state, and there + still exist an unhandled key, it means that the current + input method can not handle it. */ + if (map == ((MIMState *) MPLIST_VAL (im_info->states))->map + && ic_info->key_head < ic_info->used) { - MDEBUG_PRINT (" branch-actions:"); - if (take_action_list (ic, map->branch_actions) < 0) - { - MDEBUG_PRINT ("\n"); - return -1; - } + MDEBUG_PRINT (" unhandled\n"); + return -1; } - /* If MAP is still not the root map, shift to the current - state. */ - if (ic_info->map != ic_info->state->map) - shift_state (ic, ic_info->state->name); - } - else - { - /* MAP is the root map, perform branch actions (if any) or - shift to the initial state. */ - if (map->branch_actions) + + if (map != ic_info->state->map) { - MDEBUG_PRINT (" branch-actions:"); - if (take_action_list (ic, map->branch_actions) < 0) - { - MDEBUG_PRINT ("\n"); - return -1; - } + /* MAP is not the root map. Shift to the root map of the + current state. */ + shift_state (ic, ic_info->state->name); + } + else if (! map->branch_actions) + { + /* MAP is the root map without any default branch + actions. Shift to the initial state. */ + shift_state (ic, Mnil); } - else - shift_state (ic, Mnil); } } MDEBUG_PRINT ("\n"); @@ -3510,7 +3546,7 @@ init_ic_info (MInputContext *ic) { MIMExternalModule *external = MPLIST_VAL (plist); MIMExternalFunc func - = (MIMExternalFunc) mplist_get (external->func_list, Minit); + = (MIMExternalFunc) mplist_get_func (external->func_list, Minit); if (func) (func) (func_args); @@ -3539,7 +3575,7 @@ fini_ic_info (MInputContext *ic) { MIMExternalModule *external = MPLIST_VAL (plist); MIMExternalFunc func - = (MIMExternalFunc) mplist_get (external->func_list, Mfini); + = (MIMExternalFunc) mplist_get_func (external->func_list, Mfini); if (func) (func) (func_args); @@ -3913,8 +3949,8 @@ minput__init () minput_default_driver.filter = filter; minput_default_driver.lookup = lookup; minput_default_driver.callback_list = mplist (); - mplist_put (minput_default_driver.callback_list, Minput_reset, - (void *) reset_ic); + mplist_put_func (minput_default_driver.callback_list, Minput_reset, + M17N_FUNC (reset_ic)); minput_driver = &minput_default_driver; fully_initialized = 0; @@ -3939,21 +3975,6 @@ minput__fini () } -int -minput__callback (MInputContext *ic, MSymbol command) -{ - MInputCallbackFunc func; - - if (! ic->im->driver.callback_list) - return -1; - func = (MInputCallbackFunc) mplist_get (ic->im->driver.callback_list, - command); - if (! func) - return -1; - (func) (ic, command); - return 0; -} - MSymbol minput__char_to_key (int c) { @@ -3990,6 +4011,8 @@ minput__char_to_key (int c) it specifies the number of characters following the current cursor position. If the value is negative, the absolute value specifies the number of characters preceding the current cursor position. + If the value is zero, it means that the caller just wants to know + if the surrounding text is currently supported or not. If the surrounding text is currently supported, the callback function must set the key of this element to #Mtext and the value @@ -4023,7 +4046,8 @@ minput__char_to_key (int c) ¤Æ#Minteger ¤ò¤È¤ê¡¢¤½¤ÎÃͤϥµ¥é¥¦¥ó¥Ç¥£¥ó¥°¥Æ¥­¥¹¥È¤Î¤¦¤Á¤É¤ÎÉôʬ ¤ò¼è¤Ã¤ÆÍè¤ë¤«¤ò»ØÄꤹ¤ë¡£Ãͤ¬Àµ¤Ç¤¢¤ì¤Ð¡¢¸½ºß¤Î¥«¡¼¥½¥ë°ÌÃ֤˳¤¯ ÃͤθĿôʬ¤Îʸ»ú¤ò¼è¤ë¡£Éé¤Ç¤¢¤ì¤Ð¡¢¥«¡¼¥½¥ë°ÌÃÖ¤ËÀè¹Ô¤¹¤ëÃͤÎÀäÂÐ - ÃÍʬ¤Îʸ»ú¤ò¼è¤ë¡£ + ÃÍʬ¤Îʸ»ú¤ò¼è¤ë¡£¸½ºß¥µ¥é¥¦¥ó¥É¥Æ¥­¥¹¥È¤¬¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¤«¤É¤¦ + ¤«¤òÃΤꤿ¤¤¤À¤±¤Ç¤¢¤ì¤Ð¡¢¤³¤ÎÃͤϥ¼¥í¤Ç¤âÎɤ¤¡£ ¥µ¥é¥¦¥ó¥Ç¥£¥ó¥°¥Æ¥­¥¹¥È¤¬¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ì¤Ð¡¢¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤Ï ¤³¤ÎÍ×ÁǤΥ­¡¼¤ò #Mtext ¤Ë¡¢Ãͤò¼è¤ê¹þ¤ó¤ÀM-text ¤ËÀßÄꤷ¤Ê¤¯¤Æ¤Ï¤Ê @@ -4032,8 +4056,7 @@ minput__char_to_key (int c) ¥·¥ç¥ó¦¤ÇɬÍפǸúΨŪ¤À¤È»×¤¨¤ÐŤ¯¤Æ¤âÎɤ¤¡£ ¥µ¥é¥¦¥ó¥Ç¥£¥ó¥°¥Æ¥­¥¹¥È¤¬¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤±¤ì¤Ð¡¢¥³¡¼¥ë¥Ð¥Ã¥¯´Ø - ¿ô¤Ï #MInputContext::plist ¤ÎÂè°ìÍ×ÁǤòÊѲ½¤µ¤»¤ë¤³¤È¤Ê¤¯ÊÖ¤µ¤Ê¤¯¤Æ - ¤Ï¤Ê¤é¤Ê¤¤¡£ + ¿ô¤Ï #MInputContext::plist ¤ÎÂè°ìÍ×ÁǤòÊѹ¹¤·¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ Minput_delete_surrounding_text: ¤³¤Î¥³¥Þ¥ó¥É¤Ë³ä¤êÅö¤Æ¤é¤ì¤¿¥³¡¼¥ë ¥Ð¥Ã¥¯´Ø¿ô¤¬¸Æ¤Ð¤ì¤¿ºÝ¤Ë¤Ï¡¢#MInputContext::plist ¤ÎÂè°ìÍ×ÁǤϡ¢¥­¡¼ @@ -4335,9 +4358,9 @@ minput_create_ic (MInputMethod *im, void *arg) if (im->driver.callback_list) { - minput__callback (ic, Minput_preedit_start); - minput__callback (ic, Minput_status_start); - minput__callback (ic, Minput_status_draw); + minput_callback (ic, Minput_preedit_start); + minput_callback (ic, Minput_status_start); + minput_callback (ic, Minput_status_draw); } MDEBUG_PRINT (" ok\n"); @@ -4371,9 +4394,9 @@ minput_destroy_ic (MInputContext *ic) msymbol_name (ic->im->name), msymbol_name (ic->im->language)); if (ic->im->driver.callback_list) { - minput__callback (ic, Minput_preedit_done); - minput__callback (ic, Minput_status_done); - minput__callback (ic, Minput_candidates_done); + minput_callback (ic, Minput_preedit_done); + minput_callback (ic, Minput_status_done); + minput_callback (ic, Minput_candidates_done); } (*ic->im->driver.destroy_ic) (ic); M17N_OBJECT_UNREF (ic->preedit); @@ -4439,16 +4462,20 @@ minput_filter (MInputContext *ic, MSymbol key, void *arg) if (! ic || ! ic->active) return 0; + if (ic->im->driver.callback_list + && mtext_nchars (ic->preedit) > 0) + minput_callback (ic, Minput_preedit_draw); + ret = (*ic->im->driver.filter) (ic, key, arg); if (ic->im->driver.callback_list) { if (ic->preedit_changed) - minput__callback (ic, Minput_preedit_draw); + minput_callback (ic, Minput_preedit_draw); if (ic->status_changed) - minput__callback (ic, Minput_status_draw); + minput_callback (ic, Minput_status_draw); if (ic->candidates_changed) - minput__callback (ic, Minput_candidates_draw); + minput_callback (ic, Minput_candidates_draw); } return ret; @@ -4551,7 +4578,7 @@ minput_set_spot (MInputContext *ic, int x, int y, ic->spot.mt = mt; ic->spot.pos = pos; if (ic->im->driver.callback_list) - minput__callback (ic, Minput_set_spot); + minput_callback (ic, Minput_set_spot); } /*=*/ @@ -4571,7 +4598,7 @@ void minput_toggle (MInputContext *ic) { if (ic->im->driver.callback_list) - minput__callback (ic, Minput_toggle); + minput_callback (ic, Minput_toggle); ic->active = ! ic->active; } @@ -4601,7 +4628,7 @@ void minput_reset_ic (MInputContext *ic) { if (ic->im->driver.callback_list) - minput__callback (ic, Minput_reset); + minput_callback (ic, Minput_reset); } /*=*/ @@ -4760,7 +4787,7 @@ minput_get_description (MSymbol language, MSymbol name) @c STATUS is a symbol representing how the key assignment is decided. The value is #Mnil (the default key assignment), #Mcustomized (the - key assignment is customized by per-user configuration file), or + key assignment is customized by per-user customization file), or #Mconfigured (the key assignment is set by the call of minput_config_command ()). For a local command only, it may also be #Minherited (the key assignment is inherited from the @@ -4812,12 +4839,13 @@ minput_get_description (MSymbol language, MSymbol name) @c DESCRIPTION ¤Ï¥³¥Þ¥ó¥É¤òÀâÌÀ¤¹¤ë M-text ¤Ç¤¢¤ë¤«¡¢ÀâÌÀ¤¬Ìµ¤¤¾ì¹ç¤Ë ¤Ï #Mnil ¤Ç¤¢¤ë¡£ - @c STATUS ¤Ï¥­¡¼³ä¤êÅö¤Æ¤¬¤É¤Î¤è¤¦¤ËÄê¤á¤é¤ì¤ë¤«¤ò¤¢¤é¤ï¤¹¥·¥ó¥Ü¥ë¤Ç¤¢ - ¤ê¡¢¤½¤ÎÃÍ¤Ï #Mnil ¡Ê¥Ç¥Õ¥©¥ë¥È¤Î³ä¤êÅö¤Æ¡Ë, #Mcustomized ¡Ê¥æ¡¼¥¶ - Ëè¤ÎÀßÄê¥Õ¥¡¥¤¥ë¤Ë¤è¤Ã¤Æ¥«¥¹¥¿¥Þ¥¤¥º¤µ¤ì¤¿³ä¤êÅö¤Æ¡Ë, #Mconfigured - ¡Êminput_config_command ()¤ò¸Æ¤Ö¤³¤È¤Ë¤è¤Ã¤ÆÀßÄꤵ¤ì¤ë³ä¤êÅö¤Æ¡Ë¤Î - ¤¤¤º¤ì¤«¤Ç¤¢¤ë¡£¥í¡¼¥«¥ë¥³¥Þ¥ó¥É¤Î¾ì¹ç¤Ë¤Ï¡¢#Minherited ¡ÊÂбþ¤¹¤ë - ¥°¥í¡¼¥Ð¥ë¥³¥Þ¥ó¥É¤«¤é¤Î·Ñ¾µ¤Ë¤è¤ë³ä¤êÅö¤Æ¡Ë¤Ç¤â¤è¤¤¡£ + @c STATUS ¤Ï¥­¡¼³ä¤êÅö¤Æ¤¬¤É¤Î¤è¤¦¤ËÄê¤á¤é¤ì¤ë¤«¤ò¤¢¤é¤ï¤¹¥·¥ó¥Ü¥ë + ¤Ç¤¢¤ê¡¢¤½¤ÎÃÍ¤Ï #Mnil ¡Ê¥Ç¥Õ¥©¥ë¥È¤Î³ä¤êÅö¤Æ¡Ë, #Mcustomized ¡Ê¥æ¡¼ + ¥¶Ëè¤Î¥«¥¹¥¿¥Þ¥¤¥º¥Õ¥¡¥¤¥ë¤Ë¤è¤Ã¤Æ¥«¥¹¥¿¥Þ¥¤¥º¤µ¤ì¤¿³ä¤êÅö¤Æ¡Ë, + #Mconfigured ¡Êminput_config_command ()¤ò¸Æ¤Ö¤³¤È¤Ë¤è¤Ã¤ÆÀßÄꤵ¤ì¤ë + ³ä¤êÅö¤Æ¡Ë¤Î¤¤¤º¤ì¤«¤Ç¤¢¤ë¡£¥í¡¼¥«¥ë¥³¥Þ¥ó¥É¤Î¾ì¹ç¤Ë¤Ï¡¢ + #Minherited ¡ÊÂбþ¤¹¤ë¥°¥í¡¼¥Ð¥ë¥³¥Þ¥ó¥É¤«¤é¤Î·Ñ¾µ¤Ë¤è¤ë³ä¤êÅö¤Æ¡Ë + ¤Ç¤â¤è¤¤¡£ @c KEYSEQ ¤Ï£±¤Ä°Ê¾å¤Î¥·¥ó¥Ü¥ë¤«¤é¤Ê¤ë plist ¤Ç¤¢¤ê¡¢³Æ¥·¥ó¥Ü¥ë¤Ï¥³¥Þ ¥ó¥É¤Ë³ä¤êÅö¤Æ¤é¤ì¤Æ¤¤¤ë¥­¡¼¥·¡¼¥¯¥¨¥ó¥¹¤òɽ¤¹¡£KEYSEQ ¤¬Ìµ¤¤¾ì¹ç¤Ï¡¢ @@ -4847,8 +4875,8 @@ get_im_command_description (MSymbol language, MSymbol name, MSymbol command) if (! cmds) return NULL; - plist = mplist_value (cmds); /* (NAME DESCRIPTION KEY-SEQ ...) */ - plist = mplist_next (plist); /* (DESCRIPTION KEY-SEQ ...) */ + plist = mplist_value (cmds); /* (NAME DESCRIPTION STATUS KEY-SEQ ...) */ + plist = mplist_next (plist); /* (DESCRIPTION STATUS KEY-SEQ ...) */ return (mplist_key (plist) == Mtext ? (MText *) mplist_value (plist) : NULL); @@ -4884,12 +4912,16 @@ minput_get_command (MSymbol language, MSymbol name, MSymbol command) If $KEYSEQLIST is a non-empty plist, it must be a list of key sequences, and each key sequence must be a plist of symbols. - If $KEYSEQLIST is an empty plist, the command becomes unusable. + If $KEYSEQLIST is an empty plist, any configuration and + customization of the command are cancelled, and default key + sequences become effective. + + If $KEYSEQLIST is NULL, the configuration of the command is + canceled, and the original key sequences (what saved in per-user + customization file, or the default one) become effective. - If $KEYSEQLIST is NULL, the configuration of the command for the - input method is canceled, and the default key sequences become - effective. In such case, if $COMMAND is #Mnil, configurations for - all commands of the input method are canceled. + In the latter two cases, $COMMAND can be #Mnil to make all the + commands of the input method the target of the operation. If $NAME is #Mnil, this function configures the key assignment of a global command, not that of a specific input method. @@ -4897,11 +4929,10 @@ minput_get_command (MSymbol language, MSymbol name, MSymbol command) The configuration takes effect for input methods opened or re-opened later in the current session. In order to make the configuration take effect for the future session, it must be saved - in a per-user configuration file by the function + in a per-user customization file by the function minput_save_config (). @return - If the operation was successful, this function returns 0, otherwise returns -1. The operation fails in these cases: