different fixes

This commit is contained in:
Alexander S. Aganichev 2001-03-09 14:40:06 +00:00
parent c02dcab88d
commit 8b8b88b7af
6 changed files with 46 additions and 37 deletions

View File

@ -567,6 +567,8 @@ void IEclass::GoLeft() {
if(currline->prev) { if(currline->prev) {
GoUp(); GoUp();
GoEOL(); GoEOL();
if(currline->txt[col] != '\n')
col--;
} }
} }
else else
@ -605,7 +607,7 @@ void IEclass::GoRight() {
// ------------------------------------------------------------------ // ------------------------------------------------------------------
Line* IEclass::wrapit(Line** __currline, uint* __curr_col, uint* __curr_row, int __display) { Line* IEclass::wrapit(Line** __currline, uint* __curr_col, uint* __curr_row, bool __display) {
_test_halt(__currline == NULL); _test_halt(__currline == NULL);
_test_halt(*__currline == NULL); _test_halt(*__currline == NULL);
@ -667,7 +669,8 @@ Line* IEclass::wrapit(Line** __currline, uint* __curr_col, uint* __curr_row, int
// NOTE: Leading spaces to this word will be nulled out! // NOTE: Leading spaces to this word will be nulled out!
// Begin at the first char outside the margin // Begin at the first char outside the margin
_wrappos++; if((_wrappos + 1) <= maxcol)
_wrappos++;
} }
else { else {
@ -903,7 +906,7 @@ Line* IEclass::wrapit(Line** __currline, uint* __curr_col, uint* __curr_row, int
// ------------------------------------------------------------------ // ------------------------------------------------------------------
Line* IEclass::wrapdel(Line** __currline, uint* __curr_col, uint* __curr_row, int __display) { Line* IEclass::wrapdel(Line** __currline, uint* __curr_col, uint* __curr_row, bool __display) {
GFTRK("Editwrapdel"); GFTRK("Editwrapdel");
@ -917,7 +920,7 @@ Line* IEclass::wrapdel(Line** __currline, uint* __curr_col, uint* __curr_row, in
// ------------------------------------------------------------------ // ------------------------------------------------------------------
Line* IEclass::wrapins(Line** __currline, uint* __curr_col, uint* __curr_row, int __display) { Line* IEclass::wrapins(Line** __currline, uint* __curr_col, uint* __curr_row, bool __display) {
GFTRK("Editwrapins"); GFTRK("Editwrapins");
@ -1033,13 +1036,26 @@ void IEclass::DelChar() {
Undo->PushItem(EDIT_UNDO_DEL_LINE|BATCH_MODE, _nextline); Undo->PushItem(EDIT_UNDO_DEL_LINE|BATCH_MODE, _nextline);
} }
else if((_thislen > 1) and (_thisline->txt.c_str()[_thislen-2] != '\n') and _nextline and not (_nextline->type & GLINE_QUOT)) {
_thisline->txt += _nextline->txt.c_str();
Undo->PushItem(EDIT_UNDO_CUT_TEXT|batch_mode, _thisline, _thislen-1);
// Relink this line
_thisline->next = _nextline->next;
if(_thisline->next)
_thisline->next->prev = _thisline;
Undo->PushItem(EDIT_UNDO_DEL_LINE|BATCH_MODE, _nextline);
}
batch_mode = BATCH_MODE; batch_mode = BATCH_MODE;
// Make sure the line type still is correct // Make sure the line type still is correct
setlinetype(_thisline); setlinetype(_thisline);
// Rewrap this line // Rewrap this line
wrapdel(&currline, &col, &row); wrapdel(&currline, &col, &row, false);
refresh(currline, row); refresh(currline, row);

View File

@ -318,9 +318,9 @@ protected:
void statusline (); void statusline ();
void windowclose (); void windowclose ();
void windowopen (); void windowopen ();
Line* wrapit (Line** __currline, uint* __curr_col, uint* __curr_row, int __display=YES); Line* wrapit (Line** __currline, uint* __curr_col, uint* __curr_row, bool __display=true);
Line* wrapdel (Line** __currline, uint* __curr_col, uint* __curr_row, int __display=YES); Line* wrapdel (Line** __currline, uint* __curr_col, uint* __curr_row, bool __display=true);
Line* wrapins (Line** __currline, uint* __curr_col, uint* __curr_row, int __display=YES); Line* wrapins (Line** __currline, uint* __curr_col, uint* __curr_row, bool __display=true);
#ifndef NDEBUG #ifndef NDEBUG
void debugtest (char* __test, int __a, int __b, char* __file, int __line, int __values); void debugtest (char* __test, int __a, int __b, char* __file, int __line, int __values);

View File

@ -622,7 +622,7 @@ void IEclass::BlockDel(Line* anchor) {
firstcol = blockcol; firstcol = blockcol;
} }
else { else {
if(currline != anchor or blockcol > col) if((currline != anchor) or (blockcol > col))
lastcol = blockcol; lastcol = blockcol;
else else
firstcol = blockcol; firstcol = blockcol;
@ -635,8 +635,8 @@ void IEclass::BlockDel(Line* anchor) {
size_t __len = firstcutline->txt.length(); size_t __len = firstcutline->txt.length();
firstcutline->txt += lastcutline->txt.c_str()+lastcol; firstcutline->txt += lastcutline->txt.c_str()+lastcol;
Undo->PushItem(EDIT_UNDO_INS_TEXT, firstcutline, __len); Undo->PushItem(EDIT_UNDO_INS_TEXT, firstcutline, __len);
Undo->PushItem(EDIT_UNDO_DEL_TEXT|BATCH_MODE, firstcutline, firstcol, __len); Undo->PushItem(EDIT_UNDO_DEL_TEXT|BATCH_MODE, firstcutline, firstcol, __len-firstcol);
firstcutline->txt.erase(firstcol, __len); firstcutline->txt.erase(firstcol, __len-firstcol);
} }
else { else {
Undo->PushItem(EDIT_UNDO_DEL_TEXT, firstcutline, firstcol, lastcol-firstcol); Undo->PushItem(EDIT_UNDO_DEL_TEXT, firstcutline, firstcol, lastcol-firstcol);
@ -661,13 +661,13 @@ void IEclass::BlockDel(Line* anchor) {
// Refresh the display // Refresh the display
if(not RngV(row, minrow, maxrow)) { if(not RngV(row, minrow, maxrow)) {
row = minrow; row = minrow;
wrapdel(&currline, &col, &row, YES); wrapdel(&currline, &col, &row, false);
refresh(currline, minrow); refresh(currline, minrow);
} }
else { else {
row = MaxV(firstcutlinerow, minrow); row = MaxV(firstcutlinerow, minrow);
Line* topline = findtopline(); Line* topline = findtopline();
wrapdel(&currline, &col, &row, NO); wrapdel(&currline, &col, &row, false);
refresh(topline, minrow); refresh(topline, minrow);
} }
@ -742,7 +742,7 @@ void IEclass::BlockPaste() {
currline->txt += _pasteline->txt; currline->txt += _pasteline->txt;
setlinetype(currline); setlinetype(currline);
col = currline->txt.length(); col = currline->txt.length();
wrapins(&currline, &col, &row, NO); wrapins(&currline, &col, &row, false);
currline = _newline; currline = _newline;
col = 0; col = 0;
if(row < maxrow) if(row < maxrow)
@ -753,7 +753,7 @@ void IEclass::BlockPaste() {
currline->txt.insert(col, _pasteline->txt); currline->txt.insert(col, _pasteline->txt);
Undo->PushItem(EDIT_UNDO_INS_TEXT|BATCH_MODE, currline, col, pastelen); Undo->PushItem(EDIT_UNDO_INS_TEXT|BATCH_MODE, currline, col, pastelen);
col += pastelen; col += pastelen;
wrapins(&currline, &col, &row, NO); wrapins(&currline, &col, &row, false);
} }
setlinetype(currline); setlinetype(currline);
@ -1146,7 +1146,7 @@ void IEclass::editimport(Line* __line, char* __filename, bool imptxt) {
// Wrap it // Wrap it
uint _tmpcol = 0; uint _tmpcol = 0;
uint _tmprow = 0; uint _tmprow = 0;
_newline = wrapins(&_newline, &_tmpcol, &_tmprow, NO); _newline = wrapins(&_newline, &_tmpcol, &_tmprow, false);
} }
__line = _newline; __line = _newline;
@ -1160,7 +1160,7 @@ void IEclass::editimport(Line* __line, char* __filename, bool imptxt) {
// Wrap it // Wrap it
uint _tmpcol = 0; uint _tmpcol = 0;
uint _tmprow = 0; uint _tmprow = 0;
__line = wrapins(&__line, &_tmpcol, &_tmprow, NO); __line = wrapins(&__line, &_tmpcol, &_tmprow, false);
} }
__line->next = saveline; __line->next = saveline;
if(saveline) if(saveline)

View File

@ -213,7 +213,7 @@ const byte KCRQ_CASE = 0x0002;
// ------------------------------------------------------------------ // ------------------------------------------------------------------
static Kludges fts_list[] = { static const Kludges fts_list[] = {
{ "AREA" , FTS_AREA , KCRQ_CASE }, { "AREA" , FTS_AREA , KCRQ_CASE },
{ "INTL" , FTS_INTL , KCRQ_CASE }, { "INTL" , FTS_INTL , KCRQ_CASE },
@ -229,7 +229,7 @@ static Kludges fts_list[] = {
// ------------------------------------------------------------------ // ------------------------------------------------------------------
static Kludges fsc_list[] = { static const Kludges fsc_list[] = {
{ "CHARSET" , FSC_CHARSET , KCRQ_CASE }, { "CHARSET" , FSC_CHARSET , KCRQ_CASE },
{ "CHRC" , FSC_CHRC , KCRQ_CASE }, { "CHRC" , FSC_CHRC , KCRQ_CASE },
@ -261,7 +261,7 @@ static Kludges fsc_list[] = {
// ------------------------------------------------------------------ // ------------------------------------------------------------------
static Kludges xxx_list[] = { static const Kludges xxx_list[] = {
{ "ACUPDATE" , XXX_ACUPDATE , KCRQ_CASE }, { "ACUPDATE" , XXX_ACUPDATE , KCRQ_CASE },
{ "CODEPAGE" , XXX_CODEPAGE , KCRQ_CASE }, { "CODEPAGE" , XXX_CODEPAGE , KCRQ_CASE },
@ -299,7 +299,7 @@ static Kludges xxx_list[] = {
// ------------------------------------------------------------------ // ------------------------------------------------------------------
static Kludges rfc_list[] = { static const Kludges rfc_list[] = {
{ "Also-Control" , RFC_ALSO_CONTROL , KCRQ_COLON }, { "Also-Control" , RFC_ALSO_CONTROL , KCRQ_COLON },
{ "Apparently-To" , RFC_APPARENTLY_TO , KCRQ_COLON }, { "Apparently-To" , RFC_APPARENTLY_TO , KCRQ_COLON },
@ -1293,7 +1293,7 @@ int HandleRFCs(GMsg* msg, Line* line, int kludgenum, const char* ptr, int getval
// ------------------------------------------------------------------ // ------------------------------------------------------------------
int ScanCtrlList(Kludges* k, char* kludge, char endchar) { int ScanCtrlList(const Kludges *k, const char *kludge, char endchar) {
while(*k->key) { while(*k->key) {
if((k->req & KCRQ_CASE) ? streql(kludge, k->key) : strieql(kludge, k->key)) { if((k->req & KCRQ_CASE) ? streql(kludge, k->key) : strieql(kludge, k->key)) {
@ -1339,29 +1339,24 @@ int ScanLine(GMsg* msg, Line* line, const char* ptr, int getvalue, int mask) {
// Search for it in the known kludges list // Search for it in the known kludges list
if(*kludge) { if(*kludge) {
Kludges* k;
while(1) { while(1) {
if(mask & MASK_FTS) { if(mask & MASK_FTS) {
k = fts_list; kludgenum = ScanCtrlList(fts_list, kludge, endchar);
kludgenum = ScanCtrlList(k, kludge, endchar);
if(kludgenum) if(kludgenum)
break; break;
} }
if(mask & MASK_FSC) { if(mask & MASK_FSC) {
k = fsc_list; kludgenum = ScanCtrlList(fsc_list, kludge, endchar);
kludgenum = ScanCtrlList(k, kludge, endchar);
if(kludgenum) if(kludgenum)
break; break;
} }
if(mask & MASK_RFC) { if(mask & MASK_RFC) {
k = rfc_list; kludgenum = ScanCtrlList(rfc_list, kludge, endchar);
kludgenum = ScanCtrlList(k, kludge, endchar);
if(kludgenum) if(kludgenum)
break; break;
} }
if(mask & MASK_XXX) { if(mask & MASK_XXX) {
k = xxx_list; kludgenum = ScanCtrlList(xxx_list, kludge, endchar);
kludgenum = ScanCtrlList(k, kludge, endchar);
if(kludgenum) if(kludgenum)
break; break;
} }
@ -2131,9 +2126,8 @@ void MakeLineIndex(GMsg* msg, int margin, bool header_recode) {
switch(*ptr) { switch(*ptr) {
case CR: case CR:
do_cr: do_cr:
ptr++;
ch = CR; ch = CR;
ptr = spanfeeds(ptr); ptr = spanfeeds(ptr+1);
if(wraps and not ((line->type & GLINE_HARD) and not (line->type & GLINE_QUOT))) { if(wraps and not ((line->type & GLINE_HARD) and not (line->type & GLINE_QUOT))) {
if(para != GLINE_QUOT) { if(para != GLINE_QUOT) {
if(quoteflag) { if(quoteflag) {
@ -2333,9 +2327,7 @@ void MakeLineIndex(GMsg* msg, int margin, bool header_recode) {
} }
else if((ptr[1] == CR) or (ptr[1] == LF)) { else if((ptr[1] == CR) or (ptr[1] == LF)) {
// Skip soft line break // Skip soft line break
ptr++; ptr = spanfeeds(ptr+2);
while((*ptr == CR) or (*ptr == LF))
ptr++;
break; break;
} }
} }

View File

@ -165,6 +165,7 @@ void Area::InitData() {
adat->taglinesupport = CFG->taglinesupport; adat->taglinesupport = CFG->taglinesupport;
strcpy(adat->tearline, CFG->tearline); strcpy(adat->tearline, CFG->tearline);
strcpy(adat->tpl, (CFG->tplno and (CFG->tplno < CFG->tpl.size())) ? CFG->tpl[CFG->tplno].file : ""); strcpy(adat->tpl, (CFG->tplno and (CFG->tplno < CFG->tpl.size())) ? CFG->tpl[CFG->tplno].file : "");
strxcpy(adat->wtpl, CFG->wtpl.c_str(), sizeof(adat->wtpl));
adat->templatematch = CFG->templatematch; adat->templatematch = CFG->templatematch;
adat->twitmode = CFG->twitmode; adat->twitmode = CFG->twitmode;
adat->usefwd = CFG->usefwd; adat->usefwd = CFG->usefwd;

View File

@ -126,7 +126,7 @@ int TemplateToText(int mode, GMsg* msg, GMsg* oldmsg, const char* tpl, int origa
int length; int length;
}; };
tpl_token token_list[] = { static const tpl_token token_list[] = {
{ CSTR_COMMA_SIZEOF_CSTR("forward") }, { CSTR_COMMA_SIZEOF_CSTR("forward") },
{ CSTR_COMMA_SIZEOF_CSTR("changed") }, { CSTR_COMMA_SIZEOF_CSTR("changed") },
{ CSTR_COMMA_SIZEOF_CSTR("net") }, { CSTR_COMMA_SIZEOF_CSTR("net") },