InternetRFCBody, ZapQuotesBelow, EditNewLine and other fixes
This commit is contained in:
parent
4dc91867e5
commit
9008bc555d
@ -12,6 +12,12 @@ ______________________________________________________________________
|
|||||||
Notes for GoldED+ 1.1.5, /snapshot/
|
Notes for GoldED+ 1.1.5, /snapshot/
|
||||||
______________________________________________________________________
|
______________________________________________________________________
|
||||||
|
|
||||||
|
- Fixed crash on very long name in Internet messages.
|
||||||
|
|
||||||
|
! ZapQuotesBelow now acts only on the single quotation block, not on
|
||||||
|
the all quotes below. It's more handy, especially in case of
|
||||||
|
removing attach from the file.
|
||||||
|
|
||||||
! A lot of improvements in charset handling added. QP postfix now
|
! A lot of improvements in charset handling added. QP postfix now
|
||||||
could be used with any charset, not only with LATIN1. Completely
|
could be used with any charset, not only with LATIN1. Completely
|
||||||
untested!
|
untested!
|
||||||
|
@ -902,7 +902,10 @@ Line* IEclass::wrapit(Line** __currline, uint* __curr_col, uint* __curr_row, boo
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(__display and (scroll != 0)) {
|
if(__display and (scroll != 0)) {
|
||||||
refresh((*__currline)->next, _cursrow+1);
|
if((*__currline)->next != NULL)
|
||||||
|
refresh((*__currline)->next, _cursrow+1);
|
||||||
|
else
|
||||||
|
refresh(*__currline, _cursrow);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update cursor position
|
// Update cursor position
|
||||||
@ -1204,15 +1207,13 @@ void IEclass::Newline() {
|
|||||||
// Pointer to the split position
|
// Pointer to the split position
|
||||||
int _splitpos = col;
|
int _splitpos = col;
|
||||||
|
|
||||||
char _quotebuf[MAXQUOTELEN];
|
|
||||||
*_quotebuf = NUL;
|
|
||||||
|
|
||||||
// Buffer for the second part of the split line
|
// Buffer for the second part of the split line
|
||||||
string _splitbuf;
|
string _splitbuf;
|
||||||
|
|
||||||
// If the split line was quoted, get the quotestring
|
// If the split line was quoted, get the quotestring
|
||||||
// But do not get it if the cursor points to a linefeed or is
|
// But do not get it if the cursor points to a linefeed or is
|
||||||
uint _quotelen;
|
uint _quotelen;
|
||||||
|
char _quotebuf[MAXQUOTELEN];
|
||||||
GetQuotestr(currline->txt.c_str(), _quotebuf, &_quotelen);
|
GetQuotestr(currline->txt.c_str(), _quotebuf, &_quotelen);
|
||||||
|
|
||||||
// Eliminate the quotestring if
|
// Eliminate the quotestring if
|
||||||
@ -1238,17 +1239,32 @@ void IEclass::Newline() {
|
|||||||
setlinetype(currline);
|
setlinetype(currline);
|
||||||
displine(currline, row);
|
displine(currline, row);
|
||||||
|
|
||||||
// Insert a new line below, set the line text to the split-off part
|
uint _quotelen1 = 0;
|
||||||
currline = insertlinebelow(currline, _splitbuf.c_str());
|
char _quotebuf1[MAXQUOTELEN] = "";
|
||||||
|
if(currline->next != NULL) {
|
||||||
|
GetQuotestr(currline->next->txt.c_str(), _quotebuf1, &_quotelen1);
|
||||||
|
}
|
||||||
|
|
||||||
// --v--
|
if((_splitbuf.find('\n') != _splitbuf.npos) or (currline->next == NULL) or not strieql(_quotebuf, _quotebuf1)) {
|
||||||
// This line would be wrapped
|
// Insert a new line below, set the line text to the split-off part
|
||||||
// This line would be
|
currline = insertlinebelow(currline, _splitbuf.c_str());
|
||||||
// wrapped
|
|
||||||
|
|
||||||
Undo->PushItem(EDIT_UNDO_WRAP_TEXT|BATCH_MODE, currline->prev, _quotelen, _splitbuf.length() - _quotelen);
|
// --v--
|
||||||
|
// This line would be wrapped
|
||||||
|
// This line would be
|
||||||
|
// wrapped
|
||||||
|
|
||||||
setlinetype(currline);
|
Undo->PushItem(EDIT_UNDO_WRAP_TEXT|BATCH_MODE, currline->prev, _quotelen, _splitbuf.length() - _quotelen);
|
||||||
|
|
||||||
|
setlinetype(currline);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
currline = currline->next;
|
||||||
|
|
||||||
|
currline->txt.insert(_quotelen1, _splitbuf.substr(_quotelen1));
|
||||||
|
|
||||||
|
Undo->PushItem(EDIT_UNDO_WRAP_TEXT|BATCH_MODE, currline->prev, _quotelen1, _splitbuf.length() - _quotelen1);
|
||||||
|
}
|
||||||
|
|
||||||
// Move down the cursor
|
// Move down the cursor
|
||||||
col = 0;
|
col = 0;
|
||||||
@ -1259,7 +1275,8 @@ void IEclass::Newline() {
|
|||||||
scrolldown(mincol, row, maxcol, maxrow);
|
scrolldown(mincol, row, maxcol, maxrow);
|
||||||
|
|
||||||
// Rewrap the split-off line
|
// Rewrap the split-off line
|
||||||
wrapdel(&currline, &col, &row);
|
wrapdel(&currline, &col, &row, true);
|
||||||
|
refresh(currline, row);
|
||||||
|
|
||||||
GFTRK(NULL);
|
GFTRK(NULL);
|
||||||
}
|
}
|
||||||
@ -1504,13 +1521,32 @@ void IEclass::deleteline(bool zapquotesbelow) {
|
|||||||
|
|
||||||
GFTRK("Editdeleteline");
|
GFTRK("Editdeleteline");
|
||||||
|
|
||||||
|
if(zapquotesbelow and not (currline->type & GLINE_QUOT)) {
|
||||||
|
GFTRK(NULL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stop reflow if the quotestring on the next line is not the same
|
||||||
|
uint _qlen1;
|
||||||
|
char _qstr1[MAXQUOTELEN];
|
||||||
|
GetQuotestr(currline->txt.c_str(), _qstr1, &_qlen1);
|
||||||
|
|
||||||
bool done = false;
|
bool done = false;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
||||||
// Break if need to zap quotes, but the current line is not quote and is not empty
|
// Break if need to zap quotes, but the current line is not quote and is not empty
|
||||||
if(zapquotesbelow and not ((currline->type & GLINE_QUOT) or strblank(currline->txt.c_str())))
|
if(zapquotesbelow) {
|
||||||
break;
|
if(isempty(currline) or (currline->type & (GLINE_KLUDGE|GLINE_TEAR|GLINE_ORIG|GLINE_TAGL)))
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Stop zap if the quotestring on the line is not the same
|
||||||
|
uint _qlen2;
|
||||||
|
char _qstr2[MAXQUOTELEN];
|
||||||
|
GetQuotestr(currline->txt.c_str(), _qstr2, &_qlen2);
|
||||||
|
if(not cmp_quotes(_qstr1, _qstr2))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Pointer to the deleted line
|
// Pointer to the deleted line
|
||||||
Line* _deletedline = currline;
|
Line* _deletedline = currline;
|
||||||
@ -1647,7 +1683,6 @@ void IEclass::ZapQuoteBelow() {
|
|||||||
if(row) {
|
if(row) {
|
||||||
GoUp();
|
GoUp();
|
||||||
GoEOL();
|
GoEOL();
|
||||||
Newline();
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
UndoItem* i = Undo->last_item;
|
UndoItem* i = Undo->last_item;
|
||||||
|
@ -160,6 +160,7 @@ enum {
|
|||||||
RFC_MIME_VERSION,
|
RFC_MIME_VERSION,
|
||||||
RFC_NEWSGROUPS,
|
RFC_NEWSGROUPS,
|
||||||
RFC_NEWS_SOFTWARE,
|
RFC_NEWS_SOFTWARE,
|
||||||
|
RFC_NNTP_POSTING_DATE,
|
||||||
RFC_NNTP_POSTING_HOST,
|
RFC_NNTP_POSTING_HOST,
|
||||||
RFC_NNTP_POSTING_USER,
|
RFC_NNTP_POSTING_USER,
|
||||||
RFC_OLD_DATE,
|
RFC_OLD_DATE,
|
||||||
@ -335,6 +336,7 @@ static const Kludges rfc_list[] = {
|
|||||||
{ "MIME-Version" , RFC_MIME_VERSION , KCRQ_COLON },
|
{ "MIME-Version" , RFC_MIME_VERSION , KCRQ_COLON },
|
||||||
{ "Newsgroups" , RFC_NEWSGROUPS , KCRQ_COLON },
|
{ "Newsgroups" , RFC_NEWSGROUPS , KCRQ_COLON },
|
||||||
{ "News-Software" , RFC_NEWS_SOFTWARE , KCRQ_COLON },
|
{ "News-Software" , RFC_NEWS_SOFTWARE , KCRQ_COLON },
|
||||||
|
{ "NNTP-Posting-Date" , RFC_NNTP_POSTING_DATE , KCRQ_COLON },
|
||||||
{ "NNTP-Posting-Host" , RFC_NNTP_POSTING_HOST , KCRQ_COLON },
|
{ "NNTP-Posting-Host" , RFC_NNTP_POSTING_HOST , KCRQ_COLON },
|
||||||
{ "NNTP-Posting-User" , RFC_NNTP_POSTING_USER , KCRQ_COLON },
|
{ "NNTP-Posting-User" , RFC_NNTP_POSTING_USER , KCRQ_COLON },
|
||||||
{ "Old-Date" , RFC_OLD_DATE , KCRQ_COLON },
|
{ "Old-Date" , RFC_OLD_DATE , KCRQ_COLON },
|
||||||
@ -1266,6 +1268,7 @@ int HandleRFCs(GMsg* msg, Line* line, int kludgenum, const char* ptr, int getval
|
|||||||
case RFC_LINES:
|
case RFC_LINES:
|
||||||
case RFC_MAILING_LIST:
|
case RFC_MAILING_LIST:
|
||||||
case RFC_NEWS_SOFTWARE:
|
case RFC_NEWS_SOFTWARE:
|
||||||
|
case RFC_NNTP_POSTING_DATE:
|
||||||
case RFC_NNTP_POSTING_HOST:
|
case RFC_NNTP_POSTING_HOST:
|
||||||
case RFC_NNTP_POSTING_USER:
|
case RFC_NNTP_POSTING_USER:
|
||||||
case RFC_OLD_DATE:
|
case RFC_OLD_DATE:
|
||||||
@ -2469,7 +2472,7 @@ void MakeLineIndex(GMsg* msg, int margin, bool header_recode) {
|
|||||||
char lwsp = *linep->next->txt.c_str();
|
char lwsp = *linep->next->txt.c_str();
|
||||||
while((lwsp == ' ') or (lwsp == '\t') or (linep->type & GLINE_WRAP)) {
|
while((lwsp == ' ') or (lwsp == '\t') or (linep->type & GLINE_WRAP)) {
|
||||||
linep = linep->next;
|
linep = linep->next;
|
||||||
linep->type |= linep->prev->type;
|
linep->type |= linep->prev->type & (GLINE_KLUD|GLINE_HIDD);
|
||||||
linep->color = linep->prev->color;
|
linep->color = linep->prev->color;
|
||||||
if(linep->next)
|
if(linep->next)
|
||||||
lwsp = *linep->next->txt.c_str();
|
lwsp = *linep->next->txt.c_str();
|
||||||
@ -2928,8 +2931,6 @@ Line* AddHexdump(Line*& line, void* data, size_t datalen) {
|
|||||||
char* ParseInternetAddr(char* __string, char* __name, char* __addr) {
|
char* ParseInternetAddr(char* __string, char* __name, char* __addr) {
|
||||||
|
|
||||||
*__name = *__addr = NUL;
|
*__name = *__addr = NUL;
|
||||||
char* name = __name;
|
|
||||||
char* addr = __addr;
|
|
||||||
char* commaptr = NULL;
|
char* commaptr = NULL;
|
||||||
|
|
||||||
if(strchr(__string, ',')) {
|
if(strchr(__string, ',')) {
|
||||||
@ -2968,12 +2969,8 @@ char* ParseInternetAddr(char* __string, char* __name, char* __addr) {
|
|||||||
}
|
}
|
||||||
if(*begchar == '(' /*)*/)
|
if(*begchar == '(' /*)*/)
|
||||||
begchar++;
|
begchar++;
|
||||||
if(not strchr(__string, '@') and strchr(begchar, '@')) {
|
strbtrim(strxcpy(__name, begchar, MinV((uint)(endchar-begchar)+1, sizeof(INam))));
|
||||||
name = __addr;
|
strbtrim(strxcpy(__addr, __string, MinV((uint)(begchar-__string), sizeof(IAdr))));
|
||||||
addr = __name;
|
|
||||||
}
|
|
||||||
strbtrim(strxcpy(name, begchar, (uint)(endchar-begchar)+1));
|
|
||||||
strbtrim(strxcpy(addr, __string, (uint)(begchar-__string)));
|
|
||||||
}
|
}
|
||||||
else if(*endchar == '>') {
|
else if(*endchar == '>') {
|
||||||
char* endaddr = endchar;
|
char* endaddr = endchar;
|
||||||
@ -2985,15 +2982,11 @@ char* ParseInternetAddr(char* __string, char* __name, char* __addr) {
|
|||||||
endchar--;
|
endchar--;
|
||||||
}
|
}
|
||||||
__string = strskip_wht(__string);
|
__string = strskip_wht(__string);
|
||||||
if(not strchr(begaddr, '@') and strchr(__string, '@')) {
|
strbtrim(strxcpy(__name, __string, MinV((uint)(endchar-__string)+1, sizeof(INam))));
|
||||||
name = __addr;
|
strbtrim(strxcpy(__addr, begaddr, MinV((uint)(endaddr-begaddr)+1, sizeof(IAdr))));
|
||||||
addr = __name;
|
|
||||||
}
|
|
||||||
strbtrim(strxcpy(name, __string, (uint)(endchar-__string)+1));
|
|
||||||
strbtrim(strxcpy(addr, begaddr, (uint)(endaddr-begaddr)+1));
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
strcpy(__addr, __string);
|
strxcpy(__addr, __string, sizeof(IAdr));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(*__addr == '@') {
|
if(*__addr == '@') {
|
||||||
@ -3007,6 +3000,9 @@ char* ParseInternetAddr(char* __string, char* __name, char* __addr) {
|
|||||||
|
|
||||||
StripQuotes(__name);
|
StripQuotes(__name);
|
||||||
|
|
||||||
|
if(not strchr(__addr, '@'))
|
||||||
|
*__addr = NUL;
|
||||||
|
|
||||||
strxmimecpy(__name, __name, 0, strlen(__name)+1, true);
|
strxmimecpy(__name, __name, 0, strlen(__name)+1, true);
|
||||||
|
|
||||||
return __name;
|
return __name;
|
||||||
|
@ -30,8 +30,6 @@
|
|||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
|
||||||
#include <gdefs.h>
|
|
||||||
#include <gutlos.h>
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
#define __USELOCALES__
|
#define __USELOCALES__
|
||||||
#elif defined(__EMX__)
|
#elif defined(__EMX__)
|
||||||
@ -47,14 +45,14 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
extern char tl[256], tu[256];
|
extern char tl[256], tu[256];
|
||||||
inline int _nls_tolower(int c) { return tl[c]; }
|
__inline__ int _nls_tolower(int c) { return tl[c]; }
|
||||||
inline int _nls_toupper(int c) { return tu[c]; }
|
__inline__ int _nls_toupper(int c) { return tu[c]; }
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#define tolower(a) _nls_tolower((unsigned char)(a))
|
#define tolower(a) _nls_tolower((unsigned char)(a))
|
||||||
#define toupper(a) _nls_toupper((unsigned char)(a))
|
#define toupper(a) _nls_toupper((unsigned char)(a))
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
@ -63,7 +61,7 @@ inline int _nls_toupper(int c) { return tu[c]; }
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
// NLS chars detected by converting to lower or upper case and in case they don't match they treated as characters
|
// 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 isascii(c) ? isalnum(c) : (c != tolower(c)) or (c != toupper(c)); }
|
__inline__ int isxalnum(char c) { return isascii(c) ? isalnum(c) : (c != tolower(c)) || (c != toupper(c)); }
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -26,9 +26,8 @@
|
|||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <gctype.h>
|
|
||||||
#include <gstrall.h>
|
|
||||||
#include <gutlmisc.h>
|
#include <gutlmisc.h>
|
||||||
|
#include <gstrall.h>
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include <gdefs.h>
|
||||||
#include <gctype.h>
|
#include <gctype.h>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
TOP=../..
|
TOP=../..
|
||||||
TARGET=glibc
|
TARGET=glibc
|
||||||
INCS=-I$(TOP)/goldlib/glibc
|
INCS=-I$(TOP)/goldlib/glibc -I$(TOP)/goldlib/gall
|
||||||
CFLAGS=-DHAVE_CONFIG_H
|
CFLAGS=-DHAVE_CONFIG_H
|
||||||
|
|
||||||
include $(TOP)/GNUmakef.inc
|
include $(TOP)/GNUmakef.inc
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fnmatch.h>
|
#include <fnmatch.h>
|
||||||
#include <ctype.h>
|
#include <gctype.h>
|
||||||
|
|
||||||
#if HAVE_STRING_H
|
#if HAVE_STRING_H
|
||||||
# include <string.h>
|
# include <string.h>
|
||||||
|
@ -210,7 +210,7 @@ init_syntax_once ()
|
|||||||
#include "regex.h"
|
#include "regex.h"
|
||||||
|
|
||||||
/* isalpha etc. are used for the character classes. */
|
/* isalpha etc. are used for the character classes. */
|
||||||
#include <ctype.h>
|
#include <gctype.h>
|
||||||
|
|
||||||
/* Jim Meyering writes:
|
/* Jim Meyering writes:
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user