New config file token QuoteUseNewAI

This commit is contained in:
Ianos Gnatiuc 2005-10-16 03:41:29 +00:00
parent 0c149cd68a
commit 745b4c1b94
13 changed files with 113 additions and 2 deletions

View File

@ -650,6 +650,9 @@ QUOTESTRING " FL> "
// effectively disables the automatically named quotebuffers, as
// described in the chapter about the QUOTEBUFMODE keyword.
//
;QuoteUseNewAI No/Yes
----------------------------------------------------------------------
-- REPLYLINKING

View File

@ -722,6 +722,11 @@ QuoteBufMode Ask ;
;QuoteBufMode Append ; „®¯¨á âì.
;QuoteBufMode Overwrite ; <20>¥à¥¯¨á âì.
// ˆá¯®«ì§®¢ âì ¤®¯®«­¨â¥«ì­ë© AI ¤«ï ª¢®â¨­£  (¯® 㬮«ç ­¨î: Yes)
// <20>஡ã¥â ­ ©â¨ «®¦­ë¥ æ¨â¨à®¢ ­¨ï, á¢ï§ ­­ë¥ á ¨á¯®«ì§®¢ ­¨¥¬ ¢ ⥪áâ¥
// æ¨â â ®¡à ¬«¥­­ë¥ ᨬ¢®« ¬¨ '<' ¨ '>' ¨ ¯®ª §ë¢ âì ¨å ¡¥§ ¯®¤á¢¥âª¨.
;QuoteUseNewAI No/Yes
----------------------------------------------------------------------
-- <20>Ž<E28098>Ž…<C5BD>ˆ<E28093>Ž—…Š Ž’‚…’Ž‚ (REPLYLINKING)

View File

@ -10,6 +10,9 @@ ______________________________________________________________________
Notes for GoldED+ 1.1.5, /snapshot/
______________________________________________________________________
+ New config file token: QuoteUseNewAI No/Yes. It will try to solve
false quoting when '<' and '>' characters is used.
- Fixed buffer overflow bug in LocationAlias matching.
- Fixed PgUp/PgDn keys in help window (bugreport from Semen Panevin).

View File

@ -756,6 +756,7 @@ CfgGed::CfgGed() {
quotectrl = CI_TEAR|CI_ORIG;
quotemargin = 70;
quotewraphard = false;
quoteusenewai = true;
ra2usersbbs = 0;
replylink = REPLYLINK_DIRECT;
replylinkfloat = true;

View File

@ -300,6 +300,7 @@ const word CRC_QUOTESPACING = 0xB403;
const word CRC_QUOTESTRING = 0xE44F;
const word CRC_QUOTESTOPS = 0xD2E4;
const word CRC_QUOTEWRAPHARD = 0x6BD4;
const word CRC_QUOTEUSENEWAI = 0xCFF0;
const word CRC_QWKBADMSGS = 0x0C2D;
const word CRC_QWKCONFMAP = 0xEAE1;
const word CRC_QWKEXPORTPATH = 0xB3AB;

View File

@ -488,6 +488,7 @@ SwitchQ:
case CRC_QUOTESTRING : CfgQuotestring (); break;
case CRC_QUOTESTOPS : CfgQuotestops (); break;
case CRC_QUOTEWRAPHARD : CfgQuotewraphard (); break;
case CRC_QUOTEUSENEWAI : CfgQuoteusenewai (); break;
case CRC_QWKBADMSGS : CfgQwkbadmsgs (); break;
case CRC_QWKCONFMAP : CfgQwkconfmap (); break;
case CRC_QWKEXPORTPATH : CfgQwkexportpath (); break;

View File

@ -82,6 +82,13 @@ void CfgQuotewraphard() {
// ------------------------------------------------------------------
void CfgQuoteusenewai()
{
CFG->quoteusenewai = 0 != GetYesno(val);
}
// ------------------------------------------------------------------
void CfgQwkbadmsgs() {
QWK->BadMsgs(val);

View File

@ -289,6 +289,7 @@ void CfgQuotespacing ();
void CfgQuotestring ();
void CfgQuotestops ();
void CfgQuotewraphard ();
void CfgQuoteusenewai ();
void CfgQwkbadmsgs ();
void CfgQwkconfmap ();
void CfgQwkexportpath ();

View File

@ -298,6 +298,7 @@ public:
char quotestring[10];
char quotestops[41];
bool quotewraphard;
bool quoteusenewai;
int ra2usersbbs; // RA2;
int replylink;
bool replylinkfloat;

View File

@ -101,7 +101,16 @@ void IEclass::setlinetype(Line* __line) {
_test_halt(__line == NULL);
__line->type &= ~(GLINE_ALL|GLINE_TEAR|GLINE_ORIG|GLINE_TAGL);
__line->type |= is_quote(__line->txt.c_str()) ? GLINE_QUOT : (__line->txt[0] == CTRL_A) ? GLINE_HIDD : 0;
if (is_quote(__line->txt.c_str()) &&
is_quote2(__line, __line->txt.c_str()))
{
__line->type |= GLINE_QUOT;
}
else if (__line->txt[0] == CTRL_A)
{
__line->type |= GLINE_HIDD;
}
}
@ -660,6 +669,7 @@ Line* IEclass::wrapit(Line** __currline, uint* __curr_col, uint* __curr_row, boo
// Length of this line
uint _thislen = _thisline->txt.length();
setlinetype(_thisline);
uint _wrapmargin = (_thisline->type & GLINE_QUOT) ? marginquotes : margintext;
// Does this line need wrapping?

View File

@ -2212,7 +2212,8 @@ void MakeLineIndex(GMsg* msg, int margin, bool getvalue, bool header_recode) {
ptr = tptr;
}
}
else if(is_quote(ptr)) {
else if(is_quote(ptr) && is_quote2(line, ptr))
{
para = GLINE_QUOT;
line->type |= GLINE_QUOT|GLINE_HARD;
GetQuotestr(ptr, qbuf, &qlen);

View File

@ -393,6 +393,7 @@ int GetAkaNo(const ftn_addr& __aka);
int GetQuotestr(const char* ptr, char* qbuf, uint* qlen);
int cmp_quotes(char* q1, char* q2);
int is_quote(const char* ptr);
bool is_quote2(const Line* line, const char* ptr);
int IsQuoteChar(const char* s);
void maketitle();
int maketitle_and_status(char *);

View File

@ -371,6 +371,82 @@ int is_quote(const char* ptr) {
}
// ------------------------------------------------------------------
bool is_quote2(const Line* line, const char* ptr)
{
if (!CFG->quoteusenewai) return true;
char *head = (char *)ptr;
// search first '>' before CR, NUL or any other quote character
for (bool found = false; !found; ptr++)
{
if (*ptr == '>')
found = true;
else
{
if (IsQuoteChar(ptr) || (*ptr == CR) || !*ptr)
return true;
}
}
// line is double quoted?
if (is_quote(ptr))
return true;
// if "SPACE*[a-zA-Z]{0, 3}>"
for (ptr--; isspace(*head); head++);
int nr = 0;
for (char *tmp = head; tmp < ptr; tmp++)
{
char ch = toupper(*tmp);
if ((ch >= 'A') && (ch <= 'Z'))
nr++;
}
if ((nr < 4) && (nr == (ptr-head)))
return true;
// take a look at previous lines
for (Line *ln = line->prev; ln; ln = ln->prev)
{
// previous line is quoted?
if (ln->isquote())
return true;
// or begin of paragraph?
if ((ln->txt.length() == 0) ||
(ln->txt[0] == LF) ||
(ln->txt[0] == CR))
return true;
// or kludge?
if (ln->txt[0] == CTRL_A)
return true;
// found begin of citation?
char *begin = strrchr(ln->txt.c_str(), '<');
if (begin)
{
// found both '<' and '>'?
if (strchr(begin, '>'))
return true;
for (Line *ln2 = ln->next; ln2 != line; ln2 = ln2->next)
{
// found both '<' and '>'?
if (strchr(ln2->txt.c_str(), '>'))
return true;
}
return false; // don't quote current line
}
}
return true;
}
// ------------------------------------------------------------------
int quotecolor(const char* line) {