-
-
Save papaeye/8368908 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/data/config/keymap.conf b/data/config/keymap.conf | |
index 63d9712..38effe5 100644 | |
--- a/data/config/keymap.conf | |
+++ b/data/config/keymap.conf | |
@@ -43,6 +43,8 @@ InputChars group::hex::0x20-0x7e | |
CompConversion alt::hex::0x20||shift::hex::0x20 | |
+StickyKey ; | |
+ | |
# ====================================================================== | |
# handle option | |
# ====================================================================== | |
diff --git a/src/engine/keymap/SKKKeymapEntry.cpp b/src/engine/keymap/SKKKeymapEntry.cpp | |
index c99d02d..3bd6680 100644 | |
--- a/src/engine/keymap/SKKKeymapEntry.cpp | |
+++ b/src/engine/keymap/SKKKeymapEntry.cpp | |
@@ -72,6 +72,7 @@ static const struct { | |
{ "RemoveTrigger", RemoveTrigger, TYPE_ATTRIBUTE }, | |
{ "InputChars", InputChars, TYPE_ATTRIBUTE }, | |
{ "CompConversion", CompConversion, TYPE_ATTRIBUTE }, | |
+ { "StickyKey", StickyKey, TYPE_ATTRIBUTE }, | |
{ "AlwaysHandled", AlwaysHandled, TYPE_HANDLE_OPTION }, | |
{ "PseudoHandled", PseudoHandled, TYPE_HANDLE_OPTION }, | |
diff --git a/src/engine/state/SKKEvent.h b/src/engine/state/SKKEvent.h | |
index ba740db..f5b1ec3 100644 | |
--- a/src/engine/state/SKKEvent.h | |
+++ b/src/engine/state/SKKEvent.h | |
@@ -71,7 +71,8 @@ enum { | |
PrevCandidate = (1 << 11), | |
RemoveTrigger = (1 << 12), | |
InputChars = (1 << 13), | |
- CompConversion = (1 << 14) | |
+ CompConversion = (1 << 14), | |
+ StickyKey = (1 << 15) | |
}; | |
// 処理オプション | |
@@ -109,6 +110,7 @@ public: | |
bool IsRemoveTrigger() const { return attribute & RemoveTrigger; } | |
bool IsInputChars() const { return attribute & InputChars; } | |
bool IsCompConversion() const { return attribute & CompConversion; } | |
+ bool IsStickyKey() const { return attribute & StickyKey; } | |
const static SKKEvent& Null() { | |
static SKKEvent obj(SKK_NULL, 0, 0); | |
diff --git a/src/engine/state/SKKStateComposing-inl.h b/src/engine/state/SKKStateComposing-inl.h | |
index abde24d..dd2a2d3 100644 | |
--- a/src/engine/state/SKKStateComposing-inl.h | |
+++ b/src/engine/state/SKKStateComposing-inl.h | |
@@ -169,6 +169,19 @@ State SKKState::KanaEntry(const Event& event) { | |
return State::Transition(&SKKState::KanaInput); | |
} | |
+ // Sticky key | |
+ if(param.IsStickyKey()) { | |
+ if(context_->entry.IsEmpty()) { | |
+ if(param.IsInputChars()) { | |
+ editor_->HandleChar(param.code, param.IsDirect()); | |
+ } | |
+ editor_->Commit(); | |
+ return State::Transition(&SKKState::KanaInput); | |
+ } else { | |
+ return State::Transition(&SKKState::OkuriInput); | |
+ } | |
+ } | |
+ | |
// 送りあり | |
if(param.IsUpperCases() && !context_->entry.IsEmpty()) { | |
return State::Forward(&SKKState::OkuriInput); | |
diff --git a/src/engine/state/SKKStatePrimary-inl.h b/src/engine/state/SKKStatePrimary-inl.h | |
index 972bef3..52eaef1 100644 | |
--- a/src/engine/state/SKKStatePrimary-inl.h | |
+++ b/src/engine/state/SKKStatePrimary-inl.h | |
@@ -152,6 +152,10 @@ State SKKState::KanaInput(const Event& event) { | |
} | |
} | |
+ if(param.IsStickyKey()) { | |
+ return State::Transition(&SKKState::KanaEntry); | |
+ } | |
+ | |
if(param.IsUpperCases()) { | |
return State::Forward(&SKKState::KanaEntry); | |
} | |
diff --git a/src/engine/tests/keymap.conf b/src/engine/tests/keymap.conf | |
index e6111a9..0971a3b 100644 | |
--- a/src/engine/tests/keymap.conf | |
+++ b/src/engine/tests/keymap.conf | |
@@ -44,3 +44,5 @@ UpperCases group::A-K,M-P,R-W,Z,l | |
Direct group::keycode::0x41,0x43,0x45,0x4b,0x4e,0x51-0x59,0x5b,0x5c,0x5f | |
InputChars group::hex::0x20-0x7e | |
CompConversion alt::hex::0x20||shift::hex::0x20 | |
+ | |
+StickyKey ; | |
diff --git a/src/engine/tests/test.dat b/src/engine/tests/test.dat | |
index 8c5c2a6..f435a99 100755 | |
--- a/src/engine/tests/test.dat | |
+++ b/src/engine/tests/test.dat | |
@@ -642,3 +642,15 @@ ctrl::/,sel=蝙蝠 mode=J,marked=▽こうもり | |
ctrl::g mode=J,fixed=蝙蝠 | |
ctrl::/,sel=蝙蝠 mode=J,marked=▽こうもり | |
ctrl::m mode=J,fixed=こうもり | |
+ | |
+# sticky shift | |
+# ---------------------------------------------------------------------- | |
+; mode=J,marked=▽ | |
+a mode=J,marked=▽あ | |
+; mode=J,marked=▽あ* | |
+r mode=J,marked=▽あ*r | |
+i mode=J,marked=▼有り | |
+ctrl::m mode=J,fixed=有り | |
+ctrl::j mode=J | |
+; mode=J,marked=▽ | |
+; mode=J,fixed=; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment