Fixed thread lock if ESC is pressed in thread list

This commit is contained in:
Ianos Gnatiuc 2006-12-21 17:14:49 +00:00
parent 128b0d25c7
commit b21f75839b
4 changed files with 81 additions and 69 deletions

View File

@ -10,6 +10,7 @@ _____________________________________________________________________________
‡ ¬¥âª¨ ¤«ï GoldED+ 1.1.5, /snapshot/ ‡ ¬¥âª¨ ¤«ï GoldED+ 1.1.5, /snapshot/
_____________________________________________________________________________ _____________________________________________________________________________
- ˆá¯à ¢«¥­® § ¥¤ ­¨¥ ¢ ¤¥à¥¢¥ ®â¢¥â®¢, ¥á«¨ ­ ¦ âì ESC ¢ â।¥.
- uudecoder: ⥯¥àì ¡ã¤¥â ¯à®¨£­®à¨à®¢ ­® ¢á¥ ¯®á«¥ áâப ¯® ¬ áª¥ - uudecoder: ⥯¥àì ¡ã¤¥â ¯à®¨£­®à¨à®¢ ­® ¢á¥ ¯®á«¥ áâப ¯® ¬ áª¥
"sum -r/size [0-9]+/[0-9]+ section.*" ¨«¨ "section [0-9]+ end.*" "sum -r/size [0-9]+/[0-9]+ section.*" ¨«¨ "section [0-9]+ end.*"
! §­ ç¥­¨¥ ¯® 㬮«ç ­¨î ¤«ï UseTZUTC ¨§¬¥­¥­® ­  "yes". ! §­ ç¥­¨¥ ¯® 㬮«ç ­¨î ¤«ï UseTZUTC ¨§¬¥­¥­® ­  "yes".

View File

@ -10,6 +10,8 @@ ______________________________________________________________________
Notes for GoldED+ 1.1.5, /snapshot/ Notes for GoldED+ 1.1.5, /snapshot/
______________________________________________________________________ ______________________________________________________________________
- Fixed thread lock if ESC is pressed in thread list.
- uudecoder: now are skipped all lines which follows lines with mask - uudecoder: now are skipped all lines which follows lines with mask
"sum -r/size [0-9]+/[0-9]+ section.*" or "section [0-9]+ end.*" "sum -r/size [0-9]+/[0-9]+ section.*" or "section [0-9]+ end.*"

View File

@ -747,7 +747,7 @@ void GThreadlist::do_delayed() {
if ((CFG->disphdrlocation & 0xFFFF) == YES) if ((CFG->disphdrlocation & 0xFFFF) == YES)
CFG->disphdrlocation = NO; CFG->disphdrlocation = NO;
AA->LoadMsg(&msg, list[index].msgno, CFG->dispmargin-(int)CFG->switches.get(disppagebar)); AA->LoadMsg(&msg, treeEntryList[index].msgno, CFG->dispmargin-(int)CFG->switches.get(disppagebar));
for(std::vector<Node>::iterator x = CFG->username.begin(); x != CFG->username.end(); x++) { for(std::vector<Node>::iterator x = CFG->username.begin(); x != CFG->username.end(); x++) {
if(strieql(msg.By(), x->name)) { if(strieql(msg.By(), x->name)) {
msg.attr.fmu1(); msg.attr.fmu1();
@ -769,13 +769,15 @@ void GThreadlist::do_delayed() {
if(CFG->switches.get(msglistviewsubj)) { if(CFG->switches.get(msglistviewsubj)) {
// Reload message if not sure that just reread // Reload message if not sure that just reread
if(not AA->Msglistheader()) { if(not AA->Msglistheader())
t = list[index]; {
if(AA->Msglistfast()) { if (AA->Msglistfast())
AA->LoadHdr(&msg, t.msgno); {
AA->LoadHdr(&msg, treeEntryList[index].msgno);
} }
else { else
AA->LoadMsg(&msg, t.msgno, CFG->dispmargin-(int)CFG->switches.get(disppagebar)); {
AA->LoadMsg(&msg, treeEntryList[index].msgno, CFG->dispmargin - (int)CFG->switches.get(disppagebar));
} }
} }
wtitle(msg.re, TCENTER|TBOTTOM, tattr); wtitle(msg.re, TCENTER|TBOTTOM, tattr);
@ -801,13 +803,9 @@ void GThreadlist::close() {
void GThreadlist::GenTree(int idx) void GThreadlist::GenTree(int idx)
{ {
if (tree.size() > idx) ThreadEntry &t = treeEntryList[idx];
{ if (t.entrytext.size())
if (tree[idx].size())
return; return;
}
else
tree.resize(idx+1);
#ifdef KOI8 #ifdef KOI8
static char graph[4]="†„<EFBFBD>"; static char graph[4]="†„<EFBFBD>";
@ -831,26 +829,23 @@ void GThreadlist::GenTree(int idx)
} }
#endif #endif
ThreadEntry te = list[idx]; if (t.level == 0)
if (te.level == 0)
{ {
tree[idx] = " "; t.entrytext = " ";
return; return;
} }
tree[idx].resize((te.level-1)*2+4, ' '); t.entrytext.resize((t.level - 1)*2 + 3, ' ');
t.entrytext[(t.level - 1)*2 + 1] = (t.replynext) ? graph[0] : graph[1];
tree[idx][(te.level-1)*2+1] = (te.replynext) ? graph[0] : graph[1];
tree[idx][(te.level-1)*2+3] = 0;
ThreadEntry te = t;
while (te.replyto) while (te.replyto)
{ {
te = list[te.replytoindex]; te = treeEntryList[te.replytoindex];
if (te.level != 0) if (te.level != 0)
{ {
if (te.replynext) if (te.replynext)
tree[idx][(te.level-1)*2+1] = graph[2]; t.entrytext[(te.level - 1)*2 + 1] = graph[2];
} }
} }
} }
@ -861,8 +856,7 @@ void GThreadlist::GenTree(int idx)
void GThreadlist::print_line(uint idx, uint pos, bool isbar) void GThreadlist::print_line(uint idx, uint pos, bool isbar)
{ {
char buf[256]; char buf[256];
ThreadEntry &t = treeEntryList[idx];
t = list[idx];
size_t tdlen = xlen - ((AA->Msglistdate() == MSGLISTDATE_NONE) ? 8 : 18); size_t tdlen = xlen - ((AA->Msglistdate() == MSGLISTDATE_NONE) ? 8 : 18);
if(AA->Msglistfast()) { if(AA->Msglistfast()) {
@ -927,7 +921,7 @@ void GThreadlist::print_line(uint idx, uint pos, bool isbar)
GenTree(idx); GenTree(idx);
const char* buf2 = tree[idx].c_str(); const char* buf2 = treeEntryList[idx].entrytext.c_str();
size_t buf2len = strlen(buf2); size_t buf2len = strlen(buf2);
if (buf2len > h_offset) if (buf2len > h_offset)
@ -996,6 +990,7 @@ void GThreadlist::recursive_build(uint32_t msgn, uint32_t rn, uint32_t level, ui
if (AA->Msgn.ToReln(msgn) and AA->LoadHdr(&msg, msgn)) if (AA->Msgn.ToReln(msgn) and AA->LoadHdr(&msg, msgn))
{ {
ThreadEntry t;
t.msgno = msgn; t.msgno = msgn;
t.replyto = msg.link.to(); t.replyto = msg.link.to();
t.reply1st = msg.link.first(); t.reply1st = msg.link.first();
@ -1007,8 +1002,8 @@ void GThreadlist::recursive_build(uint32_t msgn, uint32_t rn, uint32_t level, ui
if (!AA->Msgn.ToReln(t.reply1st)) t.reply1st = 0; if (!AA->Msgn.ToReln(t.reply1st)) t.reply1st = 0;
if (!AA->Msgn.ToReln(t.replynext)) t.replynext = 0; if (!AA->Msgn.ToReln(t.replynext)) t.replynext = 0;
list.push_back(t); treeEntryList.push_back(t);
index = list.size() - 1; index = treeEntryList.size() - 1;
recursive_build(msg.link.first(), msg.link.list(0), level, index); recursive_build(msg.link.first(), msg.link.list(0), level, index);
@ -1056,22 +1051,21 @@ void GThreadlist::BuildThreadIndex(dword msgn)
m_OldEchoId = AA->echoid(); m_OldEchoId = AA->echoid();
index = maximum_index = position = maximum_position = 0; index = maximum_index = position = maximum_position = 0;
list.clear(); treeEntryList.clear();
tree.clear();
recursive_build(msg.msgno, 0, 0, 0); recursive_build(msg.msgno, 0, 0, 0);
minimum_index = 0; minimum_index = 0;
maximum_index = list.size() - 1; maximum_index = treeEntryList.size() - 1;
maximum_position = MinV((uint) list.size() - 1, (uint) ylen - 1); maximum_position = MinV((uint)treeEntryList.size() - 1, (uint) ylen - 1);
index = 0; index = 0;
h_offset = 0; h_offset = 0;
new_hoffset = 0; new_hoffset = 0;
} }
for (uint i = 0; i < list.size(); i++) for (uint i = 0; i < treeEntryList.size(); i++)
{ {
if (list[i].msgno == msgn) if (treeEntryList[i].msgno == msgn)
{ {
index = i; index = i;
break; break;
@ -1094,8 +1088,10 @@ bool GThreadlist::NextThread(bool next) {
dword msgn = AA->Msgn[m]; dword msgn = AA->Msgn[m];
bool found = false; bool found = false;
for(uint i = 0; i<list.size(); i++) { for (uint i = 0; i < treeEntryList.size(); i++)
if(list[i].msgno == msgn) { {
if (treeEntryList[i].msgno == msgn)
{
found = true; found = true;
break; break;
} }
@ -1139,7 +1135,7 @@ bool GThreadlist::handle_key() {
case KK_ListGotoPrev: case KK_ListGotoPrev:
case KK_ListGotoNext: case KK_ListGotoNext:
NextThread((key == KK_ListGotoNext)); NextThread((key == KK_ListGotoNext));
if (!CFG->replylinkshowalways && (list.size() <= 1)) if (!CFG->replylinkshowalways && (treeEntryList.size() <= 1))
return false; return false;
center(CFG->displistcursor); center(CFG->displistcursor);
break; break;
@ -1176,12 +1172,14 @@ bool GThreadlist::handle_key() {
case KK_ListToggleMark: case KK_ListToggleMark:
{ {
uint32_t temp = AA->Mark.Find(list[index].msgno); uint32_t temp = AA->Mark.Find(treeEntryList[index].msgno);
if(temp) { if (temp)
{
AA->Mark.DelReln(temp); AA->Mark.DelReln(temp);
} }
else { else
AA->Mark.Add(list[index].msgno); {
AA->Mark.Add(treeEntryList[index].msgno);
} }
if(index < maximum_index) if(index < maximum_index)
@ -1192,14 +1190,14 @@ bool GThreadlist::handle_key() {
} }
case KK_ListToggleBookMark: case KK_ListToggleBookMark:
if (AA->bookmark == list[index].msgno) if (AA->bookmark == treeEntryList[index].msgno)
{ {
AA->bookmark = 0; AA->bookmark = 0;
display_bar(); display_bar();
} }
else else
{ {
AA->bookmark = list[index].msgno; AA->bookmark = treeEntryList[index].msgno;
update(); update();
} }
break; break;
@ -1240,8 +1238,9 @@ bool GThreadlist::handle_key() {
// ------------------------------------------------------------------ // ------------------------------------------------------------------
void GThreadlist::Run() { void GThreadlist::Run()
{
aborted = false;
ypos = AA->Msglistheader() ? 6 : 1; // Window Starting Row ypos = AA->Msglistheader() ? 6 : 1; // Window Starting Row
xpos = 0; // Window Starting Column xpos = 0; // Window Starting Column
ylen = MAXROW-3-ypos; // Window Height ylen = MAXROW-3-ypos; // Window Height
@ -1259,18 +1258,21 @@ void GThreadlist::Run() {
BuildThreadIndex(reader_msg->msgno); BuildThreadIndex(reader_msg->msgno);
size_t size = list.size(); size_t size = treeEntryList.size();
if ((CFG->replylinkshowalways && (size > 0)) || (size > 1)) if ((CFG->replylinkshowalways && (size > 0)) || (size > 1))
{
run_picker(); run_picker();
else { }
else
{
w_info(LNG->NoThreadlist); w_info(LNG->NoThreadlist);
waitkeyt(5000); waitkeyt(5000);
w_info(NULL); w_info(NULL);
aborted = true; aborted = true;
} }
if(not aborted) if (!aborted)
AA->set_lastread(AA->Msgn.ToReln(list[index].msgno)); AA->set_lastread(AA->Msgn.ToReln(treeEntryList[index].msgno));
ResetMsg(&msg); ResetMsg(&msg);
} }
@ -1284,7 +1286,7 @@ bool GThreadlist::GoNextUnread(bool reader)
BuildThreadIndex(reader_msg->msgno); BuildThreadIndex(reader_msg->msgno);
bool found = false; bool found = false;
size_t size = list.size(); size_t size = treeEntryList.size();
if (size > 1) if (size > 1)
{ {
@ -1292,7 +1294,7 @@ bool GThreadlist::GoNextUnread(bool reader)
for (idx = index + 1; idx < size; idx++) for (idx = index + 1; idx < size; idx++)
{ {
t = list[idx]; ThreadEntry &t = treeEntryList[idx];
AA->LoadHdr(&msg, t.msgno); AA->LoadHdr(&msg, t.msgno);
if (msg.timesread == 0) if (msg.timesread == 0)
{ {
@ -1305,7 +1307,7 @@ bool GThreadlist::GoNextUnread(bool reader)
{ {
for (idx = 0; idx < index; idx++) for (idx = 0; idx < index; idx++)
{ {
t = list[idx]; ThreadEntry &t = treeEntryList[idx];
AA->LoadHdr(&msg, t.msgno); AA->LoadHdr(&msg, t.msgno);
if (msg.timesread == 0) if (msg.timesread == 0)
{ {
@ -1320,7 +1322,9 @@ bool GThreadlist::GoNextUnread(bool reader)
index = idx; index = idx;
if (reader) if (reader)
AA->set_lastread(AA->Msgn.ToReln(list[idx].msgno)); {
AA->set_lastread(AA->Msgn.ToReln(treeEntryList[idx].msgno));
}
} }
} }

View File

@ -231,8 +231,8 @@ void MsgThreadlist();
// ------------------------------------------------------------------ // ------------------------------------------------------------------
class ThreadEntry { class ThreadEntry
{
public: public:
uint32_t msgno; uint32_t msgno;
uint32_t replyto; uint32_t replyto;
@ -240,20 +240,18 @@ public:
uint32_t replynext; uint32_t replynext;
uint32_t replytoindex; uint32_t replytoindex;
uint32_t level; uint32_t level;
std::string entrytext;
}; };
// ------------------------------------------------------------------ // ------------------------------------------------------------------
class GThreadlist : public gwinpick { class GThreadlist : public gwinpick
{
private: private:
gwindow window; gwindow window;
GMsg msg; GMsg msg;
ThreadEntry t;
std::vector<ThreadEntry> list; std::vector<ThreadEntry> treeEntryList;
std::vector<std::string> tree;
dword m_OldMsgno; dword m_OldMsgno;
uint m_OldTags; uint m_OldTags;
@ -266,7 +264,6 @@ private:
bool NextThread(bool next); bool NextThread(bool next);
public: public:
void open(); // Called after window is opened void open(); // Called after window is opened
void close(); // Called after window is closed void close(); // Called after window is closed
void print_line(uint idx, uint pos, bool isbar); void print_line(uint idx, uint pos, bool isbar);
@ -276,8 +273,16 @@ public:
void Run(); void Run();
bool GoNextUnread(bool reader); bool GoNextUnread(bool reader);
GThreadlist() { memset(&msg, 0, sizeof(GMsg)); replylinkfloat = CFG->replylinkfloat; }; GThreadlist()
~GThreadlist() { ResetMsg(&msg); }; {
m_OldMsgno = dword(-1);
m_OldTags = uint(-1);
memset(&msg, 0, sizeof(GMsg));
replylinkfloat = CFG->replylinkfloat;
}
~GThreadlist() { ResetMsg(&msg); }
}; };
@ -352,7 +357,7 @@ void NextArea();
void PrevArea(); void PrevArea();
void Reader(); void Reader();
void UpdateArea(GMsg* msg); void UpdateArea(GMsg* msg);
int ExternUtil(GMsg* __msg, int __utilno); int ExternUtil(GMsg* msg, uint32_t utilno);
void ExternUtilMenu(GMsg* msg); void ExternUtilMenu(GMsg* msg);
void ReadPeekURLs(GMsg* msg); void ReadPeekURLs(GMsg* msg);
uint next_msg(int direction); uint next_msg(int direction);