Externutils with empty message fix
This commit is contained in:
parent
d2a2e75859
commit
88e14b43b7
@ -67,8 +67,17 @@ void SaveLines(int mode, const char* savefile, GMsg* msg, int margin, bool clip)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if(mode == MODE_WRITE)
|
if(mode == MODE_WRITE) {
|
||||||
AA->LoadMsg(msg, msg->msgno, margin); // reload message
|
if(AA->LoadMsg(msg, msg->msgno, margin) == false) {
|
||||||
|
msg->txt = throw_strdup("");
|
||||||
|
msg->attr.tou0();
|
||||||
|
msg->TextToLines(margin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if((mode == MODE_SAVE) or (mode == MODE_SAVENOCTRL)) {
|
||||||
|
msg->attr.tou0();
|
||||||
|
msg->TextToLines(margin);
|
||||||
|
}
|
||||||
TemplateToText(((mode == MODE_WRITE) and prnheader) ? ((prnheader & WRITE_ONLY_HEADER) ? MODE_HEADER : MODE_WRITEHEADER) : MODE_WRITE, msg, msg, AA->WTpl(), CurrArea);
|
TemplateToText(((mode == MODE_WRITE) and prnheader) ? ((prnheader & WRITE_ONLY_HEADER) ? MODE_HEADER : MODE_WRITEHEADER) : MODE_WRITE, msg, msg, AA->WTpl(), CurrArea);
|
||||||
msg->attr.tou1();
|
msg->attr.tou1();
|
||||||
msg->TextToLines(margin);
|
msg->TextToLines(margin);
|
||||||
|
@ -525,7 +525,6 @@ int ExternUtil(GMsg* msg, int utilno) {
|
|||||||
|
|
||||||
Path editorfile, tmpfile;
|
Path editorfile, tmpfile;
|
||||||
strcpy(editorfile, AddPath(CFG->goldpath, EDIT->File()));
|
strcpy(editorfile, AddPath(CFG->goldpath, EDIT->File()));
|
||||||
mktemp(strcpy(tmpfile, AddPath(CFG->goldpath, "GDXXXXXX")));
|
|
||||||
|
|
||||||
std::vector<ExtUtil>::iterator extutil = CFG->externutil.begin();
|
std::vector<ExtUtil>::iterator extutil = CFG->externutil.begin();
|
||||||
|
|
||||||
@ -538,18 +537,21 @@ int ExternUtil(GMsg* msg, int utilno) {
|
|||||||
|
|
||||||
int mode = (extutil->options & EXTUTIL_KEEPCTRL) ? MODE_SAVE : MODE_SAVENOCTRL;
|
int mode = (extutil->options & EXTUTIL_KEEPCTRL) ? MODE_SAVE : MODE_SAVENOCTRL;
|
||||||
SaveLines(mode, editorfile, msg, 79);
|
SaveLines(mode, editorfile, msg, 79);
|
||||||
if(striinc("@tmpfile", cmdline))
|
|
||||||
SaveLines(mode, tmpfile, msg, 79);
|
|
||||||
|
|
||||||
strcpy(buf, CFG->goldpath);
|
|
||||||
strchg(buf, GOLD_WRONG_SLASH_CHR, GOLD_SLASH_CHR);
|
|
||||||
strischg(cmdline, "@path", buf);
|
|
||||||
strcpy(buf, editorfile);
|
strcpy(buf, editorfile);
|
||||||
strchg(buf, GOLD_WRONG_SLASH_CHR, GOLD_SLASH_CHR);
|
strchg(buf, GOLD_WRONG_SLASH_CHR, GOLD_SLASH_CHR);
|
||||||
strischg(cmdline, "@file", buf);
|
strischg(cmdline, "@file", buf);
|
||||||
|
if(striinc("@tmpfile", cmdline)) {
|
||||||
|
mktemp(strcpy(tmpfile, AddPath(CFG->goldpath, "GDXXXXXX")));
|
||||||
|
SaveLines(mode, tmpfile, msg, 79);
|
||||||
strcpy(buf, tmpfile);
|
strcpy(buf, tmpfile);
|
||||||
strchg(buf, GOLD_WRONG_SLASH_CHR, GOLD_SLASH_CHR);
|
strchg(buf, GOLD_WRONG_SLASH_CHR, GOLD_SLASH_CHR);
|
||||||
strischg(cmdline, "@tmpfile", buf);
|
strischg(cmdline, "@tmpfile", buf);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
tmpfile[0] = NUL;
|
||||||
|
strcpy(buf, CFG->goldpath);
|
||||||
|
strchg(buf, GOLD_WRONG_SLASH_CHR, GOLD_SLASH_CHR);
|
||||||
|
strischg(cmdline, "@path", buf);
|
||||||
TokenXlat(MODE_NEW, cmdline, msg, msg, CurrArea);
|
TokenXlat(MODE_NEW, cmdline, msg, msg, CurrArea);
|
||||||
|
|
||||||
int pauseval = 0;
|
int pauseval = 0;
|
||||||
@ -585,6 +587,7 @@ int ExternUtil(GMsg* msg, int utilno) {
|
|||||||
LoadText(msg, editorfile);
|
LoadText(msg, editorfile);
|
||||||
if(extutil->options & EXTUTIL_WIPE)
|
if(extutil->options & EXTUTIL_WIPE)
|
||||||
WipeFile(editorfile, 0);
|
WipeFile(editorfile, 0);
|
||||||
|
if(tmpfile[0] != NUL)
|
||||||
WipeFile(tmpfile, 0);
|
WipeFile(tmpfile, 0);
|
||||||
|
|
||||||
EDIT->HardLines(hardlines);
|
EDIT->HardLines(hardlines);
|
||||||
|
Reference in New Issue
Block a user