mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-07 02:28:35 +00:00
Fix #4658: showing diff between original and emergency files.
https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg215796.html
This commit is contained in:
parent
472953dbe1
commit
9d1031771e
@ -4694,7 +4694,7 @@ Buffer::ReadStatus Buffer::loadEmergency()
|
||||
"%1$s exists.\n\nRecover emergency save?"), file);
|
||||
|
||||
int const load_emerg = Alert::prompt(_("Load emergency save?"), text,
|
||||
0, 2, _("&Recover"), _("&Load Original"), _("&Cancel"));
|
||||
0, 3, _("&Recover"), _("&Load Original"), _("&Only show difference"), _("&Cancel"));
|
||||
|
||||
switch (load_emerg)
|
||||
{
|
||||
@ -4769,6 +4769,21 @@ Buffer::ReadStatus Buffer::loadEmergency()
|
||||
return ReadOriginal;
|
||||
}
|
||||
|
||||
case 2: {
|
||||
string f1 = d->filename.absFileName();
|
||||
string f2 = emergencyFile.absFileName();
|
||||
if (loadThisLyXFile(d->filename) != ReadSuccess)
|
||||
return ReadCancel;
|
||||
string par = "compare run-blocking " + quoteName(f1) + " " + quoteName(f2);
|
||||
LYXERR(Debug::FILES, par << "\n");
|
||||
lyx::dispatch(FuncRequest(LFUN_DIALOG_SHOW, par));
|
||||
|
||||
//release the emergency buffer loaded by compare
|
||||
Buffer * emerBuffer = theBufferList().getBuffer(emergencyFile);
|
||||
if (emerBuffer) theBufferList().release(emerBuffer);
|
||||
|
||||
return ReadCancel; //Release the buffer of Original immediatelly
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -318,7 +318,13 @@ int GuiCompare::run(bool blocking_mode)
|
||||
return 0;
|
||||
|
||||
dest_buffer_->changed(true);
|
||||
dest_buffer_->markDirty();
|
||||
if (blocking_mode)
|
||||
//blocking mode is infinitive and we don't want diff autosave
|
||||
//if user decides to kill ther running lyx instance
|
||||
dest_buffer_->markClean();
|
||||
else
|
||||
dest_buffer_->markDirty();
|
||||
|
||||
|
||||
// get the options from the dialog
|
||||
CompareOptions options;
|
||||
@ -364,10 +370,14 @@ bool GuiCompare::initialiseParams(std::string const &par)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Wait for the Compare function to process in a thread (2 minute timeout)
|
||||
compare_->wait(120000);
|
||||
// Wait for the Compare function to process in a thread
|
||||
compare_->wait();
|
||||
|
||||
finished(false);
|
||||
//Hiding dialog does not work as intended through finished routine, because showView
|
||||
//is triggered after initialiseParams returns true. So we return false, warning will
|
||||
//show on the terminal though.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user