From c8334bb214bce5e8c6e1dd784e630778b9f6c59c Mon Sep 17 00:00:00 2001 From: handa Date: Fri, 8 Jun 2007 08:13:56 +0000 Subject: [PATCH] (update_candidate): Copy candidate_list earlier. (re_init_ic): Provide pseudo initialize state if none. --- src/input.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/input.c b/src/input.c index 51f86ef..388237e 100644 --- a/src/input.c +++ b/src/input.c @@ -2620,6 +2620,7 @@ update_candidate (MInputContext *ic, MTextProperty *prop, int idx) int ingroup_index = idx - start; MText *mt; + candidate_list = mplist_copy (candidate_list); if (MPLIST_MTEXT_P (group)) { mt = MPLIST_MTEXT (group); @@ -2637,7 +2638,6 @@ update_candidate (MInputContext *ic, MTextProperty *prop, int idx) preedit_replace (ic, from, to, mt, 0); to = from + mtext_nchars (mt); } - candidate_list = mplist_copy (candidate_list); mtext_put_prop (ic->preedit, from, to, Mcandidate_list, candidate_list); M17N_OBJECT_UNREF (candidate_list); mtext_put_prop (ic->preedit, from, to, Mcandidate_index, (void *) idx); @@ -3670,8 +3670,20 @@ re_init_ic (MInputContext *ic, int reload) fini_ic_info (ic); if (reload) reload_im_info (im_info); + if (! im_info->states) + { + struct MIMState *state; + + M17N_OBJECT (state, free_state, MERROR_IM); + state->name = msymbol ("init"); + state->title = mtext__from_data ("ERROR!", 6, MTEXT_FORMAT_US_ASCII, 0); + MSTRUCT_CALLOC (state->map, MERROR_IM); + im_info->states = mplist (); + mplist_add (im_info->states, state->name, state); + } init_ic_info (ic); shift_state (ic, Mnil); + ic->status_changed = status_changed; ic->preedit_changed = preedit_changed; ic->cursor_pos_changed = cursor_pos_changed; -- 1.7.10.4