diff --git a/scim-wnn/data/like-msime.rkt b/scim-wnn/data/like-msime.rkt index 854e2ca..38d5648 100644 --- a/scim-wnn/data/like-msime.rkt +++ b/scim-wnn/data/like-msime.rkt @@ -1,5 +1,11 @@ # utf8 +# 「nn」を「ん」に変換するかどうか。 $nnMode true +# ローマ字変換できなかった英字を捨てるかどうか。 +$RemoveRemainder false +# Ascii/WideAsciiモードでキャンセルキーによる離脱を有効にするか。 +$AsciiModeCancel false +# Ascii/WideAsciiモードへの移行キー。 $Key/Ascii null $Key/WideAscii null - ー diff --git a/scim-wnn/data/scim-wnn-def.rkt b/scim-wnn/data/scim-wnn-def.rkt index 63c8177..5d87d47 100644 --- a/scim-wnn/data/scim-wnn-def.rkt +++ b/scim-wnn/data/scim-wnn-def.rkt @@ -1,5 +1,11 @@ # utf8 +# 「nn」を「ん」に変換するかどうか。 $nnMode false +# ローマ字変換できなかった英字を捨てるかどうか。 +$RemoveRemainder false +# Ascii/WideAsciiモードでキャンセルキーによる離脱を有効にするか。 +$AsciiModeCancel true +# Ascii/WideAsciiモードへの移行キー。 $Key/Ascii q $Key/WideAscii Shift+Q a あ diff --git a/scim-wnn/src/romkan.cpp b/scim-wnn/src/romkan.cpp index 40cafaf..b263c45 100644 --- a/scim-wnn/src/romkan.cpp +++ b/scim-wnn/src/romkan.cpp @@ -152,6 +152,13 @@ if (tableConfig.find("nnMode") != tableConfig.end()) nnMode = string2bool(tableConfig["nnMode"]); + else nnMode = false; + if (tableConfig.find("AsciiModeCancel") != tableConfig.end()) + asciiCancel = string2bool(tableConfig["AsciiModeCancel"]); + else asciiCancel = true; + if (tableConfig.find("RemoveRemainder") != tableConfig.end()) + removeRemainder = string2bool(tableConfig["RemoveRemainder"]); + else removeRemainder = false; if (tableConfig.find("Key/Ascii") != tableConfig.end()) scim_string_to_key_list(key_ascii_mode,tableConfig["Key/Ascii"]); if (tableConfig.find("Key/WideAscii") != tableConfig.end()) @@ -264,6 +271,10 @@ return(text); } if (buf.length()) { + if (removeRemainder) { + text = text.substr(0,pos - buf.length()) + text.substr(pos - buf.length() + 1); + pos --; + } buf = buf.substr(1); return(eval()); } @@ -301,8 +312,16 @@ { if (hosei) { if (buf.length()) { + if (removeRemainder) { + text = text.substr(0,pos - buf.length()) + text.substr(pos); + pos -= buf.length(); + if (buf.substr(buf.length() - 1,1) == "n") { + text = text.substr(0,pos) + convChars[KANA_N] + text.substr(pos); + pos ++; + } + } else if (buf.substr(buf.length() - 1,1) == "n") { - text = text.substr(0,pos - 1) + convChars[KANA_N]; + text = text.substr(0,pos - 1) + convChars[KANA_N] + text.substr(pos); } } } @@ -426,7 +445,7 @@ */ bool Romkan::cancelEvent() { - if ((mode == ASCII) || (mode == WASCII)) { + if (((mode == ASCII) || (mode == WASCII)) && (asciiCancel)) { mode = ROMA; return(true); } diff --git a/scim-wnn/src/romkan.h b/scim-wnn/src/romkan.h index d04b795..4a4f07c 100644 --- a/scim-wnn/src/romkan.h +++ b/scim-wnn/src/romkan.h @@ -77,6 +77,8 @@ enum inputMode {ROMA,ASCII,WASCII}; inputMode mode; bool nnMode; + bool asciiCancel; + bool removeRemainder; PreEditorKeyEventList key_ascii_mode,key_wascii_mode; map RomkanTable; set keepTable;