コミットメタ情報

リビジョン43ba288fdeda466a8af38c2574c8ae2552a5e022 (tree)
日時2018-04-01 16:34:34
作者Kazuhiro Fujieda <fujieda@user...>
コミッターKazuhiro Fujieda

ログメッセージ

Fix a bug where shift key combinations cancel the mark

変更サマリ

差分

--- a/xkeymacsdll/xkeymacsdll.cpp
+++ b/xkeymacsdll/xkeymacsdll.cpp
@@ -693,27 +693,37 @@ HOOK_RECURSIVE_KEY:
693693 return TRUE;
694694 }
695695
696-void CXkeymacsDll::CancelMarkWithShift(BYTE nKey, bool bRelease)
696+void CXkeymacsDll::CancelMarkWithShift(byte nKey, bool bRelease)
697697 {
698698 static bool bShift;
699- if (nKey != VK_SHIFT)
700- goto exit;
701- BYTE bVk = 0;
702- do {
703- if (bVk == VK_SHIFT || VK_LSHIFT || VK_RSHIFT)
704- continue;
705- if (IsDown(bVk, FALSE))
706- goto exit;
707- } while (++bVk);
708- if (!bRelease) {
709- bShift = true;
699+ if (IsDepressedShiftKeyOnly(nKey)) {
700+ if (bRelease) {
701+ if (bShift)
702+ CCommands::SetMark(false);
703+ } else {
704+ bShift = true;
705+ }
710706 return;
711707 }
712- if (bShift)
713- CCommands::SetMark(FALSE);
714-exit:
715708 bShift = false;
716- return;
709+}
710+
711+static bool IsShift(byte bVk)
712+{
713+ return bVk == VK_SHIFT || bVk == VK_LSHIFT || bVk == VK_RSHIFT;
714+}
715+
716+bool CXkeymacsDll::IsDepressedShiftKeyOnly(byte nKey)
717+{
718+ if (!IsShift(nKey))
719+ return false;
720+ for (byte bVk = 1; bVk < 255; bVk++) {
721+ if (IsShift(bVk))
722+ continue;
723+ if (IsDown(bVk))
724+ return false;
725+ }
726+ return true;
717727 }
718728
719729 int CXkeymacsDll::IsPassThrough(BYTE nKey)
--- a/xkeymacsdll/xkeymacsdll.h
+++ b/xkeymacsdll/xkeymacsdll.h
@@ -78,7 +78,8 @@ private:
7878 static BOOL m_bRightControl;
7979 static BOOL m_bRightAlt;
8080 static LRESULT CALLBACK KeyboardProc(int nCode, WPARAM wParam, LPARAM lParam);
81- static void CancelMarkWithShift(BYTE nKey, bool bRelease);
81+ static void CancelMarkWithShift(byte nKey, bool bRelease);
82+ static bool IsDepressedShiftKeyOnly(byte nKey);
8283 static int IsPassThrough(BYTE nKey);
8384 static void InvokeM_x(LPCTSTR szPath);
8485 static TCHAR m_M_xTip[128];
旧リポジトリブラウザで表示