Different fixes.

This commit is contained in:
Alexander S. Aganichev 2000-05-11 15:04:44 +00:00
parent d677ab9352
commit dd5d107d71
6 changed files with 126 additions and 23 deletions

View File

@ -16,6 +16,19 @@ ______________________________________________________________________
- Fixed FREQ feature. - Fixed FREQ feature.
- Fixed addressbook, nodelist browser when in edit header mode.
- Fixed small cosmetic bug in nodelist window regarding to filepath.
- Bit rearranged code that encodes RFC headers for latin-xx codepages.
Now GoldED+ automatically generates proper iso-8859-xx charset.
Please response if it doesn't work.
+ Added dirty hack for Linux console users, so now CUI interface more
functional there.
- Fixed broken MAPPATH / MAPDRIVE keywords.
______________________________________________________________________ ______________________________________________________________________
Notes for GoldED+ 1.1.4.4, April 25 2000 Notes for GoldED+ 1.1.4.4, April 25 2000

View File

@ -1090,13 +1090,12 @@ char* MapPath(char* map, bool reverse) {
strchg(cmap, GOLD_WRONG_SLASH_CHR, GOLD_SLASH_CHR); strchg(cmap, GOLD_WRONG_SLASH_CHR, GOLD_SLASH_CHR);
vector< pair<string, string> >::iterator i; vector< pair<string, string> >::iterator i;
for(i = CFG->mappath.begin(); i < CFG->mappath.end(); i++) { for(i = CFG->mappath.begin(); i != CFG->mappath.end(); i++) {
const char* p = reverse ? i->second.c_str() : i->first.c_str(); const char* p = reverse ? i->second.c_str() : i->first.c_str();
const char* q = reverse ? i->first.c_str() : i->second.c_str(); const char* q = reverse ? i->first.c_str() : i->second.c_str();
if(strnieql(cmap, p, strlen(p))) { if(strnieql(cmap, p, strlen(p))) {
strxcpy(buf, map, sizeof(Path)); strxcpy(buf, map, sizeof(Path));
strxmerge(map, sizeof(Path), map, q, buf+strlen(p), NULL); strxmerge(map, sizeof(Path), q, buf+strlen(p), NULL);
char sl1, sl2; char sl1, sl2;
char* ptr; char* ptr;
@ -1105,7 +1104,7 @@ char* MapPath(char* map, bool reverse) {
ptr = strpbrk(q, "/\\"); ptr = strpbrk(q, "/\\");
sl2 = ptr ? *ptr : NUL; sl2 = ptr ? *ptr : NUL;
if(sl1 and sl2) if(sl1 and sl2 and (sl1 != sl2))
strchg(map, sl1, sl2); strchg(map, sl1, sl2);
break; break;

View File

@ -162,13 +162,19 @@ char* mime_header_encode(char* dest, const char* source, GMsg* msg) {
if((*ptr < ' ') or (*ptr > '\x7F') or (inmime and strchr(" =?", *ptr))) { if((*ptr < ' ') or (*ptr > '\x7F') or (inmime and strchr(" =?", *ptr))) {
if(not inmime) { if(not inmime) {
if(msg->charset) { if(msg->charset) {
strcpy(bp, "=?"); bp = stpcpy(bp, "=?");
bp += 2; if(strneql(msg->charset, "latin-", 6)) {
strcpy(bp, strlword(msg->charset)); static const char *isono[] = { "15", "1", "2", "3", "4", "9", "10", "13", "14", "15" };
strlwr(bp); int chsno = atoi(msg->charset+6);
bp += strlen(bp); chsno = chsno > sizeof(isono)/sizeof(const char *) ? 0 : chsno;
strcpy(bp, "?Q?"); bp = strxmerge(bp, 12, "iso-8859-", isono[chsno]);
bp += 3; }
else {
char *pbp = bp;
bp = stpcpy(bp, strlword(msg->charset));
strlwr(pbp);
}
bp = stpcpy(bp, "?Q?");
} }
else { else {
strcpy(bp, "=?iso-8859-1?Q?"); strcpy(bp, "=?iso-8859-1?Q?");
@ -176,7 +182,7 @@ char* mime_header_encode(char* dest, const char* source, GMsg* msg) {
} }
inmime = true; inmime = true;
} }
sprintf(bp, "=%Xc", *ptr); sprintf(bp, "=%02X", (*ptr)&0xff);
bp += 3; bp += 3;
} }
else else

View File

@ -49,14 +49,14 @@ public:
GMsg* msg; GMsg* msg;
bool lookup; bool lookup;
bool handle_other_keys(uint& key); bool handle_other_keys(gkey& key);
bool validate(); bool validate();
}; };
// ------------------------------------------------------------------ // ------------------------------------------------------------------
bool GMsgHeaderEdit::handle_other_keys(uint& key) { bool GMsgHeaderEdit::handle_other_keys(gkey& key) {
switch(key) { switch(key) {
case Key_F10: case Key_F10:

View File

@ -205,7 +205,7 @@ void NodelistBrowser::AfterCursor() {
Path nlname; Path nlname;
*nlname = NUL; *nlname = NUL;
if(NLP->index_name() and NLP->nodelist_name()) if(NLP->index_name() and NLP->nodelist_name())
sprintf(nlname, " %s / %s ", NLP->index_name(), NLP->nodelist_name()); sprintf(nlname, " %s / %s ", NLP->index_name(), CleanFilename(NLP->nodelist_name()));
else if(NLP->index_name()) else if(NLP->index_name())
sprintf(nlname, " %s ", NLP->index_name()); sprintf(nlname, " %s ", NLP->index_name());
if(*nlname) if(*nlname)
@ -993,13 +993,13 @@ void Lookup(GMsg* msg, Addr* addr, char* name, int topline, char* status) {
} }
if(topline >= 0) { if(topline >= 0) {
dolookup = NO; dolookup = false;
if(AA->isnet() and CFG->switches.get(lookupnet)) if(AA->isnet() and CFG->switches.get(lookupnet))
dolookup = YES; dolookup = true;
else if(AA->isecho() and CFG->switches.get(lookupecho)) else if(AA->isecho() and CFG->switches.get(lookupecho))
dolookup = YES; dolookup = true;
else if(AA->islocal() and CFG->switches.get(lookuplocal)) else if(AA->islocal() and CFG->switches.get(lookuplocal))
dolookup = YES; dolookup = true;
} }
if(dolookup) { if(dolookup) {

View File

@ -55,6 +55,10 @@
#include <gcurses.h> #include <gcurses.h>
#endif #endif
#if defined(__linux__)
#include <sys/ioctl.h>
#endif
// ------------------------------------------------------------------ // ------------------------------------------------------------------
@ -913,6 +917,25 @@ const word numpad_keys[] = {
#endif #endif
#if defined(__linux__)
bool linux_cui_key(gkey k) {
switch(k) {
case Key_Dwn:
case Key_Up:
case Key_Lft:
case Key_Rgt:
case Key_Home:
case Key_Del:
case Key_Ins:
case Key_PgDn:
case Key_PgUp:
case Key_End:
return true;
}
return false;
}
#endif
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// Get key stroke // Get key stroke
@ -929,6 +952,12 @@ gkey kbxget_raw(int mode) {
if(mode == 2) { if(mode == 2) {
// We can't do much but we can at least this :-) // We can't do much but we can at least this :-)
k = kbxget_raw(1); k = kbxget_raw(1);
#ifdef __linux__
// Under Linux we could use TIOCLINUX fn. 6 to read shift states on console
// Of course it is very unportable but should produce good results :-)
key = 6;
if(ioctl(fileno(stdin), TIOCLINUX, &key) == -1)
#endif
key = 0; key = 0;
switch(k) { switch(k) {
case Key_C_Brk: case Key_C_Brk:
@ -976,12 +1005,14 @@ gkey kbxget_raw(int mode) {
ungetch(key2); ungetch(key2);
} }
// Curses sequence; lookup in nice table above // Curses sequence; lookup in nice table above
else if(key > KEY_CODE_YES) else if((key >= KEY_MIN) && (key <= KEY_MIN+sizeof(gkbd_curstable)/sizeof(int)))
k = (gkbd_curstable[key - KEY_MIN]); k = (gkbd_curstable[key - KEY_MIN]);
else if(key == '\015') else if(key == '\015')
k = Key_Ent; k = Key_Ent;
else if(key == '\011') else if(key == '\011')
k = Key_Tab; k = Key_Tab;
else if(key == '\000')
k = Key_Space;
else else
k = key; k = key;
@ -1204,7 +1235,15 @@ gkey kbxget_raw(int mode) {
#elif defined(__UNIX__) #elif defined(__UNIX__)
if(mode == 2) { if(mode == 2) {
return 0; int key;
#ifdef __linux__
// Under Linux we could use TIOCLINUX fn. 6 to read shift states on console
// Of course it is very unportable but should produce good results :-)
key = 6;
if(ioctl(fileno(stdin), TIOCLINUX, &key) == -1)
#endif
key = 0;
return key;
} }
else if(mode & 0x01) { else if(mode & 0x01) {
@ -1218,6 +1257,52 @@ gkey kbxget_raw(int mode) {
#endif #endif
#ifdef __linux__
if(linux_cui_key(k)) {
int shifts = kbxget_raw(2);
if(shifts & (LSHIFT | RSHIFT))
KCodScn(k) |= 0x80;
else if(shifts & GCTRL) {
switch(k) {
case Key_Ins:
k = Key_C_Ins;
break;
case Key_Del:
k = Key_C_Del;
break;
case Key_Dwn:
k = Key_C_Dwn;
break;
case Key_Up:
k = Key_C_Up;
break;
case Key_Lft:
k = Key_C_Lft;
break;
case Key_Rgt:
k = Key_C_Rgt;
break;
case Key_Home:
k = Key_C_Home;
break;
case Key_PgDn:
k = Key_C_PgDn;
break;
case Key_PgUp:
k = Key_C_PgUp;
break;
case Key_End:
k = Key_C_End;
break;
}
}
} else if(k == Key_BS) {
int shifts = kbxget_raw(2);
if(shifts & ALT)
key = Key_A_BS;
}
#endif
return k; return k;
} }