Commit Graph

21878 Commits

Author SHA1 Message Date
Enrico Forestieri
bc79c9a27b Fix #9490: SIGSEGV involving LyX macros --- A reproducible MWE (part II) 2015-10-05 22:43:20 +02:00
Guillaume Munch
4b62267814 Fix bugs #6078 and #9364
Remove unwanted clearSelection()s in MathData::updateMacros(). These calls broke
text selection with keyboard and mouse, search-and-replace, restoring selection
after Undo, etc. in a document with math macros since 1.6.0. (Regression at
6aa54673 and 12314897)

I do not know the purpose of these calls, but the selection code has been worked
on since, and I cannot produce undesired behaviour after removing
them.

(cherry-picked from 89342f2946

Conflicts:
	src/mathed/MathData.cpp
)
2015-10-05 04:13:21 +01:00
Guillaume Munch
b056358362 Increase TOC_ENTRY_LENGTH (#9579) 2015-10-02 19:48:59 +01:00
Georg Baum
12ab5dd810 Work around a gcc5 bug
The old code produced crashes with gcc5 caused by calling the copy
constructor (see https://bugzilla.redhat.com/show_bug.cgi?id=1260976).
This has been filed as gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67557
It is currently being marked as invalid (they claim the code is not valid and
produces undefined behaviour), but I don't think that this is correct.
Fortunately i does not matter for us whether the old code was valid or not,
since the new version is easier to understand and works with all compilers.
2015-09-15 21:28:42 +02:00
Guillaume Munch
1348c62d41 Fix bug #9754
Don't delay the update of the TOC panel on switching documents
2015-09-14 00:58:14 +01:00
Guillaume Munch
d186d708ea Fix bug #1996
\overrightarrow and related macros have a standard behaviour with respect to
sub/superscripts.
2015-09-14 00:55:35 +01:00
Juergen Spitzmueller
c78352af07 Fix parsing of class and category declaration line in layout files
* Omit commented-out lines
* Properly escape backslash
* Do not allow non-space chars after delaration
* Allow blanks before # comment character

Fixes: #9746
2015-09-03 09:49:20 +02:00
Scott Kostyshak
039f25e657 Set font in BufferView::setCursor (#9500)
This solves a few bugs related to the font not being set correctly.
For example, when putting a selection somewhere with
putSelectionAt(), the font was not reset so that before this commit
if the cursor was in an ERT, strange things could happen.
putSelectionAt() is notably used when highlighting the location
corresponding with a LaTeX error (GuiErrorList), when using find,
and when using the spellcheck. I could reproduce the bug using all
three of these.

Bug #9500 is an example of the type of bugs that this commit fixes.

(cherry picked from commit f8774a446b)
2015-08-26 17:16:23 -04:00
Jean-Marc Lasgouttes
1c8033f0c0 Reset properly the cursor font when leaving an inset to the left
There was a missing setCursorFont there.

Fixes bug #6032.
2015-08-24 10:40:21 +02:00
Jean-Marc Lasgouttes
56c4bf6c74 Properly notify insets after BufferView::doDispatch
Currently, insets are notified that the cursor entered or leaved them
in Cursor::dispatch. This is not the case for lfuns which are handled
in BufferView.

Adding the proper code allows to fix many bugs where previews are not
updated correctly.

Fixes bug #6173.
2015-08-24 10:28:09 +02:00
Jean-Marc Lasgouttes
b18fff0caa When the document language is changed, update cursor language too
Actually, the change is done only if the cursor language was the
document language already.

This fixes an trivial but annoying problem: create a new file (in
English), change language to your favourite language, then start to
write. Before this fix, the words come out in English, which does not
make sense.

Fixes bug #9586.
2015-08-24 10:16:37 +02:00
Guillaume Munch
1d0d10eaa7 Add \ensuremath to the list of math completions 2015-08-23 11:56:04 +02:00
Kornel Benko
ac9af80cfb Cmake build: Make use of QT5 available (again). 2015-08-16 11:17:02 +02:00
Juergen Spitzmueller
7e8c43a904 If there is an inset at cursor, connect the dialog with that, not the containing one
Fixes: #8716 ("minipage within minipage" Settings bug)

This is a potential candidate for branch, but only after some more testing.
2015-07-28 18:37:52 +02:00
Juergen Spitzmueller
0f9c2b4f04 Do not attempt to select an empty cell before inserting a longtable caption
Fixes: #9692
2015-07-28 18:33:43 +02:00
Jean-Marc Lasgouttes
c2046bd19a Initialize correctly the default keymap
If keymaps are activated and there is a secondary keymap but no
primary one, then the pointer to the active keymap was 0x0. This can't
be good.

Fixes bug #9685.
2015-07-22 16:58:00 +02:00
Jean-Marc Lasgouttes
2109412720 Reset cursor font when entring an inset with char-forward/backward
When entering an inset from the keyboard, setCurrentFont()
was not called and thus the cursor retained the font that was set
before. This could create strange behavior that could often go
unnoticed by the user.

It is easy to imagine many other situations similar to #9597 where
the user could trigger this bug.

Fixes bug #9597.
2015-07-22 15:13:10 +02:00
Stephan Witt
b814639862 Fix for #9659 - Qt may send more then one close event to a window. Therefore multiple calls to unregisterView for a GuiView are possible. The first one removes the view from the list of known views, subsequent calls do nothing.
(cherry picked from commit 8a772549d7)
2015-07-18 23:11:42 +02:00
Jean-Marc Lasgouttes
a8bfb29eb2 Fix logic error in on-screen font shape
This made text in smallcaps+emph display as upright instead of plain
emph. There is no latex font for smallcaps + emph, but it is not a
reason for displaying it wrong.

Fixes bug #3519.
2015-07-17 22:22:59 +02:00
Enrico Forestieri
5f1c593175 Remove unneeded header
Forgot this at e473ee8b
2015-07-06 23:49:56 +02:00
Enrico Forestieri
e473ee8b3f Avoid calling Buffer::getMacro inside the MathMacro copy constructor
It turns out that it is always better using the copy of the MacroData
for updating the macro_ pointer to avoid problems related to the cursor
position.

This is a further amendment to 180ecbd7.
2015-07-06 20:38:35 +02:00
Enrico Forestieri
180ecbd79a Avoid using a dangling pointer
This can happen when a macro is copied and then the document where
it is defined is closed. In this case, the macro survives in the
cut stack but the the buffer pointer is dangling.

This commit is an amendment to 2a9f0733 so no status line is needed.
2015-06-30 21:11:54 +02:00
Scott Kostyshak
1b596e929f Fix setting of pref "hide scrollbar in fullscreen"
The symptom of the bug is that the preference could be incorrectly
displayed (based on the value of the statusbar preference).

This seems to have been a copy/paste mistake introduced in 214f7ed2.

(cherry picked from commit 5e7cbc8f2c)
2015-06-26 10:42:20 -04:00
Enrico Forestieri
2cdeb945ce Assure not to miss requirements on loading with instant preview on 2015-06-25 21:18:31 +02:00
Enrico Forestieri
2a9f07336f Fix crashes related to macros and instant preview
* Fix crash when zooming after latex failed to generate any output for previews.
  This was new in 2.1.4, so no status line is needed.

* Fix crash when copying macros with instant preview on.
2015-06-25 21:04:42 +02:00
Enrico Forestieri
93c0512ba2 Backport latest changes about instant preview
* Fix typo causing to only account for the first char of a macro name
* Also check for macros as arguments of other macros
* Take into account macro redefinitions in the legacy route
* Take into account macros inside nested macro definitions
* Use the draft option for microtype instead of redefining \usepackage
* Make really sure to wait for previews after zoom changes

This is an amendment to previous commits, so no status line is needed.
2015-06-21 19:24:45 +02:00
Enrico Forestieri
565b4e9fd2 Delay regeneration of previews on zoom changes
Until now the regeneration process was starting as soon as the zoom scale
factor was changed. This was causing some glitches, especially if the zoom
was changed by the mouse wheel, as on each change the process was started
again and again making zoom changes painful and causing races such that
one could end up with the text at some zoom factor and the previews at
another one. After this commit, the regeneration is started only after
the zoom factor has been stable for about 1 second. In this way, one can
use the mouse wheel for changing back and forth the zoom factor at own's
heart desire without any slow down due to the regeneration process running
in the background. For those using previews with numbered math equations,
a nice possibility for getting the equations correctly numbered in sequence
(after removing or adding an equation) is using the shortcuts Alt+ and Alt-
in rapid sequence (less than a second between the keystrokes). Previously,
this would have triggered twice the regeneration, but now only once.

This is an amendment to 0e2ea9d4, so no status line is needed.
2015-06-12 17:04:00 +02:00
Enrico Forestieri
4c92d969eb Fix bug #9354 (Preview inset does not work with math macros)
The patch also makes sure that only the macros actually used in a
math inset are included in the preview snippet. In this way, the
size of the tex file used for generating the previews does not
explode in the presence of lots of macros.
2015-06-09 20:07:48 +02:00
Juergen Spitzmueller
558100ad58 Fix bug #9598
Do not output \\par at the end of environments with size change if the
environment cosinsts of only one par.
2015-06-09 15:48:07 +02:00
Scott Kostyshak
9ea4fc6e0f Revert "Update previews after pasting (#6211)"
As JMarc notes on the ML, the referenced commit modifies a full
buffer just in the middle of a dispatch action.

Further, this commit lead to an assertion [1], although it is not
clear to me whether the root cause of the assertion is the commit
that is being reverted here, or one of the issues we have with
previews and macros.

This reverts commit 6ac04e21f4.

[1] http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg187921.html
2015-06-07 12:11:43 -04:00
Juergen Spitzmueller
ebbe6c1924 Fix preview of included files in child documents (bug #9583) 2015-06-04 08:32:07 +02:00
Scott Kostyshak
6ac04e21f4 Update previews after pasting (#6211)
The reason we want to do this is for if there is pasting across buffers.
For within buffer, the previews should already be updated. Calling the
buffer-wide updatePreviews() might seem like overkill, but actually it
should be quick because only the previews that need updating are updated
(and this check feels quick to me, although I did not profile).

If we were to loop through the pasted text and update each preview
individually, this might take more time. When updating previews
together, only one .tex file is compiled.

(cherry picked from commit 73460423ad)
2015-05-31 05:03:29 -04:00
Enrico Forestieri
0e2ea9d48c Fix bug #8258 (Zoom of editor doesn't zoom instant preview) 2015-05-30 18:09:28 +02:00
Enrico Forestieri
908ed2128d Fix bug #9371 (Math Preview doesn’t work in LuaTeX and XeTeX output modes by default) 2015-05-30 15:29:56 +02:00
Enrico Forestieri
043cf5a700 Fix bug #7850 (Preview of inline math misaligned) 2015-05-30 13:51:13 +02:00
Jean-Marc Lasgouttes
6e285a6e52 Create proper undo groups for advanced find and replace
Create new helper class UndoGroupHelper, which simplifies a lot the
handling of undo groups in cases like this one. The class tracks open
undo buffers and allows to switch buffers transparently.

Using the class for advanced search and replace is trivial. The class
may be useful in some other classes.

Also fix the status.21x file that had DOS end of lines and reorder a few undo-related entries.

Fixes ticket #8658
2015-05-29 19:24:36 +02:00
Jean-Marc Lasgouttes
0e64c8ab7a Fix bad font toggling after the layout has been changed.
When changing the paragraph layout, it is a good idea to call
{{{Cursor::setCurrentFont()}}} to make sure that all is in order.

Fixes bug #4394.
2015-05-28 17:01:46 +02:00
Jean-Marc Lasgouttes
ac271336dd Avoid crash with undo in a closed collapsable inset
The recipe for reproducing this crash is to do a search and replace
that changes a string present in a collapsed inset, and then undo.

This is a followup to d5eeabcf, which used editable() instead of
isActive(); this commit was amended at a6bc4a2a, since editable() is
not set properly in mathed.

Truth is, editable() is not the right property to test against, since
it is false for a collapsed inset, which does not prevent a cursor
from pointing inside. Therefore sanitize should not change the cursor
in this case.

Hopefuly, this is the last word on the subject. Alternative would be
to drop this if()-clause completely.
2015-05-27 10:55:18 +02:00
Uwe Stöhr
d9d3bda4b4 InsetTabular.cpp: fix bug #9570 also for branch 2015-05-25 16:57:04 +02:00
Juergen Spitzmueller
183204ffba Use trimmed string in [Inset]Layout Requires.
Fixes: #9518
2015-05-19 16:55:49 +02:00
Juergen Spitzmueller
f0bb9b32d1 Provide optional trimmed version of Lexer::getString and getDocString
Prerequisite to fix #9518
2015-05-19 16:52:32 +02:00
Richard Heck
2f80c1ca33 Fix bug #9544: Mark file clean after we write it.
(cherry picked from commit 61448d8cb2)

Conflicts:
	src/Buffer.cpp
2015-05-17 16:20:32 -04:00
Enrico Forestieri
a6843078af Also take into account bibtex bst files when saving-as.
No status line needed as this is an addition to [4543bf28/lyxgit].
2015-05-17 01:10:48 +02:00
Juergen Spitzmueller
05dafa205d Fix tooltip line breaks. 2015-05-16 17:37:17 +02:00
Juergen Spitzmueller
97e9c7d78c Clarify "Save compressed by default" feature (bug 7822) 2015-05-16 17:34:53 +02:00
Georg Baum
be41e2d16f Fix build with GNU libstdc++ C++11 ABI
The GNU libstdc++ that ships witch gcc 5 can be used with the same ABI as
older versions, or with a new ABI which is conformant to the C++11 standard.
LyX did not build if the latter was used:
https://kojipkgs.fedoraproject.org//work/tasks/1267/9651267/build.log

This is now fixed by detecting the ABI version and disabling the wrong forward
declarations. At the same time, STD_STRING_USES_COW is switched off for the
C++11 ABI version, because the std::basic_string implementation is now C++11
conformant. Since the GNU libstdc++ can also used by other compilers such as
clang, we must not test for the compiler version.
2015-05-12 21:24:05 +02:00
Uwe Stöhr
c391d599d9 GuiBox.cpp: fix button logic (fixes bug #9543) 2015-05-10 21:59:35 +02:00
Juergen Spitzmueller
14618dc0f5 Split different indices in the outliner
Fixes: #7012.

Conflicts:
	src/insets/InsetIndex.cpp
2015-05-09 17:52:47 +02:00
Georg Baum
b59e1bd79b Make static variable non-static
This is still a hack, but a less dangerous one. The old code had a problem
if it was called from different threads, or if for some reason it would get
called recursively.
2015-05-08 21:52:55 +02:00
Jean-Marc Lasgouttes
02dcf8ce10 Revert correctly cursor font after undo a font toggle
The recordUndoSelection call was done after the modification of cursor font. This is bad.

Fixes: #9537
2015-05-07 17:25:11 +02:00