1 parent e58bbde commit f7220a5Copy full SHA for f7220a5
1 file changed
test.html
@@ -955,12 +955,22 @@ <h2>輸入法模式:</h2>
955
const code = result.code;
956
const index = result.index;
957
let suffix = '';
958
- if (index < 9) {
959
- suffix = (index + 1).toString();
960
- } else if (index === 9) {
961
- suffix = '0';
962
- } else {
963
- suffix = '>';
+ const candidatesForCode = currentCodemap[code];
+ // 只有當該編碼有多個候選字時才加上後綴
+ if (candidatesForCode && candidatesForCode.length > 1) {
+ if (index === 0) {
+ // 第一個字不顯示數字
+ suffix = '';
964
+ } else if (index < 9) {
965
+ // 第二個到第九個顯示數字
966
+ suffix = (index + 1).toString();
967
+ } else if (index === 9) {
968
+ // 第十個顯示全形零
969
+ suffix = '0';
970
+ } else {
971
+ // 第十一個之後顯示大於符號
972
+ suffix = '>';
973
+ }
974
}
975
return formatCode(code) + suffix;
976
});
0 commit comments