From bb0d42bbc27e3eb7a5556b291953a4d5d5f6249e Mon Sep 17 00:00:00 2001 From: Ianos Gnatiuc Date: Sun, 27 Nov 2005 20:13:48 +0000 Subject: [PATCH] Fixed keystacking conflicts --- docs/notework.txt | 6 ++++++ golded3/gckeys.cpp | 28 ++++++++++++++++++---------- golded3/geinit.cpp | 20 ++++++++++++++------ golded3/geread.cpp | 5 ++--- golded3/geread2.cpp | 7 ++++--- goldlib/gall/gkbdbase.cpp | 12 +++++++++++- 6 files changed, 55 insertions(+), 23 deletions(-) diff --git a/docs/notework.txt b/docs/notework.txt index 8abfbc8..1332697 100644 --- a/docs/notework.txt +++ b/docs/notework.txt @@ -10,6 +10,12 @@ ______________________________________________________________________ Notes for GoldED+ 1.1.5, /snapshot/ ______________________________________________________________________ +- Fixed keystacking conflicts: + - KeybClear will not affect keystacking. + - Auto Macro will not work if keystacking is used. + - MsgListFirst (and meybe other keywords) will work only after all keys + in keyboard buffer is consumed. + + @macroses work for ImportBegin and ImportEnd now. + Node address will be shown on nodelist lookup, if point address is not found. diff --git a/golded3/gckeys.cpp b/golded3/gckeys.cpp index ef4ccdc..87f39fd 100644 --- a/golded3/gckeys.cpp +++ b/golded3/gckeys.cpp @@ -27,6 +27,8 @@ #include #include +extern std::string keybuf; + // ------------------------------------------------------------------ @@ -1161,19 +1163,25 @@ int ReadKeysCfg(int force) { // Assign global macros std::vector::iterator k; - for(k=CFG->macro.begin(), n=0; k != CFG->macro.end(); k++, n++) { - if(k->type == 0) { - if(k->key == KK_Auto) { - // Start automacro - mac = k->buf; - while(*mac) { - kbput(*mac); - mac++; + for (k = CFG->macro.begin(), n = 0; k != CFG->macro.end(); k++, n++) + { + if (k->type == 0) + { + if (k->key == KK_Auto) + { + if (keybuf.empty() && !*CFG->keybstack) + { + // Start automacro + mac = k->buf; + while(*mac) + { + kbput(*mac); + mac++; + } } } - else { + else setonkey(k->key, PlayMacro, (gkey)(0xFFFF-n)); - } } } diff --git a/golded3/geinit.cpp b/golded3/geinit.cpp index 773da03..e89cfd7 100644 --- a/golded3/geinit.cpp +++ b/golded3/geinit.cpp @@ -45,7 +45,9 @@ extern int __gftrk_statusline; extern bool gmem_check_overrun; #endif -static std::string keybuf; +extern bool gKeystacking; + +std::string keybuf; static Path cmdlinecfg = ""; bool cmdlinedebughg = false; @@ -749,17 +751,23 @@ void Initialize(int argc, char* argv[]) { waitkey(); } - if(CFG->switches.get(keybclear)) { + if (CFG->switches.get(keybclear) || !keybuf.empty() || *CFG->keybstack) + { clearkeys(); kbclear(); - if(*CFG->keybstack) // The config keys - kbputstr(CFG->keybstack); } - else if(not keybuf.empty()) { // The commandline keys + + if (not keybuf.empty()) // The commandline keys + { kbputstr(keybuf.c_str()); keybuf.erase(); - } else if(*CFG->keybstack) // The config keys + gKeystacking = true; + } + else if (*CFG->keybstack) // The config keys + { kbputstr(CFG->keybstack); + gKeystacking = true; + } fieldupd = EDIT->FieldClear() ? 2 : 1; diff --git a/golded3/geread.cpp b/golded3/geread.cpp index 0a2e74a..6cf5649 100644 --- a/golded3/geread.cpp +++ b/golded3/geread.cpp @@ -186,10 +186,9 @@ void Reader() { else { AL.SetActiveAreaNo(startecho); AA->RandomizeData(); - if(AA->Msglistfirst()) { + + if (AA->Msglistfirst() && (kbput(KK_ReadMessageList) != -1)) reader_msglistfirst = true; - kbput(KK_ReadMessageList); - } else reader_msglistfirst = false; } diff --git a/golded3/geread2.cpp b/golded3/geread2.cpp index 9ce484b..2b341ad 100644 --- a/golded3/geread2.cpp +++ b/golded3/geread2.cpp @@ -497,10 +497,11 @@ void NewArea(bool jumpnext) { OrigArea = CurrArea; strcpy(stecho, AA->echoid()); AA->RandomizeData(); - if(AA->Msglistfirst()) { - kbput(KK_ReadMessageList); + + if (AA->Msglistfirst() && (kbput(KK_ReadMessageList) != -1)) reader_msglistfirst = true; - } + else + reader_msglistfirst = false; } } diff --git a/goldlib/gall/gkbdbase.cpp b/goldlib/gall/gkbdbase.cpp index 0d070c1..861a49f 100644 --- a/goldlib/gall/gkbdbase.cpp +++ b/goldlib/gall/gkbdbase.cpp @@ -1618,7 +1618,17 @@ void clearkeys() { // ------------------------------------------------------------------ // Puts a keystroke into the CXL keyboard "buffer" -int kbput(gkey xch) { +bool gKeystacking = false; + +int kbput(gkey xch) +{ + if (gKeystacking) + { + if (gkbd.kbuf != NULL) + return -1; + + gKeystacking = false; + } KBuf* kbuf; KBuf* temp;