diff --git a/strans.c b/strans.c index ce4b52f..6135023 100644 --- a/strans.c +++ b/strans.c @@ -793,7 +793,9 @@ startsearch(int lang, Str *com) sclear(&seed); if(lang == LangHANJA && !search.lang && im.sel < 0){ impre(&im, &seed); - reachback(&seed, &back); + /* Nothing pending is no reading, and reaches into nothing. */ + if(seed.n != 0) + reachback(&seed, &back); }else flush(com); reset(); diff --git a/tests/engine_test.c b/tests/engine_test.c index 30d8ec0..c9468dd 100644 --- a/tests/engine_test.c +++ b/tests/engine_test.c @@ -2005,6 +2005,22 @@ engine_hanja_reaches_back(struct ct *t) CT_EQ_INT(t, 0, takeback); } + /* Nothing pending is no reading, and reaches into nothing. */ + surround = mkstr("민"); + sclear(&im.pre); + sclear(&com); + CT_CHECK(t, keystroke('h', Mctrl, &com)); + CT_EQ_INT(t, 0, search.back.n); + CT_EQ_INT(t, 0, im.nkouho); + if(typekeys(t, "als", &com)){ + checkstr(t, "the reading typed is the whole query", "민", + &search.text); + CT_CHECK(t, keystroke(Kret, 0, &com)); + checkstr(t, "the client's syllable is not converted", "民", + &com); + CT_EQ_INT(t, 0, takeback); + } + /* The frontend's own request carries the text and is told to take it. */ init(); im.l = getlang(LangKO);