mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
* BufferList::last(): new method returning last loaded Buffer if any.
* LyX::exec(): fix batch export in non GUI mode. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16066 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
4bf43a35ac
commit
0ca269ef39
@ -235,6 +235,14 @@ Buffer * BufferList::first()
|
||||
}
|
||||
|
||||
|
||||
Buffer * BufferList::last()
|
||||
{
|
||||
if (bstore.empty())
|
||||
return 0;
|
||||
return bstore.back();
|
||||
}
|
||||
|
||||
|
||||
Buffer * BufferList::getBuffer(unsigned int const choice)
|
||||
{
|
||||
if (choice >= bstore.size())
|
||||
|
@ -61,6 +61,9 @@ public:
|
||||
/// return head of buffer list if any
|
||||
Buffer * first();
|
||||
|
||||
/// return back of buffer list if any
|
||||
Buffer * last();
|
||||
|
||||
/// returns true if the buffer exists already
|
||||
bool exists(std::string const &) const;
|
||||
|
||||
|
@ -332,10 +332,21 @@ int LyX::exec(int & argc, char * argv[])
|
||||
if (!use_gui) {
|
||||
// FIXME: create a ConsoleApplication
|
||||
int exit_status = loadFiles(argc, argv, files);
|
||||
if (exit_status)
|
||||
if (exit_status) {
|
||||
prepareExit();
|
||||
return exit_status;
|
||||
execBatchCommands();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Buffer * last_loaded = pimpl_->buffer_list_.last();
|
||||
if (batch_command.empty() || !last_loaded) {
|
||||
prepareExit();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
// try to dispatch to last loaded buffer first
|
||||
bool success = false;
|
||||
last_loaded->dispatch(batch_command, &success);
|
||||
prepareExit();
|
||||
return !success;
|
||||
}
|
||||
|
||||
// Force adding of font path _before_ Application is initialized
|
||||
|
Loading…
Reference in New Issue
Block a user