Fixed macro mechanism

This commit is contained in:
Alexander S. Aganichev 2000-12-27 12:45:20 +00:00
parent 748f2ea804
commit 3b938d46f3
4 changed files with 36 additions and 6 deletions

View File

@ -12,6 +12,14 @@ ______________________________________________________________________
Notes for GoldED+ 1.1.5, December xx 2000
______________________________________________________________________
- PGP encoded/signed messages now detected by substring
"-----BEGIN PGP "
in first line of message rather than
"-----BEGIN PGP MESSAGE-----"
- Fixed keyboard handling in Win9x/ME (not well tested).
- Control characters (except tab, CR and LF) no longer stripped at the
@ -71,7 +79,7 @@ ______________________________________________________________________
another area correspondingly). Both added to READMainmenu menu.
There's no default keyboard assignment. (Not tested)
- Fixed EDITMainmenu operation.
- Fixed READMainmenu operation.
- Fixed incorrect filenames displaying in /w32 version.

View File

@ -266,7 +266,7 @@ void DoKludges(int mode, GMsg* msg, bool attronly) {
if(AA->isnet()) {
// 123456789012345678901234567
if(line->next and strneql(line->next->txt.c_str(), "-----BEGIN PGP MESSAGE-----", 27)) {
if(line->next and strneql(line->next->txt.c_str(), "-----BEGIN PGP ", 15)) {
line = AddKludge(line, "\001ENC: PGP");
}

View File

@ -252,13 +252,23 @@ void CfgInit2() {
}
// ------------------------------------------------------------------
bool inline samekey(gkey key1, gkey key2) {
if(key1 > 0xff) // special key
return false;
return (tolower(key1) == key2) or (toupper(key1) == key2);
}
// ------------------------------------------------------------------
int IsMacro(gkey key, int type) {
vector<Macro>::iterator m = CFG->macro.begin();
while(m != CFG->macro.end()) {
if(((key == m->key) or (tolower(key) == m->key) or (toupper(key) == m->key)) and (type == m->type))
if(((key == m->key) or samekey(key, m->key)) and (type == m->type))
return true;
m++;
}
@ -273,7 +283,7 @@ int PlayMacro(gkey key, int type) {
vector<Macro>::iterator m = CFG->macro.begin();
while(m != CFG->macro.end()) {
if(((key == m->key) or (tolower(key) == m->key) or (toupper(key) == m->key)) and (type == m->type)) {
if(((key == m->key) or samekey(key, m->key)) and (type == m->type)) {
RunMacro(m);
return true;
}

View File

@ -43,17 +43,29 @@
#define tolower(a) _nls_tolower((unsigned char)(a))
#define toupper(a) _nls_toupper((unsigned char)(a))
#elif defined(__WIN32__)
#ifdef __cplusplus
extern "C" {
#endif
extern char tl[256], tu[256];
inline char tolower(char c) { return tl[c]; }
inline char toupper(char c) { return tu[c]; }
inline int tolower(int c) { return tl[c]; }
inline int toupper(int c) { return tu[c]; }
#ifdef __cplusplus
}
#endif
#endif
// ------------------------------------------------------------------
#ifdef __cplusplus
extern "C" {
#endif
inline int iswhite(char c) { return c and (iscntrl(c) or (c == ' ')); }
// NLS chars detected by converting to lower or upper case and in case they don't match they treated as characters
inline int isxalnum(char c) { return isalnum(c) or ((c >= 128) and ((c != tolower(c)) or (c != toupper(c)))); }
#ifdef __cplusplus
}
#endif
// ------------------------------------------------------------------