various fixes
This commit is contained in:
parent
d288f34470
commit
9f70f9735c
@ -12,6 +12,17 @@ ______________________________________________________________________
|
||||
Notes for GoldED+ 1.1.5, February xx 2001
|
||||
______________________________________________________________________
|
||||
|
||||
! Window size in Win32 version now calculated from different
|
||||
parameters, you may need to adjust screen properties before running
|
||||
GoldED+ (especially in Win2k with it's defaults 300 rows :)). Though
|
||||
most users shouldn't noticed this change.
|
||||
|
||||
+ Status line update speed improved.
|
||||
|
||||
- Fixed character stripping on the clipboard block boundary.
|
||||
|
||||
! Default value for DispTabSize changed to 8.
|
||||
|
||||
! If @pseudo token created from address it now stops not only on space
|
||||
but at @ as well, so no more "Hello bigfoot@shoes.com!" :-)
|
||||
|
||||
|
@ -696,7 +696,7 @@ CfgGed::CfgGed() {
|
||||
displistcursor = NO;
|
||||
dispmargin = NO;
|
||||
dispmsgsize = DISPMSGSIZE_BYTES;
|
||||
disptabsize = 4;
|
||||
disptabsize = 8;
|
||||
encodeemailheaders = true;
|
||||
externoptions = EXTUTIL_CLS | EXTUTIL_SWAP | EXTUTIL_CURSOR | EXTUTIL_RELOAD | EXTUTIL_PAUSEONERROR | EXTUTIL_KEEPCTRL;
|
||||
ezycomuserno = 0;
|
||||
|
@ -1077,6 +1077,7 @@ void IEclass::editimport(Line* __line, char* __filename, bool imptxt) {
|
||||
memset(spaces, ' ', tabsz);
|
||||
spaces[tabsz] = NUL;
|
||||
int level = LoadCharset(AA->Xlatimport(), CFG->xlatlocalset);
|
||||
size_t buf_len = EDIT_PARABUFLEN;
|
||||
char* buf = (char*) throw_malloc(EDIT_PARABUFLEN);
|
||||
Line* saveline = __line->next;
|
||||
__line->next = NULL;
|
||||
@ -1115,15 +1116,22 @@ void IEclass::editimport(Line* __line, char* __filename, bool imptxt) {
|
||||
doinvalidate(buf, CFG->invalidate.xp.first.c_str(), CFG->invalidate.xp.second.c_str());
|
||||
}
|
||||
|
||||
size_t read_len = strlen(buf);
|
||||
|
||||
// Replace tabs
|
||||
char *ht = buf;
|
||||
while((ht = strchr(ht, '\t')) != NULL) {
|
||||
int rposn = ht-buf;
|
||||
int rstart = rposn%tabsz+1;
|
||||
*ht = ' ';
|
||||
if(tabsz > rstart)
|
||||
if(tabsz > rstart) {
|
||||
if((read_len + tabsz - rstart) >= (buf_len - 7)) {
|
||||
buf_len += tabsz;
|
||||
buf = (char*)throw_realloc(buf, buf_len);
|
||||
}
|
||||
strins(spaces+rstart, buf, rposn);
|
||||
}
|
||||
}
|
||||
|
||||
// Copy the paragraph to the new line and retype it
|
||||
Line* _newline = __line = insertlinebelow(__line, buf);
|
||||
|
@ -41,6 +41,7 @@ void IEclass::Clip2Buf() {
|
||||
spaces[tabsz] = NUL;
|
||||
|
||||
// Allocate paragraph read buffer
|
||||
size_t buf_len = EDIT_PARABUFLEN;
|
||||
char *buf = (char *)throw_malloc(EDIT_PARABUFLEN);
|
||||
Line *__line = NULL;
|
||||
|
||||
@ -49,15 +50,22 @@ void IEclass::Clip2Buf() {
|
||||
// Read paragraphs
|
||||
while(clipbrd.read(buf, EDIT_PARABUFLEN-6)) {
|
||||
|
||||
size_t read_len = strlen(buf);
|
||||
|
||||
// Replace tabs
|
||||
char *ht = buf;
|
||||
while((ht = strchr(ht, '\t')) != NULL) {
|
||||
int rposn = ht-buf;
|
||||
int rstart = rposn%tabsz+1;
|
||||
*ht = ' ';
|
||||
if(tabsz > rstart)
|
||||
if(tabsz > rstart) {
|
||||
if((read_len + tabsz - rstart) >= (buf_len - 6)) {
|
||||
buf_len += tabsz;
|
||||
buf = (char*)throw_realloc(buf, buf_len);
|
||||
}
|
||||
strins(spaces+rstart, buf, rposn);
|
||||
}
|
||||
}
|
||||
|
||||
// Copy the paragraph to the new line and retype it
|
||||
__line = insertlinebelow(__line, buf);
|
||||
|
@ -2978,7 +2978,7 @@ char* ParseInternetAddr(char* __string, char* __name, char* __addr) {
|
||||
|
||||
StripQuotes(__name);
|
||||
|
||||
strxmimecpy(__name, __name, 0, strlen(__name), true);
|
||||
strxmimecpy(__name, __name, 0, strlen(__name)+1, true);
|
||||
|
||||
return __name;
|
||||
}
|
||||
|
@ -398,20 +398,25 @@ void LoadText(GMsg* msg, const char* textfile) {
|
||||
char* ptr;
|
||||
char* txtptr;
|
||||
int hardcr = NO, hardlen;
|
||||
char hardline[20], tabspaces[9];
|
||||
|
||||
strcpy(tabspaces, " ");
|
||||
#define PBUFSIZE 4096 // Allow a 4k long paragraph
|
||||
|
||||
buf = (char*)throw_malloc(PBUFSIZE);
|
||||
char hardline[20];
|
||||
|
||||
fp = fsopen(textfile, "rt", CFG->sharemode);
|
||||
if(fp) {
|
||||
|
||||
#define PBUFSIZE 4096 // Allow a 4k long paragraph
|
||||
|
||||
size_t buf_len = PBUFSIZE;
|
||||
buf = (char*)throw_malloc(PBUFSIZE);
|
||||
|
||||
int tabsz = CFG->disptabsize ? CFG->disptabsize : 1;
|
||||
__extension__ char spaces[tabsz+1];
|
||||
memset(spaces, ' ', tabsz);
|
||||
spaces[tabsz] = NUL;
|
||||
|
||||
uint tlen = (uint)(fsize(fp)+512);
|
||||
msg->txt = txtptr = (char*)throw_realloc(msg->txt, tlen);
|
||||
memset(msg->txt, NUL, tlen);
|
||||
|
||||
tabspaces[CFG->disptabsize] = NUL;
|
||||
if(EDIT->HardLines())
|
||||
strcpy(hardline, EDIT->HardLine());
|
||||
else
|
||||
@ -420,8 +425,8 @@ void LoadText(GMsg* msg, const char* textfile) {
|
||||
hardlen = strlen(hardline);
|
||||
*txtptr = NUL;
|
||||
|
||||
while(fgets(buf, PBUFSIZE, fp)) {
|
||||
strsrep(buf, "\t", tabspaces); // Expand tabs
|
||||
while(fgets(buf, PBUFSIZE-1, fp)) {
|
||||
|
||||
if(EDIT->HardLines() and strneql(buf, hardline, hardlen)) {
|
||||
hardcr = not hardcr;
|
||||
if(*txtptr == LF)
|
||||
@ -431,43 +436,74 @@ void LoadText(GMsg* msg, const char* textfile) {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
size_t read_len = strlen(buf);
|
||||
|
||||
char *ht = buf;
|
||||
while((ht = strchr(ht, '\t')) != NULL) {
|
||||
int rposn = ht-buf;
|
||||
int rstart = rposn%tabsz+1;
|
||||
*ht = ' ';
|
||||
if(tabsz > rstart) {
|
||||
if((read_len + tabsz - rstart) >= (buf_len-1)) {
|
||||
buf_len += tabsz;
|
||||
buf = (char*)throw_realloc(buf, buf_len);
|
||||
}
|
||||
strins(spaces+rstart, buf, rposn);
|
||||
}
|
||||
}
|
||||
|
||||
ptr = buf;
|
||||
while(*ptr == ' ') // Skip leading spaces
|
||||
ptr++;
|
||||
if(*ptr != LF) {
|
||||
strsrep(buf, hardline, "\r");
|
||||
read_len = strlen(buf);
|
||||
if(hardcr or *buf == CTRL_A) {
|
||||
buf[strlen(buf)-1] = CR;
|
||||
if(not isspace(buf[read_len-1])) read_len += 1;
|
||||
buf[read_len-1] = CR;
|
||||
buf[read_len] = NUL;
|
||||
if(*txtptr == LF)
|
||||
*txtptr = CR;
|
||||
}
|
||||
else if(is_quote(buf)) {
|
||||
buf[strlen(buf)-1] = CR;
|
||||
if(not isspace(buf[read_len-1])) read_len += 1;
|
||||
buf[read_len-1] = CR;
|
||||
buf[read_len] = NUL;
|
||||
if(*txtptr == LF)
|
||||
*txtptr = CR;
|
||||
}
|
||||
else if((buf[0] == buf[1]) and (buf[0] == buf[2])) {
|
||||
buf[strlen(buf)-1] = CR;
|
||||
if(not isspace(buf[read_len-1])) read_len += 1;
|
||||
buf[read_len-1] = CR;
|
||||
buf[read_len] = NUL;
|
||||
if(*txtptr == LF)
|
||||
*txtptr = CR;
|
||||
}
|
||||
else if(strnieql(buf, " * Origin: ", 11)) {
|
||||
buf[strlen(buf)-1] = CR;
|
||||
if(not isspace(buf[read_len-1])) read_len += 1;
|
||||
buf[read_len-1] = CR;
|
||||
buf[read_len] = NUL;
|
||||
if(*txtptr == LF)
|
||||
*txtptr = CR;
|
||||
}
|
||||
else if(strnieql(ptr, "CC:", 3)) {
|
||||
buf[strlen(buf)-1] = CR;
|
||||
if(not isspace(buf[read_len-1])) read_len += 1;
|
||||
buf[read_len-1] = CR;
|
||||
buf[read_len] = NUL;
|
||||
if(*txtptr == LF)
|
||||
*txtptr = CR;
|
||||
}
|
||||
else if(strnieql(ptr, "XC:", 3)) {
|
||||
buf[strlen(buf)-1] = CR;
|
||||
if(not isspace(buf[read_len-1])) read_len += 1;
|
||||
buf[read_len-1] = CR;
|
||||
buf[read_len] = NUL;
|
||||
if(*txtptr == LF)
|
||||
*txtptr = CR;
|
||||
}
|
||||
else if(strnieql(buf, "SEEN-BY: ", 9)) {
|
||||
buf[strlen(buf)-1] = CR;
|
||||
if(not isspace(buf[read_len-1])) read_len += 1;
|
||||
buf[read_len-1] = CR;
|
||||
buf[read_len] = NUL;
|
||||
if(*txtptr == LF)
|
||||
*txtptr = CR;
|
||||
}
|
||||
@ -486,10 +522,9 @@ void LoadText(GMsg* msg, const char* textfile) {
|
||||
strcpy(buf, "\r");
|
||||
}
|
||||
}
|
||||
if(*(txtptr-1) == CR or *txtptr == NUL) {
|
||||
ptr = buf;
|
||||
size = strlen(ptr);
|
||||
memcpy(txtptr, ptr, size);
|
||||
if((*(txtptr-1) == CR) or (*txtptr == NUL)) {
|
||||
size = strlen(buf);
|
||||
memcpy(txtptr, buf, size);
|
||||
txtptr += size-1;
|
||||
}
|
||||
}
|
||||
@ -497,9 +532,9 @@ void LoadText(GMsg* msg, const char* textfile) {
|
||||
*(++txtptr) = CR;
|
||||
*(++txtptr) = NUL;
|
||||
fclose(fp);
|
||||
}
|
||||
throw_free(buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
@ -516,9 +516,9 @@ int TemplateToText(int mode, GMsg* msg, GMsg* oldmsg, const char* tpl, int origa
|
||||
ifp = fsopen(indexfile, "rb", CFG->sharemode);
|
||||
if(ifp) {
|
||||
fseek(ifp, 0L, SEEK_END);
|
||||
int idxs = (int)(ftell(ifp)/4L);
|
||||
int idxs = (int)(ftell(ifp)/sizeof(long));
|
||||
if(idxs) {
|
||||
fseek(ifp, (long)(rand()%idxs)*4L, SEEK_SET);
|
||||
fseek(ifp, (long)(rand()%idxs)*sizeof(long), SEEK_SET);
|
||||
fread(&fpos, sizeof(long), 1, ifp);
|
||||
fseek(tfp, fpos, SEEK_SET);
|
||||
while(fgets(buf, 255, tfp)) {
|
||||
|
@ -49,9 +49,8 @@ void update_statuslines() {
|
||||
called = YES;
|
||||
|
||||
vchar sep = _box_table(W_BSTAT, 3);
|
||||
char help[200], meminfo[200], clkinfo[200];
|
||||
char help[200], clkinfo[200];
|
||||
*clkinfo = NUL;
|
||||
*meminfo = NUL;
|
||||
*help = NUL;
|
||||
|
||||
if(CFG->switches.get(statuslineclock)) {
|
||||
@ -77,12 +76,29 @@ void update_statuslines() {
|
||||
__gver_postversion__
|
||||
);
|
||||
|
||||
int len = MAXCOL-strlen(help)-strlen(meminfo)-strlen(clkinfo)-2;
|
||||
sprintf(buf, " %s%-*.*s%s%s ", help, len, len, information, meminfo, clkinfo);
|
||||
int help_len = strlen(help);
|
||||
int clk_len = strlen(clkinfo);
|
||||
int len = MAXCOL-help_len-clk_len-2;
|
||||
sprintf(buf, " %s%-*.*s%s ", help, len, len, information, clkinfo);
|
||||
|
||||
if(streql(old_status_line, buf))
|
||||
char *begin = buf;
|
||||
char *obegin = old_status_line;
|
||||
char *end = buf + MAXCOL;
|
||||
char *oend = old_status_line + MAXCOL;
|
||||
while((*begin != NUL) and (*begin == *obegin)) {
|
||||
++begin;
|
||||
++obegin;
|
||||
}
|
||||
if(begin == end)
|
||||
return;
|
||||
strcpy(old_status_line, buf);
|
||||
// we have at least one mismatch
|
||||
if(*obegin) {
|
||||
while(*end == *oend) {
|
||||
--end;
|
||||
--oend;
|
||||
}
|
||||
}
|
||||
memcpy(obegin, begin, end-begin+1);
|
||||
|
||||
#ifdef GOLD_MOUSE
|
||||
gmou.GetStatus();
|
||||
@ -91,10 +107,12 @@ void update_statuslines() {
|
||||
#endif
|
||||
int row, col;
|
||||
vposget(&row, &col);
|
||||
wwprintstr(W_STAT, 0,0, C_STATW, buf);
|
||||
if(*help)
|
||||
wwprintc(W_STAT, 0,strlen(help)-1, C_STATW, sep);
|
||||
wwprintc(W_STAT, 0,MAXCOL-strlen(clkinfo), C_STATW, sep);
|
||||
*(++end) = NUL;
|
||||
wwprintstr(W_STAT, 0,begin-buf, C_STATW, begin);
|
||||
if(*help and ((begin - buf) < (help_len-1)) and ((end - buf) > (help_len-1)))
|
||||
wwprintc(W_STAT, 0,help_len-1, C_STATW, sep);
|
||||
if(((begin - buf) < (MAXCOL-clk_len)) and ((end - buf) > (MAXCOL-clk_len)))
|
||||
wwprintc(W_STAT, 0,MAXCOL-clk_len, C_STATW, sep);
|
||||
vposset(row, col);
|
||||
#ifdef GOLD_MOUSE
|
||||
if(gmou.Row() == MAXROW-1)
|
||||
|
@ -125,7 +125,7 @@ char* gclipbrd::read(char* buffer, int maxlen) {
|
||||
if(len > i and strchr("\r\n", *(p+1)) and (*p != *(p+1)))
|
||||
++i;
|
||||
}
|
||||
strxcpy(buffer, clipdata, ++i);
|
||||
strxcpy(buffer, clipdata, i+1);
|
||||
char* p2 = strpbrk(buffer, "\r\n");
|
||||
if(p2) *p2 = 0;
|
||||
if(p) strcat(buffer, "\n");
|
||||
|
@ -575,12 +575,12 @@ void GVid::detectinfo(GVidInfo* _info) {
|
||||
assert(GetConsoleScreenBufferInfo(gvid_hout, &csbi) != 0);
|
||||
|
||||
_info->screen.mode = 0;
|
||||
_info->screen.rows = csbi.srWindow.Bottom - csbi.srWindow.Top + 1;
|
||||
_info->screen.columns = csbi.srWindow.Right - csbi.srWindow.Left + 1;
|
||||
_info->screen.rows = csbi.dwSize.Y;
|
||||
_info->screen.columns = csbi.dwSize.X;
|
||||
|
||||
// Get cursor position and character attribute under the cursor
|
||||
_info->cursor.row = csbi.dwCursorPosition.Y - csbi.srWindow.Top;
|
||||
_info->cursor.column = csbi.dwCursorPosition.X - csbi.srWindow.Left;
|
||||
_info->cursor.row = csbi.dwCursorPosition.Y;
|
||||
_info->cursor.column = csbi.dwCursorPosition.X;
|
||||
_info->color.textattr = csbi.wAttributes;
|
||||
|
||||
// Get cursor form
|
||||
|
@ -63,20 +63,18 @@ void _HudsWide<msgn_t, rec_t, attr_t, board_t, last_t, __HUDSON>::update_netecho
|
||||
// Delete or add the header index
|
||||
if(__delete) {
|
||||
if(_pos < _total) {
|
||||
memmove(_scanidx+_pos, _scanidx+_pos+1, (_total-_pos-1)*sizeof(msgn_t));
|
||||
_total--;
|
||||
--_total;
|
||||
if(_total != _pos)
|
||||
memmove(_scanidx+_pos, _scanidx+_pos+1, (_total-_pos)*sizeof(msgn_t));
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(_scanidx[_closest] != __hdridx) {
|
||||
_scanidx[_total++] = __hdridx;
|
||||
for(uint k=_total >> 1; k; k >>= 1)
|
||||
for(uint i=k; i < _total; i++)
|
||||
for(uint j=i-k; (j >= 0) and CmpV(_scanidx[j], _scanidx[j+k]) > 0; j-=k) {
|
||||
msgn_t e = _scanidx[j];
|
||||
_scanidx[j] = _scanidx[j+k];
|
||||
_scanidx[j+k] = e;
|
||||
}
|
||||
++_closest;
|
||||
if(_closest != _total)
|
||||
memmove(_scanidx+_closest+1, _scanidx+_closest, (_total-_closest+1)*sizeof(msgn_t));
|
||||
_scanidx[_closest] = __hdridx;
|
||||
++_total;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user