The problem with the previous attempt was that, every time through
updateBuffer, we looked up the file location using kpsewhich, which
took too long on Windows. The new solution is to cache that info, and
to look it up only when we need it.
Previously, this info would have been re-read whenever we parsed the
bibfiles. So we re-read it now whenever the bibinfo cache is invalid,
which is less often, but should be good enough. We can add more such
re-reads if need be.
As of LaTeX2e 2018, characters are made active earlier, which results
in new expansion problems.
Following a suggestion of Markus Kohm (pc) and the TL mailing list [1],
we embrace non-ASCII input paths in \detokenize. This relies on e-tex,
but I think we can assume this is nowadays available everywhere.
[1] http://tug.org/pipermail/tex-live/2018-May/041691.htmlFixes: #11146
It is now possible in the float settings (doc dialog) to specify a global
(inner) alignment for floats, and in the float settings, this can be
overridden (just as with float placement)
Fixes: #8665
File format change.
Currently if we have a 2.3 file and we open it with a more recent version
we get:
original file: file.lyx
backup file: file-lyxformat-544.lyx~
After this commit the backup file becomes
file-lyx23.lyx~
If the file is from a development version then we get the same result as before.
The problem was that, if we killed export when some graphic was
being converted, or some external template was being handled, it
would only cancel that process, and then it would just continue.
To deal with that, we need to do a few things:
1. Modify the return values for some of the Converters routines,
and similarly the routines for external templates, so we can
tell when something has been canceled.
2. Throw an exception from InsetGraphics or InsetExternal when this
has happened during export, but ONLY when the Buffer is a clone.
We shouldn't be able to 'cancel' export when we're, say, generating
code for the preview pane, but this keeps us on the safe side..
The exception then has to be caught, obviously, back in the export
routines in Buffer.
Probably Coverity will be unhappy about something here, but I'll
deal with that problem as it arises.
This is mandatory for some features (such as bookmarks,pdfusetitle)
to work, and only a handful of drivers can be auto-detected by hyperref.
Fixes: #6418
Since CheckTeX itself processes the tex file, a synchronous run with
a TeX process can lead to all sorts of conflicts, including crashes.
Fixes: #7434.
This is needed for cases where the temp file has to be manually removed
at some point (e.g., if temp files are used as conversion target, and
the initial file only serves as a placeholder), since QTemporaryFile
objects cannot be manually removed at least on Windows (they are always
kept open internally even after close()). See
http://lists.qt-project.org/pipermail/interest/2013-August/008352.html
In order to avoid race conditions due to duplicate names (the issue why
the old method was removed), we record all used temp file names.
Fixes: #9139
Now the helper class contains logic that checks whether buffer are
known before closing them. This avoids potential crashes.
Use it in different places to siplify code. It is not clear at this
point whether it should be used everywhere.
Followup to bug #10847.
Along the lines suggested by JMarc, we now collect the list of bibfiles
in use in the updateBuffer routines. This actually does simplify the code
quite a bit. See the discussion there for reasons to go this way.
No intended change of behavior. The ones that use DocIterators and
ParIterators cannot yet be changed, but they could be if we provided
the right sorts of methods, perhaps.
Basically, everything that does not depend on a BufferView should move
there. Some methods that do not seem to need a BufferView, like
selHandle or IdxFirst or push actually depend on it and could not be
moved.
This allows to simplify a few uses of recordUndo helpers.
- Move some methods to DocIterator: nextMath, prevMath, getPossibleLabel,
getEncoding;
- Move some methods to CursorData: setCursor, setCursorSelectionTo,
(setCursorTo|normal|reset)Anchor, (set|clear)Selection,
sel(|ection)(Begin|End), selectionAsString, info, currentState,
(mark|clear|check)NewWordPosition, fixIfBroken, sanitize, all undo
related methods, reset, isInside, leaveInset, current mode;
- kill some unused methods: macromode, replaceWord, setScreenPos, touch,
markInsert, markErase;
- Move code around to group things, and add a few comments (a lot remains to be done).
This changes lead to some related changes in other classes: removal,
change of parameter.
No intended change.
Scanning is rather slow, so this improves performance in specific
situations (multiple inclusion of larger files in master/child or
chapterbib context)
In some cases, it is possible that the BufferPositionMap has
dangling pointers. We thus check whether the Buffer is loaded
before accessing it.
Fixes: #10766
(cherry picked from commit 4f50cbcfe4)
Allow a LaTeX backend to run external commands after user confirmation.
This is a per document and per machine setting. The authorization has
to be given through the document settings pane, but is not recorded in
the document itself. Moving the document to either another computer or
another directory on the same computer revokes the authorization.
This can also be done by right clicking the red icon that appears in
the status bar when a document is marked as one requiring shell escape.
The patch also checks whether the user has added the -shell-escape
option to a LaTeX converter and nags the user to remove the option
(which would be used for all documents) in favor of the (per document)
support offered by LyX.
This commit does a bulk fix of incorrect annotations (comments) at the
end of namespaces.
The commit was generated by initially running clang-format, and then
from the diff of the result extracting the hunks corresponding to
fixes of namespace comments. The changes being applied and all the
results have been manually reviewed. The source code successfully
builds on macOS.
Further details on the steps below, in case they're of interest to
someone else in the future.
1. Checkout a fresh and up to date version of src/
git pull && git checkout -- src && git status src
2. Ensure there's a suitable .clang-format in place, i.e. with options
to fix the comment at the end of namespaces, including:
FixNamespaceComments: true
SpacesBeforeTrailingComments: 1
and that clang-format is >= 5.0.0, by doing e.g.:
clang-format -dump-config | grep Comments:
clang-format --version
3. Apply clang-format to the source:
clang-format -i $(find src -name "*.cpp" -or -name "*.h")
4. Create and filter out hunks related to fixing the namespace
git diff -U0 src > tmp.patch
grepdiff '^} // namespace' --output-matching=hunk tmp.patch > fix_namespace.patch
5. Filter out hunks corresponding to simple fixes into to a separate patch:
pcregrep -M -e '^diff[^\n]+\nindex[^\n]+\n--- [^\n]+\n\+\+\+ [^\n]+\n' \
-e '^@@ -[0-9]+ \+[0-9]+ @@[^\n]*\n-\}[^\n]*\n\+\}[^\n]*\n' \
fix_namespace.patch > fix_namespace_simple.patch
6. Manually review the simple patch and then apply it, after first
restoring the source.
git checkout -- src
patch -p1 < fix_namespace_simple.path
7. Manually review the (simple) changes and then stage the changes
git diff src
git add src
8. Again apply clang-format and filter out hunks related to any
remaining fixes to the namespace, this time filter with more
context. There will be fewer hunks as all the simple cases have
already been handled:
clang-format -i $(find src -name "*.cpp" -or -name "*.h")
git diff src > tmp.patch
grepdiff '^} // namespace' --output-matching=hunk tmp.patch > fix_namespace2.patch
9. Manually review/edit the resulting patch file to remove hunks for files
which need to be dealt with manually, noting the file names and
line numbers. Then restore files to as before applying clang-format
and apply the patch:
git checkout src
patch -p1 < fix_namespace2.patch
10. Manually fix the files noted in the previous step. Stage files,
review changes and commit.
Several comments in the code point to the fact that hidden buffers are assumed
to be clean.
The other solution was to adapt the closing & saving code to take into account
hidden dirty buffers. Experience shows that it is more useful to unhide the
buffers at the moment of the external modification, in the context of a git
workflow where one has to reload the modified children buffers one-by-one.
Fixes crash at #10603
When the Buffer is notified to be externally modified, check that the
file contents have changed using the checksum.
Document the shortcoming of FileMonitorBlocker.
Fixes#10642.