mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
Improved synctex support
- Add check for converter with active synctex support to check for synchronized output for activate forward search.
This commit is contained in:
parent
bd0510b08f
commit
f426470a54
@ -1110,6 +1110,22 @@ bool Buffer::readDocument(Lexer & lex)
|
||||
}
|
||||
|
||||
|
||||
bool Buffer::isSyncTeXenabled() const
|
||||
{
|
||||
bool enabled = params().output_sync;
|
||||
|
||||
if (!enabled)
|
||||
for (auto const & c : theConverters()) {
|
||||
const string dest = c.to().substr(0,3);
|
||||
if (dest == "dvi" || dest == "pdf") {
|
||||
const string cmd = c.command();
|
||||
enabled |= cmd.find("--synctex=1") != string::npos;
|
||||
if (enabled) break;
|
||||
}
|
||||
}
|
||||
return enabled;
|
||||
}
|
||||
|
||||
bool Buffer::importString(string const & format, docstring const & contents, ErrorList & errorList)
|
||||
{
|
||||
Format const * fmt = theFormats().getFormat(format);
|
||||
|
@ -221,6 +221,11 @@ public:
|
||||
int readHeader(Lexer & lex);
|
||||
|
||||
double fontScalingFactor() const;
|
||||
/// check for active synctex support:
|
||||
/// - either the document has synchronize output enabled or
|
||||
/// - there is a converter to dvi or pdf defined with synctex command line argument
|
||||
/// this is the "expert mode", false positives are possible
|
||||
bool isSyncTeXenabled() const;
|
||||
|
||||
private:
|
||||
///
|
||||
|
@ -2681,7 +2681,7 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
|
||||
break;
|
||||
case LFUN_FORWARD_SEARCH:
|
||||
enable = !(lyxrc.forward_search_dvi.empty() && lyxrc.forward_search_pdf.empty()) &&
|
||||
doc_buffer && doc_buffer->params().output_sync;
|
||||
doc_buffer && doc_buffer->isSyncTeXenabled();
|
||||
break;
|
||||
|
||||
case LFUN_FILE_INSERT_PLAINTEXT:
|
||||
|
Loading…
Reference in New Issue
Block a user