Commit Graph

24986 Commits

Author SHA1 Message Date
Juergen Spitzmueller
2e99b0a53e tex2lyx/TODO: cleanup 2018-09-10 10:34:07 +02:00
Juergen Spitzmueller
22e6659780 Don't add localswitch if no language changes
(cherry picked from commit 7018d3641f)
2018-09-10 10:13:29 +02:00
Juergen Spitzmueller
9a8779cd49 Close/reopen local language switches at each par
Fixes: #11128
(cherry picked from commit f778870338)
2018-09-10 10:11:48 +02:00
Juergen Spitzmueller
9b03b40731 Fix shortcuts info output on the Mac
QKeySequence returns special characters for keys on the mac rather than
textual key names (as on other OSes).

Since these symbols are not included in many fonts, we re-translate them
to textual names

Fixes: #10641
(cherry picked from commit 5f45b3ed9c)
2018-09-10 10:08:04 +02:00
Juergen Spitzmueller
4d81f210c1 Support key symbols via menukeys package
(cherry picked from commit fd7490762d)
2018-09-10 09:46:25 +02:00
Jean-Marc Lasgouttes
014227cc40 Fixes to input method handling
The goal of this patch is to make "self-insert <string>" act as a
sequence of individual self-insert calls. Once it is done, the
insertion of the commit string in GuiWorkArea can use that, which
fixes the issues described in bug 11183.

1/ in InsetMathNest, SELF_INSERT is rewritten to be a proper loop of
   interpretChar, instead of inserting the string as characters. This
   solves the issue of interpreting ^ properly.

2/ the text version does not need to be changed (the loop is rewritten
   using a range, though).

3/ Then {{{GuiWorkArea::inputMethodEvent}}} is changed to invoke
   directly self-insert. This removes the update issues.

Fixes bug 11183.

(cherry picked from commit ad5548cfe3)
2018-09-09 19:43:18 +02:00
Juergen Spitzmueller
ae8c0b2976 Amend 79cf3f5ec1
Some InfoInsets have to be LTR always.
2018-09-09 19:35:24 +02:00
Juergen Spitzmueller
c413f1d81a Fix text direction issue for InsetInfo in RTL context
Fixes: #10463
(cherry picked from commit 79cf3f5ec1)
2018-09-09 19:31:24 +02:00
Juergen Spitzmueller
0bd7a6384b Allow to change multiple columns' width at once
Fixes: #11205
(cherry picked from commit 91254472e6)
2018-09-09 19:13:46 +02:00
Juergen Spitzmueller
0a89b08f68 tex2lyx: fix import of unknown commands'/environments' options
If we detect options via hasOpt(), output the brackets as ERT.

Fixes: #8685
(cherry picked from commit da62299f37)
2018-09-09 19:09:59 +02:00
Juergen Spitzmueller
93f3727b53 tex2lyx: Fix import of Arabic polyglossia environment
Part of #10111

(cherry picked from commit 920e26916e)
2018-09-09 19:05:53 +02:00
Juergen Spitzmueller
9e387aea07 tex2lyx: Add support for multirow
Fixes: #11164
(cherry picked from commit c33506555f)
2018-09-09 12:35:28 +02:00
Juergen Spitzmueller
21852b2c43 We do not natively support multirow yet
See #11164

(cherry picked from commit 2fbce44401)
2018-09-09 12:28:49 +02:00
Juergen Spitzmueller
3efd64696f Consider required modules when checking for layout definitions in modules
Fixes: #11156.
(cherry picked from commit 8b4c76fb24)
2018-09-09 12:25:57 +02:00
Juergen Spitzmueller
995aed2e6e Par alignment in floats must be swapped for all RTL langs, not only Hebrew
Fixes: #11029
(cherry picked from commit 3bacc3c6e7)
2018-09-09 12:23:16 +02:00
Juergen Spitzmueller
a41d589e85 Proper logos with RTL
Fixes #10423

(cherry picked from commit e5a9244bef)
2018-09-09 12:17:03 +02:00
Juergen Spitzmueller
2e65b8e75e Implement tri-state in GuiSetBorder
A new UNDECIDED state is used if multiple cells with differing border
settings are selected.

This prevents additional borders to be set without being asked.

Fixes: #10010
(cherry picked from commit 99aefa5fd2)
2018-09-09 11:46:37 +02:00
Juergen Spitzmueller
f6a8810d9d Wrap rotated cells with linebreaks in varwidth
Fixes: #8085
(cherry picked from commit 88e5e5fd34)
2018-09-09 11:38:38 +02:00
Juergen Spitzmueller
c41f9f7ed7 tex2lyx: extend titling support
Rather than checking for hardcoded title commands such as \maketitle,
use the titlename and titletype as defined in the layout.

This now also includes title environments.

Fixes part of #6461

(cherry picked from commit 429edc0a59)
2018-09-09 11:33:25 +02:00
Juergen Spitzmueller
00f344effa Consider EuropeanNumberTerminator property when determining text direction
Also, use EuropeanNumberSeparator information rather than relying on an
own (incomplete) list of number separators.

Fixes: #4057
(cherry picked from commit 611df441b6)
2018-09-09 11:30:43 +02:00
Enrico Forestieri
4862e00c1f Fix bug #11203
Minted does not have a language option but it is possible to enter
this option in the LyX interface for compatibility with the listings
package, and also for letting to enter a language not present in the
gui. So, this option is only used for properly specifying a language
in a listing, unless it is entered in the document settings dialog.
This case was not foreseen and thus the option was being passed to
the package as is, causing havoc. With this commit the option is
still available but is used to set a default language for a new
listing in place of the default "tex" language used so far.

(cherry picked from commit 16ca5290c0)
2018-09-09 11:25:01 +02:00
Juergen Spitzmueller
ae196dd70c Support input of non-ASCII characters in hyperlinks
We transform them to hex representation via
QByteArray::toPercentEncoding()

Fixes: #11165
(cherry picked from commit 01d8f41894)
2018-09-09 11:00:20 +02:00
Juergen Spitzmueller
29355d34d5 Use footnotehyper rather than footnote if hyperref is used
Fixes: #11212
(cherry picked from commit f8e286b823)
2018-09-09 10:55:34 +02:00
Juergen Spitzmueller
5f0c20b67e Capitalization fixes
Fixes: #11237
(cherry picked from commit b75f716b73)
2018-09-09 10:52:32 +02:00
Juergen Spitzmueller
08aef452e7 Disambiguate dialog buttons
Fixes: #11242
(cherry picked from commit 74657a14a7)
2018-09-09 10:50:01 +02:00
Juergen Spitzmueller
a0fb2f05c9 Do not start from a non-relevant parent in Buffer cloning.
(cherry picked from commit e077255aea)
2018-09-09 10:46:20 +02:00
Juergen Spitzmueller
0c05722a60 Redesign character dialog
Fixes: #2752, #3804, #3884, #4836

Backport of [fb393b450d661/lyxgit] and [f888afeb9ef7/lyxgit]
2018-09-09 10:28:25 +02:00
Richard Kimberly Heck
7c614cc6b7 Try yet again try to fix bug #9158.
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.

(cherry picked from commit 6014492699)
2018-09-08 19:11:49 -04:00
Richard Kimberly Heck
ac61e1c77b Revert "Attempt to fix bug 9158 using updateBuffer."
This reverts commit fe24616060.
2018-09-01 21:48:48 -04:00
Richard Kimberly Heck
6dc9e5aa33 Revert "Use separate BibInfo for child"
This reverts commit cfce0ac009.
2018-09-01 21:47:23 -04:00
Richard Kimberly Heck
d5d2f741a3 Revert "amend cfce0ac0"
This reverts commit 9c1ac5e6d9.
2018-09-01 21:47:20 -04:00
Richard Kimberly Heck
804336d94c Revert "Prevent that a full source preview of a child clears the master's bibfiles cache."
This reverts commit 4ce9e61ab1.
2018-09-01 21:47:11 -04:00
Richard Kimberly Heck
65bc3149ab Updates to cmake scripts needed to build with mingw on Fedora.
These are not really right. Things are hardcoded that probably should
not be. These are marked (hopefully) with "# RKH" comments. Possibly
what's needed is another flag? Anyway, help welcome.
2018-08-30 15:28:13 -04:00
Juergen Spitzmueller
7356f37644 Fix line break in tooltip
Fixes: #11252
(cherry picked from commit 6d71b9b69a)
2018-08-20 08:37:25 +02:00
Enrico Forestieri
48cd67ebf8 Fix LyX server on Windows
On some recent Windows versions, GetLastError() may also return
NO_ERROR instead of ERROR_IO_PENDING during an overlapped write
operation to a pipe. This was confusing the state machine in
Server.cpp so that replies to commands were scheduled but were
never actually output.

(cherry picked from commit cf5f2661dc)
2018-08-08 13:15:56 +02:00
Juergen Spitzmueller
7de98f7dbc Change size policy of buffer combo in refs dialog
Fixes: #9316
(cherry picked from commit b286c6d235)
2018-08-03 19:46:27 +02:00
Juergen Spitzmueller
d762d55558 Fix problem of unwanted spaces caused by macro definitions
Patch by Gilbert J. M. Forkel

Fixes: #11216
(cherry picked from commit 372712cfd9)
2018-07-31 08:49:50 +02:00
Juergen Spitzmueller
1d8ee1c704 (a)mend edb2d14124
(cherry picked from commit 0bf7b3211d)
2018-07-22 10:19:37 +02:00
Juergen Spitzmueller
7ec4fa149c Set RTL tooltips RTL
Fixes: #10672
(cherry picked from commit edb2d14124)
2018-07-22 10:18:27 +02:00
Juergen Spitzmueller
485f070887 Fix nesting problem with numbers in RTL text
\textcolor must precede any \beginL

Fixes: #6283
(cherry picked from commit 114ebf00c4)
2018-07-22 10:16:32 +02:00
Juergen Spitzmueller
cc845ed2cf Fix bracket output in RTL languages
This is a real mess!

Fixes: #11187
(cherry picked from commit 195f62ac93)
2018-07-21 10:40:59 +02:00
Juergen Spitzmueller
a17dfeee0e Fix quotation marks in RTL script
Fixes: #11188
(cherry picked from commit aa1d9638fe)
2018-07-21 10:27:38 +02:00
Juergen Spitzmueller
82cade4877 Use QMessageBox for toggleWarning if possible
Qt 5.2 introduces the possibility to place a checkbox on a QMessageBox,
so we need no longer to use our own crude dialog.

(cherry picked from commit 0148ef7e6c)
2018-07-11 19:11:28 +02:00
Juergen Spitzmueller
12ca81f2ea Fix creationCode() of GuiPrintNomencl
This fixes "New Inset" in that dialog.

Candidate for stable

(cherry picked from commit d2afa67da9)
2018-07-10 17:52:50 +02:00
Jean-Marc Lasgouttes
25e0ca1860 Do not force lfun argument to be pure ascii
Fixes bug #11167.

(cherry picked from commit 8e015f3cb2)
2018-07-04 11:46:03 +02:00
Jean-Marc Lasgouttes
5eb4a15579 Do not allow completion when there is an active selection
We do it in texted only, mathed is more difficult and not so relevant IMO.

(cherry picked from commit 789acb4a95)
2018-07-04 11:22:00 +02:00
Juergen Spitzmueller
ab450346b5 Handle correctly zero table special arguments.
Fixes: #10247
2018-06-27 08:16:59 +02:00
Enrico Forestieri
49c0021306 Fix bug #11174
Apparently, a new paragraph is started after a float even if
no blank line is actually present. So, account for this fact.

(cherry picked from commit f6922b8c88)
2018-06-17 23:37:39 +02:00
Jean-Marc Lasgouttes
567e94347a Skip paint event when in the middle of a buffer operation
This is detected when an undo group is open and contains at east one
element. This means indeed that changes are in progress. Note that the
group is in general opened in GuiApplication::dispatch. The code there
is changed to ensure that the group is closed before updating the
screen.

This patch is experimental. It is expected to be replaced in master by
a more complete solution. It could in the meantime be backported to 2.3.x.

Fixes bug #11159.

(cherry picked from commit c7496a11b2)
(cherry picked from commit 4d0c43f9aa)
2018-06-15 14:12:32 +02:00
Richard Kimberly Heck
8abea3b7e9 Try to fix bug #10989.
The problem is that popping dialogs during reload can cause paint
events for which we are not ready. If this does not work, then we
can introduce a new flag, besides 'busy', for that case. But busy
does not seem to be used very widely, so hopefully this works.

Note that when paintEvent is triggered on macOS, the least we can do
is to copy our backing store to the screen.

(cherry picked from commit 19e6977b5b)
(cherry picked from commit d03deeca0c)
2018-06-15 13:45:28 +02:00
Jean-Marc Lasgouttes
00ec2dd106 Unbreak completion in text mode
Completion uses a complicated async scheme based on timers to update
itself. This is probably not necessary anymore and is fragile to
event order changes.

This is what happens with the new painting scheme. Therefore the
asyncHideXXX() methods have to be made more robust and detect whether
completion state has changed by the time they are triggered.

(cherry picked from commit f1ea7fee5c)
2018-06-11 10:35:55 +02:00
Jean-Marc Lasgouttes
97fe69426d Draw frame last when drawing text insets
This avoid cases where the blinking cursor erases the frame.

(cherry picked from commit 4e9084b3e4)
(cherry picked from commit 6bcc7d6e42)
2018-06-11 10:24:05 +02:00
Enrico Forestieri
44466f305f Avoid duplicate generation of the same preview
When an image has to be loaded a second time and the cache
is not used or the image is not in the cache, its preview is
going to be regenerated again. Hence, if the same image
appears more than once on screen, avoid requesting simultaneous
generation of the same preview.
See also this thread:
https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg205057.html
2018-06-07 23:13:33 +02:00
Jean-Marc Lasgouttes
874ad18178 Set caret height correctly for cells inside math rows
The code in 90cfe4ec3 only handled the cells which metrics are
computed directly, and missed those who were linearized inside a MathRow.

To fix this, we use the fact that all the positions in a math row have
the same height and make MathRow::metrics return a boolean indicating
whether it contains a caret for a given bufferview.

Fixes bug #11153.

(cherry picked from commit a3868e40a4)
2018-05-24 17:28:49 +02:00
Jean-Marc Lasgouttes
1c8a53458a Reset dim width when computing MathRow metrics
This was dropped by mistake in 7bcb78a77.

Fixes bug #11152.

(cherry picked from commit c58b914c80)
2018-05-22 20:28:12 +02:00
Enrico Forestieri
87b44bcc1f Fix bug #11151
(cherry picked from commit 17ea71b31c)
2018-05-21 22:01:56 +02:00
Jean-Marc Lasgouttes
011d925da0 Removed unused private variable
Spotted by clang++ 6.

(cherry picked from commit c4075367fa)
2018-05-15 23:13:59 +02:00
Jean-Marc Lasgouttes
45fba1ce1b Avoid crash when trying to handle FitCursor
It is better to handle SinglePar before FitCursor, since the later
requires correct metrics at cursor position.

Fixes bug #11139 and probably #11125.

(cherry picked from commit 7f83d26934)
2018-05-14 00:10:45 +02:00
Juergen Spitzmueller
d35055de83 Fix InsetBox::contentAlignment()
Some cases where alignment is possible were missing.

Candidate for 2.3.x.

(cherry picked from commit de67b68b1d)
2018-05-11 18:44:17 +02:00
Jean-Marc Lasgouttes
4e981b034e Adapt caret height to context in mathed.
Compute a height from current font and current cell vertical
dimensions in MathData::metrics(), because this is where current font
is known.

Introduce BufferView::setCaretAscentDescent to remember this value.

This mechanism is not used for text because Cursor::current_font is
restored by undo, and the caret height would not be changed then. But
in principle it is doable.

(cherry picked from commit 90cfe4ec3b)
2018-05-10 12:53:30 +02:00
Jean-Marc Lasgouttes
0cba074ecf Better mechanism for setting cell height
When computing a cell metrics, it is now possible to specify whether it
is tight (at least as tall as 'x') or not (as tall as the max height of
the font).

Use this to make sure that grid insets have large enough cells. It
will probably appear that other cells needn't be tight. Currently, the
only cell which is known to be tight is the nucleus of the root inset.
Others should be examined one by one. It might be that the default of
MathData::metrics tight parameter should be `false'.

Fixes bug #11050.

(cherry picked from commit 7bcb78a778)
2018-05-10 12:48:56 +02:00
Jean-Marc Lasgouttes
f33d0789f6 Set a minimal height for math rows
The value used here is the x height. It would be nice to see what the
TeXbook really says.

This makes a big difference with \tilde{.}, for example.

(cherry picked from commit 6df8c42e59)
2018-05-10 12:47:57 +02:00
Scott Kostyshak
705302f6de Center longtable explicitly (#10690)
"Center" is the default of longtable, but some situations require it
to be centered explicitly, such as when using floatrow:

https://tex.stackexchange.com/questions/320592/floatrow-package-conflicting-with-centering-longtable

(cherry picked from commit bde1834f7e)
2018-05-08 17:42:43 -04:00
Richard Kimberly Heck
69ab4d17c8 Fix problem noted by Scott in bug #11125.
Need to set the Buffers for math insets, too.

(cherry picked from commit 81abfdc13d)
2018-05-08 02:12:19 -04:00
Richard Kimberly Heck
ffeac12a86 Fix problem with synchronous export.
It surprises me a bit that the code is different in this case
from the case when EXPORT_in_THREAD is not set. I should check
to see if there's a problem in the other case, too.

(cherry picked from commit 0fc50a2637)
2018-05-06 17:46:53 -04:00
Juergen Spitzmueller
36096435e5 Fixes for nested ulem commands
1. \uuline must be on top of \sout
2. \uwave in \xout needs a hack to compile

(cherry picked from commit 9fd94a2dd0)
2018-05-05 10:09:04 +02:00
Juergen Spitzmueller
63c54434ae PassThru paragraphs have latex_language; consider this when checking
previous language

Fixes: #10793.
(cherry picked from commit 15df033bce)
2018-05-01 06:56:45 +02:00
Richard Kimberly Heck
1221d00d7d Request buffer update rather than do it.
(cherry picked from commit 2777b51c58)
2018-04-30 22:32:52 -04:00
Scott Kostyshak
6a808d285c Fix duplicate, disabled "Separated Frame Below"
This commit fixes an issue where the menu option "Insert Separated
Frame Below" would show up twice, with one instance disabled. This
occurred when there was a "Standard" environment nested in a
"Frame". With this commit, the duplicate instance is removed.

(cherry picked from commit 4f7a5f8c3e)
2018-04-29 00:05:15 -04:00
Scott Kostyshak
9b821eb047 Initialize toolbarsMovable_
Valgrind detected a conditional jump because this member was not
initialized.

(cherry picked from commit e49a10729e)
2018-04-27 23:31:09 -04:00
Jean-Marc Lasgouttes
be62d98dcf Rework caret display code
The new code is much simpler: what it does is, after redrawing has
been done, to mark the cursor row as changed, so that it will be
repainted on next paint event.

This avoids some crashes at the price of possibly repainting the row
when it was not necessary.

(cherry picked from commit 2f1eb35b86)
2018-04-27 11:46:44 +02:00
Jean-Marc Lasgouttes
5c6bc52b1b Update cursor position after committing IM string
(cherry picked from commit 01fea56eb6)
2018-04-26 22:45:57 +02:00
Richard Kimberly Heck
69a72f5dec Restore implicit word selection for inset insertion.
Modifies 0662ffb9.

(cherry picked from commit aa2f409d87)
2018-04-25 21:53:54 -04:00
Richard Kimberly Heck
1101d85a3a Improve error message a bit more.
Sorry to Kornel, who had already updated sk.po!

(cherry picked from commit 821e101547)
2018-04-25 18:45:01 -04:00
Richard Kimberly Heck
e7387fd348 Don't sort the bibfiles cache.
This causes problems with biblatex. Instead, we sort the old and
new lists and then compare them.

(cherry picked from commit 6b095e2b71)
2018-04-25 13:45:17 -04:00
Richard Kimberly Heck
13354c4a53 Improve error message.
(cherry picked from commit 04f7151684)
2018-04-25 12:06:07 -04:00
Jean-Marc Lasgouttes
d0a11cb8e2 Redo metrics after cancelling macro mode
When the cursor is inside a subscript that may become empty, metrics
issues can happen. This patch fixes the issue, although it is not
clear to see what the problem is.

Still, requesting a metrics update also in the case where the macro
mode is canceled makes sense.

Fixes bug #11125.

(cherry picked from commit 68ec34e603)
2018-04-25 17:03:50 +02:00
Richard Kimberly Heck
4f0504d778 Add slightly improved error message. 2018-04-23 20:36:28 -04:00
Richard Heck
00522ecd3f Fix #8338.
The idea here is to force commands to be run syncrhonously when
they are launched via "command-sequence" or "repeat". We do this
by using a new flag in FuncRequest.

(cherry picked from commit 2477493cf5)
2018-04-20 23:48:50 -04:00
Richard Heck
7d0b7e0840 Fix for #10624.
If we're in the first paragraph after a division (section, etc),
use the prefix for it.

(cherry picked from commit dd2efe8d0d)
2018-04-20 23:29:36 -04:00
Richard Heck
0662ffb98e Fix #6344.
For some reason, special code was added for LFUN_INDEX_INSERT
when it was not actually needed. So just delete it.

(cherry picked from commit 83356ab9fe)
2018-04-20 23:16:02 -04:00
Richard Heck
7dcd1a7f4e Reset counters before we re-run updateBuffer when the bibfiles change.
Fixes a bug reported by Pavel here:
  https://marc.info/?l=lyx-devel&m=152407889727665&w=2

(cherry picked from commit 64acc06b91)
2018-04-20 23:01:23 -04:00
Richard Heck
12c196755b Fix bug #11118.
Adds LFUN_MASTER_BUFFER_EXPORT.

(cherry picked from commit c4c7053d1d)
2018-04-19 00:11:48 -04:00
Juergen Spitzmueller
9e52c7693e Add support for rotated longtabulars (via [pdf]lscape)
Fixes: #9194

See #9194 for why we use an earlier file format change here.

(cherry picked from commit feab528fd1)
2018-04-18 18:10:06 +02:00
Richard Kimberly Heck
b567ef36bb Fix bug #11084.
Allow unicode-insert to accept a sequence of codepoints.

(cherry picked from commits 83b1ac3b, f7d502d0, and a714f6cb)
2018-04-16 23:26:08 -04:00
Richard Heck
955199fe8c Fix bug #9847.
Spaces are, amazingly, allowed at the end of bibliography keys. So we
introduce a new parameter allowing getVectorFromString not to trim
whitespace, and then use it.

For some reason, this seems not actually to have been backported
to 2.3.x.
2018-04-16 23:19:21 -04:00
Richard Heck
5a9bf60166 Fix bug #11055.
See also https://marc.info/?l=lyx-devel&m=151709211602688&w=2.

(cherry picked from commit d3ee87eea2)
2018-04-15 00:29:36 -04:00
Juergen Spitzmueller
4ce9e61ab1 Prevent that a full source preview of a child clears the master's bibfiles cache.
See #9158

(cherry picked from commit a9a7f38488)
2018-04-15 00:26:43 -04:00
Juergen Spitzmueller
9c1ac5e6d9 amend cfce0ac0
(cherry picked from commit 6415d986ba)
2018-04-15 00:21:13 -04:00
Juergen Spitzmueller
cfce0ac009 Use separate BibInfo for child
This is used when the file is compiled standalone

Fixes: #11083
(cherry picked from commit 1c623ffe8f)
2018-04-15 00:18:57 -04:00
Richard Heck
fe24616060 Attempt to fix bug 9158 using updateBuffer.
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.

(cherry picked from commit 8b9d1b8601)
2018-04-15 00:14:32 -04:00
Juergen Spitzmueller
e4a3527fa9 Consider sub-subfiles on log file parsing.
These are listed as (subfile.ext (sub-subfile.ext))

Fixes: #11112
(cherry picked from commit 1e1800a21a)
2018-04-15 00:04:40 -04:00
Richard Heck
bcb002039b Merge branch '2.3.2-staging' into 2.3.x 2018-04-14 23:52:31 -04:00
Richard Heck
156cfe5951 Fix bugs #10897 and #10912. 2018-04-14 23:38:32 -04:00
Scott Kostyshak
c19fd610b9 Do not show master's errors if compiling child
If a master document is compiled and has errors, and then a child is
compiled without error, the errors from the master compilation were
shown.

The setup of the relevant code is the following:

  processingThreadFinished() calls errors().  errors() makes the
  assumption that if it is called, there must have been an error
  somewhere.

The logic of the setup is the following:

  processingThreadFinished() knows whether there was an error on
  the most recent preview/export, although it doesn't know whether
  the error is from master or child (i.e. does not know whether the
  user was compiling the child, or whether master-buffer-view was
  called).  Inside error(), if there is no error in the child, it is
  assumed the error is from master.

For the above logic to work, errors() should only be called if there
was an error.

This commit fixes #11106 and preserves the fix to #7330.

(cherry picked from commit 8d2b121ef5)
2018-04-14 23:25:19 -04:00
Jean-Marc Lasgouttes
86c003001d Fix invalid octal number
(cherry picked from commit 6cffd468e0)
2018-04-14 23:23:10 -04:00
Juergen Spitzmueller
10335b93b4 Support new hunspell C++ ABI if LyX is built against hunspell >= 1.5
Fixes: #10547
2018-04-14 10:35:59 +02:00
Joel A. Kulesza
d25762da35 Changed Settings->Local Layout to FixedWidth & Nowrap
This change is made in response to Ticket 10992.

The change made is consistent with those captured in Ticket 9966.

(cherry picked from commit 869e2fe9b9)
2018-04-09 21:30:40 -04:00
Juergen Spitzmueller
1eceb1c574 Load hyperref with a suitable driver
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
(cherry picked from commit 33bfbf89c4)
2018-04-09 15:17:11 +02:00
Juergen Spitzmueller
9df09d8cba Set correct path to (biblatex) bibliography databases that are entered relative to child documents.
Fixes: #11105
(cherry picked from commit 2ecc3b09c6)
2018-04-08 13:25:17 +02:00
Uwe Stöhr
c690e8880b tex2lyx: parse \xymatrix
LyX's \xymatrix support relies on math therefore put it into math and parse its content

fixes bug #10638

(cherry picked from commit 1174279967)
2018-04-07 00:19:10 -04:00
Juergen Spitzmueller
6810a181d0 Do not use \tablefootnote in minipages
Minipages provide their own working \footnote's

Should also go to 2.3.x.

(cherry picked from commit 37404df686)
2018-04-05 11:59:05 +02:00
Richard Heck
935442aaba Fix bug #11102.
Ignore deleted material when generating a proposed label.

(cherry picked from commit d9ebf6e2c7)
2018-04-03 18:41:28 -04:00
Pavel Sanda
5394481071 Upstreaming compilation patch needed for Gentoo. 2018-04-02 21:42:51 +02:00
Richard Heck
d1fa6f10e5 Set preamble tab stop to 4 chars. 2018-04-01 22:20:57 -04:00
Richard Heck
2bb9d49527 Fix bug 11099.
Adds simple search/find functionality to preamble.
2018-04-01 22:20:57 -04:00
Stephan Witt
ce28621d9e Add description comment for the lyxconvert utility 2018-03-31 10:22:31 +02:00
Stephan Witt
aa9df3bf88 Add license and author infos 2018-03-31 10:22:23 +02:00
Stephan Witt
a4e9861278 Add missing check for Qt version when using QPdfWriter class 2018-03-31 10:22:13 +02:00
Juergen Spitzmueller
bcd1814746 Open ExternalInset dialog on first tab for new insets
Fixes: #11081
(cherry picked from commit 126e0c3dac)
2018-03-29 09:48:00 +02:00
Juergen Spitzmueller
d549330760 Handle comments in options
Things like
pdfpagemode=UseOutlines%None,UseOutlines,UseThumbs,FullScreen

was not imported correctly (the comment was not stripped)

Fixes the rest of #5737

(cherry picked from commit 820ec38da7)
2018-03-29 09:42:00 +02:00
Juergen Spitzmueller
953df30894 Fix use of default biblio_style
Fixes: #11088
2018-03-26 17:59:27 +02:00
Juergen Spitzmueller
99094ca7c4 amend 1c623ffe8f
(cherry picked from commit 6415d986ba)
2018-03-26 13:28:48 +02:00
Juergen Spitzmueller
057af45060 Use separate BibInfo for child
This is used when the file is compiled standalone

Fixes: #11083
(cherry picked from commit 1c623ffe8f)
2018-03-26 13:27:15 +02:00
Jean-Marc Lasgouttes
977a0c4037 Make it possible to select (not)native file dialogs at run time
Add a new LyXRC variable use_native_filedialog (true by default) that
allows to select the kind of FileDialog we want at runtime.

(cherry picked from commit af795b80d8)
2018-03-21 10:56:57 +01:00
Juergen Spitzmueller
d9314d15dc Some improvements to the graphics dialog
* Describe the viewport/bb situation more accurate
* Use generic term "coordinates", since bb and viewport are flavor-specific
* Add some tooltips
* Increase the width of the options widget.

(cherry picked from commit c462fadff5)
2018-03-19 18:23:59 +01:00
Jean-Marc Lasgouttes
b3cca8086d Add support for enchant 2.x
As of enchant 2.x, it is required to create a Broker instance instead
of relying on a static one provided by the library.

Add autoconf and cmake (courtesy of Kornel) tests that check whether
one can indeed instantiate a Broker object, and act on the result in a
new broker() helper function.

Fixes bug #10986.

(cherry picked from commit 63a4e82874)
2018-03-19 17:33:17 +01:00
Jean-Marc Lasgouttes
0ddb1435c9 Fix default spellchecker when only Enchant is available
This has been annoying me for ages.

(cherry picked from commit ae473b012a)
2018-03-19 16:51:45 +01:00
Juergen Spitzmueller
7927d71a08 Properly fix math packages table in Document Settings
Fixes: #10777
(cherry picked from commit 3face5e119)
2018-03-18 16:47:59 +01:00
Uwe Stöhr
91a15383f9 GuiDocument.cpp: change back alignment for column with package names
- as discussed in bug #10777 the first column should be left-aligned

(cherry picked from commit 56670d7322)
2018-03-18 16:36:21 +01:00
Uwe Stöhr
eb172be29b GuiDocument.cpp: fix bug 10777
- the column width must be as wide as the column header text
- also center the radiobuttons in the table
- also use alternating colors for the table rows

(cherry picked from commit a69f1a9e16)
2018-03-18 16:36:21 +01:00
Juergen Spitzmueller
a0ae2ccd35 Reset buffer language only if we have something to reset.
Fixes: #11063
(cherry picked from commit 599b1222f7)
2018-03-17 15:44:05 -04:00
Juergen Spitzmueller
c52baa7d81 tex2lyx: handle whitespace in table column declaration.
Fixes: #10804
(cherry picked from commit 247e1a223d)
2018-03-17 15:44:05 -04:00
Juergen Spitzmueller
d71e3404fe Braces need to be escaped as well on LATEXIFY
part of #9563
2018-03-17 15:44:05 -04:00
Juergen Spitzmueller
5fb2566572 Do not force singlebyte encoding for listings with XeTeX/LuaTeX.
Fixes: #11056
(cherry picked from commit cbf2a329c9)
2018-03-17 15:44:05 -04:00
Juergen Spitzmueller
11d20e132a tex2lyx: do not force default bibliography style if none is set
Some classes provide a \bibliographystyle, so we must not output any
\bibliographystyle if none is set in the TeX file.

Fixes: #10673
(cherry picked from commit ed331bedd6)
2018-03-17 15:44:05 -04:00
Juergen Spitzmueller
b35fb98335 Fix list of viewable formats in view/update menu.
Also fix list in (currently unused) Export toolbar button.

Fixes: #11044
(cherry picked from commit ab6bd5e319)
2018-03-17 15:44:05 -04:00
Jean-Marc Lasgouttes
f599e90d92 Kill macro mode when using LFUN_ESCAPE
Add a `cancel' boolean to macroModeClose() that just removes all trace
of what has been entered instead of finalizing it.

When entering a macro in mathed, let LFUN_ESCAPE invoke
macroModeClose(true). The new semantics of LFUN_ESCAPE in mathed is
thus to abort the input of a macro name.

Fixes bug #9251.

(cherry picked from commit 9296344b9a)
2018-03-17 15:44:05 -04:00
Juergen Spitzmueller
148a053fbc escape label in included listings
Also use docstring rather than string.

Fixes part of #10544

(cherry picked from commit 0bf8865122)
2018-03-17 15:44:05 -04:00
Juergen Spitzmueller
0e08b4e4f5 Adapt to new ChkTeX return values.
As of v. 1.7.7, chktex has four exit values. Only consider the program
failed with EXIT_FAILURE (1). This is backwards compatible to chktex
up to v. 1.7.5 and later patched versions included in TeXLive, where
there was the distinction EXIT_FAILURE (program failed) and EXIT_SUCCESS
(program successfully run, with or without something to report).

Note that ChkTeX v. 1.7.5 and 1.7.6 vanilla (as included in MikTeX) also
returned EXITE_FAILURE if ChkTeX found something to report.

We do not, and never did, support this case.

Fixes: #9989 (after ChkTeX 1.7.7. is released).
(cherry picked from commit 0d806799aa)
2018-03-17 15:44:05 -04:00
Juergen Spitzmueller
8bf7e691bc Do not use English, but the context language, when pasting from math
Fixes: #2596
(cherry picked from commit 92990adc23)
2018-03-17 15:44:05 -04:00
Juergen Spitzmueller
6c64844d3b Do not use English, but the context language, when pasting from LaTeX
Fixes: #9199
(cherry picked from commit e85704020b)
2018-03-17 15:44:05 -04:00
Juergen Spitzmueller
c285b4f8c3 amend 71fea63326
(cherry picked from commit be4d49ebd1)
2018-03-17 15:44:05 -04:00
Juergen Spitzmueller
c0a1893008 Disable CheckTeX while buffer is processed
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.
(cherry picked from commit 71fea63326)
2018-03-17 15:44:05 -04:00
Juergen Spitzmueller
b408222f76 Disable BUFFER_EXPORT and BUFFER_EXPORT_AS while buffer is processed
I am rather irritated we didn't do this already, since synchronous runs
with BUFFER_VIEW or BUFFER_UPDATE leads to all sorts of problems,
including crashes.

Fixes the crash in #8338 (but not the bug itself).

(cherry picked from commit 1437ae3f9c)
2018-03-17 15:44:05 -04:00
Juergen Spitzmueller
cd51b9cca1 Re-add method to get a temporary file name without persistent QTemporaryFile object
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
(cherry picked from commit 9e2928be68)
2018-03-17 15:44:05 -04:00
Juergen Spitzmueller
f711e44bcf tex2lyx: complete minted support (inputminted)
Also fix some whitespace issues in minted inset import.

(cherry picked from commit f3c5bcd2be)
2018-03-17 18:16:46 +01:00
Juergen Spitzmueller
ded23e1f9a tex2lyx: add support for lstinputlisting
(cherry picked from commit d325f79f5c)
2018-03-17 17:14:11 +01:00
Juergen Spitzmueller
910daa27e4 tex2lyx: add beamer test file
(cherry picked from commit 63b67fee83)
2018-03-17 14:36:45 +01:00
Juergen Spitzmueller
b0c9da0da1 tex2lyx: do not eat empty paragraphs if keepempty is true
Fixes: #11078
(cherry picked from commit 79728dcde9)
2018-03-17 13:55:33 +01:00
Juergen Spitzmueller
cfc2f0681e tex2lyx: handle makebeamertitle
(cherry picked from commit d93076c128)
2018-03-17 13:54:57 +01:00
Juergen Spitzmueller
5170efe2c9 tex2lyx: clear latexparam after use.
(cherry picked from commit 7e3a41bd15)
2018-03-17 13:54:36 +01:00
Juergen Spitzmueller
ce5b420a44 tex2lyx: add support for LaTeXParam
Part of #11068

(cherry picked from commit 506ae2d2ea)
2018-03-17 13:54:02 +01:00
Juergen Spitzmueller
42863eac92 tex2lyx: support for beamer text styles with overlays
E.g. things like \textbf<article>{foo} have to be imported as insets.

Part of #11068

(cherry picked from commit c74e399981)
2018-03-17 13:49:33 +01:00
Juergen Spitzmueller
7c816488b6 tex2lyx: More work on beamer support
* Implement list item overlay support (\item<arg>)
* Implement itemcommand support (e.g., \overprint<arg>)
* Fix general list argument placement

Part of: #11068

(cherry picked from commit e51265b5f3)
2018-03-17 13:49:13 +01:00
Juergen Spitzmueller
31c293dec3 tex2lyx: towards beamer overlay argument support.
Implemented: Overlay and standard overlay arguments for commands
and environments.

Still missing:
* List item overlay
* itemcommand overlay (\overprint)
* overlay via LatexParam (e.g., Flex:ArticleMode)

Needs fixing:
* General list argument (\begin{itemize}[arg])
* nested content in a frame with no title (empty par)

(cherry picked from commit 949de66956)
2018-03-17 13:48:46 +01:00
Pavel Sanda
103f7a5ea6 Paint \dot & \ddot more like a dot
https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg204183.html
2018-03-13 22:47:46 +01:00
Juergen Spitzmueller
f01369a56f Fix known_escaped_chars
(this includes the amend)
2018-03-13 17:39:40 +01:00
Juergen Spitzmueller
cedb4838f0 update tex2lyx tests 2018-03-12 09:35:39 +01:00
Juergen Spitzmueller
d263ca0529 tex2lyx: update quote handling
* Consider new quote styles
* Consider changed quote styles
* Try to be a bit smarter with ambiguous quotation marks

(cherry picked from commit 8184f08f4a)
2018-03-12 09:19:17 +01:00
Juergen Spitzmueller
59449063df tex2lyx: support tipa \t*{} macro.
(cherry picked from commit cc6f2dae82)
2018-03-12 09:15:57 +01:00
Juergen Spitzmueller
fff6d35cff update tex2lyx tests once more. 2018-03-11 19:56:04 +01:00
Juergen Spitzmueller
bbaf2b6a29 amend 11e4a24e6e
(cherry picked from commit 386d9953e8)
2018-03-11 19:51:53 +01:00
Juergen Spitzmueller
64981aa48c update tex2lyx tests. 2018-03-11 19:32:21 +01:00
Juergen Spitzmueller
624a6642e9 tex2lyx: make nested CJK parsing slightly less dumb.
Fixes: #9562
(cherry picked from commit 0f4c902705)
2018-03-11 18:29:50 +01:00
Juergen Spitzmueller
590185d3ef tex2lyx: honor grouping in optional arguments.
E.g., \cite[{a literal ] character}]{key}

(cherry picked from commit cba38881d6)
2018-03-11 18:27:23 +01:00
Juergen Spitzmueller
ce2e155490 Fix copy and paste error in 6659304f7f
(cherry picked from commit 0513622fd0)
2018-03-11 18:26:59 +01:00
Juergen Spitzmueller
bd876d8163 tex2lyx: towards proper support of "literal"/"latexified" inset commands
We now report whether the attempt to recode the macros to glyphs
succeeded. If yes, we set "literate" to false, if not to true.

Also, do not attempt to recode for non-latexifying fields.

Fixes: #9563
(cherry picked from commit 6659304f7f)
2018-03-11 18:26:33 +01:00
Juergen Spitzmueller
f183686505 tex2lyx: support for URW Classico, MinionPro and the new Libertine fonts.
(cherry picked from commit a3836d9909)
2018-03-11 18:23:35 +01:00
Juergen Spitzmueller
5fc0dafac3 tex2lyx: get rid of another large if-else if chain.
(cherry picked from commit 11e4a24e6e)
2018-03-11 09:24:02 +01:00
Juergen Spitzmueller
91ce18388e Amend 15fd17d83f
(cherry picked from commit b2ccdae228)
2018-03-10 14:24:38 +01:00
Juergen Spitzmueller
0f33720d29 tex2lyx: support for \includeonly
(cherry picked from commit 15fd17d83f)
2018-03-10 11:09:40 +01:00
Juergen Spitzmueller
42dd5f5cfa tex2lyx: chapterbib support
(cherry picked from commit af6933c06f)
2018-03-10 10:33:10 +01:00
Juergen Spitzmueller
30cb99503f tex2lyx: support alignment pseudo-environments.
Fixes: #7857
(cherry picked from commit 7a22ce7c09)
2018-03-06 18:27:13 +01:00
Juergen Spitzmueller
afeb5acb0f Fix local polyglossia switch for Arabic
We need to lowercase the language again (it's \begin{Arabic},
but \textarabic)

Fixes: #11057.
(cherry picked from commit 27584f5f70)
2018-03-06 18:24:32 +01:00
Juergen Spitzmueller
94fe126161 tex2lyx: fix subfloat import
Fixes: #10385
(cherry picked from commit 1dcb2a0976)
2018-03-06 18:22:12 +01:00
Uwe Stöhr
a1cdc1e723 tex2lyx/text.cpp: fix a typo
(cherry picked from commit a30972a39c)
2018-03-06 08:21:34 +01:00
Juergen Spitzmueller
5f359e27b0 Small update of TODO
(cherry picked from commit 4bc379ea67)
2018-03-06 08:21:16 +01:00
Juergen Spitzmueller
95d446eb4c parse_text (tex2lyx): get rid of the monstrous if-then-else clause
Rather than that, continue in the loop if a condition is met.

This fixes tex2lyx for MINGW, which has a cluase-nesting threshold.

Fixes: #9552
(cherry picked from commit b94bb37e53)
2018-03-06 08:20:44 +01:00
Juergen Spitzmueller
8d02bff57e tex2lyx: support qualified citation lists (biblatex)
(cherry picked from commit 0915e81481)
2018-03-06 08:20:18 +01:00
Juergen Spitzmueller
8ab9b8e0b6 tex2lyx: refsection and bibbysection support (biblatex)
(cherry picked from commit 1a3dbbf07a)
2018-03-06 08:19:54 +01:00
Juergen Spitzmueller
50b78507b9 tex2lyx: support biblatex
(qualified citation lists and multibib not yet supported)

(cherry picked from commit f22213a04f)
2018-03-06 08:19:35 +01:00
Juergen Spitzmueller
3e6a1eecc5 tex2lyx: consider options passed via \PassOptionsToPackage
(cherry picked from commit 476401a76f)
2018-03-06 08:18:43 +01:00
Juergen Spitzmueller
84b59c90e7 tex2lyx: import straight quotation marks as ERT
This assures that they are output as straight quotations marks (e.g.,
babel shorthands).

Fixes: #75 [sic!]
(cherry picked from commit ccb9ae9670)
2018-03-06 08:17:18 +01:00
Pavel Sanda
3d6b8c0abb Allow reload if buffer is externally modified.
Follow-up of 2df82c4a44.
2018-03-02 20:49:48 +01:00
Pavel Sanda
e97a82b7ff Filter in citation dialog is not respected when reloading databaze. 2018-03-02 01:33:02 +01:00
Juergen Spitzmueller
749ff439df No manual intervention needed for polyglossia (bidi) and RTL numbers.
See https://tex.stackexchange.com/a/256837/19291

(cherry picked from commit 00d4144352)
2018-02-27 08:59:02 +01:00
Juergen Spitzmueller
98e9e53882 Take actual font height (ascent, descent) into account when drawing placeholder box for graphics
Fixes: #11048
(cherry picked from commit 5ddd377a0a)
2018-02-26 08:59:11 +01:00
Pavel Sanda
9df4806f7f We don't want external change to automatically marked the buffer dirty.
https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg203995.html
2018-02-25 22:18:30 +01:00
Jean-Marc Lasgouttes
2e67181036 Improve documentation of inset-(begin|end)(|-select)
Make it clear that it can go at the beginning/end of the document.

(cherry picked from commit f4693ef8ab)
2018-02-23 10:22:33 +01:00
Richard Heck
797babd462 Fix bug #10817.
Respect 'literal' setting when calculating longest bibitem.

(cherry picked from commit 224e56c935)
2018-02-22 15:44:29 -05:00
Richard Heck
04e8526460 Respect "literal" setting when entering citation via LyX server.
This requires moving the bool that tracks this somewhere that it
is visible from BufferView. It seemed to make sense to put it as
a static member of InsetCitation.

(cherry picked from commit f8e8877f83)
2018-02-22 15:33:01 -05:00
Juergen Spitzmueller
721cc085a2 Implement IsTocCaption for normal layouts.
But use default "true" to maintain current behavior if not explicitly
stated otherwise.

Fixes: #11045
(cherry picked from commit 8a703573ea)
2018-02-22 19:12:30 +01:00
Alexander Dunlap
257f978d62 save session when we save a buffer
Implements enhancement #10712.

(cherry picked from commit cca365f26c)
2018-02-21 11:56:37 +01:00
Juergen Spitzmueller
90ca393c7f Localize items in view/update popup icons
Fixes: #11040
(cherry picked from commit 578cf77f6f)
2018-02-21 09:40:01 +01:00
Jean-Marc Lasgouttes
a2e1021aba Use parMetrics to access the par_metrics_ map
In cursorY, it is dangerous to access par_petrics_[0], since one does
not know whether metrics have been computed for this paragraph (which
may be off-screen).

It is safer to use parMetrics(0), that will compute the paragraph
metrics as needed.

Fixes bug #8120.

(cherry picked from commit a25b48f86c)
2018-02-20 15:02:35 +01:00
Juergen Spitzmueller
6ce83844dc Skip insets when checking for uncodable chars to paste.
Fixes paste of quote insets to ERT/chunk.

(cherry picked from commit 8f9b733e67)
2018-02-18 08:49:15 +01:00
Juergen Spitzmueller
a26173f171 Revove unused variable 2018-02-16 17:47:14 +01:00
Juergen Spitzmueller
d20de88953 Open intitle command explicitly also for passthru.
(cherry picked from commit 87960e3dd8)
2018-02-16 17:25:32 +01:00
Juergen Spitzmueller
da3dc1b61f Use TeXOnePar for the inpreamble layouts
This considers paragraph language and spacing (and simplifies the code)

(cherry picked from commit a2f886d526)
2018-02-16 17:25:06 +01:00
Juergen Spitzmueller
961b79975c Fix inpreamble styles.
(cherry picked from commit e55e9c842f)
2018-02-16 17:24:41 +01:00
Juergen Spitzmueller
bd879efaa8 Fix switch of language and line spacing in InTitle commands.
Fixes: #9332, #10849
(cherry picked from commit 49e3f8e830)
2018-02-16 17:24:00 +01:00
Juergen Spitzmueller
c0ef31d9b9 Recreate citation label after paste
Fixes: #10829
(cherry picked from commit 7e34e65943)
2018-02-16 17:14:28 +01:00
Pavel Sanda
25741ca5bd Oops, asInsetGrpahics is new to master. 2018-02-15 21:48:23 +01:00
Pavel Sanda
1713b53516 Cosmetics per JMarc's suggestions. 2018-02-15 20:42:54 +01:00
Pavel Sanda
e836cc0aac Unify graphics-groups inside marked block functionality.
Fixes #11026.

https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg203683.html
2018-02-15 20:42:36 +01:00
Jean-Marc Lasgouttes
61c5769e39 Fix ghost caret
This fixes a regression in e64ea357, where a test has been (badly)
tightened to avoid that two consecutive rows may be redrawn to get rid
of caret ghosts. The test prohibited empty rows from being redrawn.

Moreover, improve the test of cursor boundary to avoid the case where
cursor position is already 0.

Fixes bug #10952.

(cherry picked from commit 66c677b946)
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
be35ba31bf Fix compilation in monolithic mode
(cherry picked from commit 3aa10c8dba)
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
c677156938 Use a backing store on macOS
Qt on macOS does not respect the Qt::WA_OpaquePaintEvent attribute and
clears the widget backing store at each update. Therefore, we use our
own backing store in this case.

This restores a simplified version of the code that was removed at 06253dfe.

(cherry picked from commit 2316435f2f)
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
8af3077753 Make sure that rows are repainted when they get (un)selected
The bug is the following: when selecting several paragraphs quickly
enough, some rows do not get selected.This is a consequence of the
removal of row crc, which lead to not taking into account the
selection status of the row in the decision to repaint.

The solution chosen here is to add a Row::change() helper function to
modify row members. This will set the Row changed status whenever the
value of the member changes.

(cherry picked from commit ae60749f89)
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
9c8e3df86b Fixup ac4bcb12
Cursor at end of paragraph should be treated as if boundary was on.

(cherry picked from commit d01dd54bf1)
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
fa4fc6fc4d Avoid some caret ghosts
When the caret is at end of row, if may happen that it is drawn after
the end of the row. In this case caret blinking will not work
properly. This patch extends the row background on the left and right
by Inset::TEXT_TO_INSET_OFFSET. This is only a hack that will not work
if the caret has a ridiculous width like 6.

Additionally, introduce some (disabled) debug code that numbers the
rows on screen by painting order.

Finally, make the code that detects whether the caret was in a given
row more precise (take boundary into account).

Fixes (mostly, see above) bug #10797.

(cherry picked from commit e64ea3576c)
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
a71610b9d7 Remove row crc computation
This computation did not make sense anymore since we began to put the
contents in the Row object. The fact that it worked was a coincidence.

Instead, we set rows as changed() on creation and reset that once they
have been drawn. This will allow in the future for a finer definition
of what to redraw or not.

Also update the PAINTING_ANALYSIS document

(cherry picked from commit 9e2da4a3ea)
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
d2e15bd189 Store change bar information in row element
It is wrong to compute this at paint time. In general, painting a row
should not require any access to a paragraph object, but we are far
from there now.

(cherry picked from commit 4858bb3bb6)
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
4ecbff0019 Allow multiple calls to processUpdateFlags before redraw
The goal of this commit is to ensure that a processUpdateFlags call
that requires no redraw will not override a previous one that did
require a redraw.

To this end, the semantics of the flag argument is now different: its
value is now OR'ed with a private update_flags_ variable. This
variable is only reset after the buffer view has actually been
redrawn.

A new Update::ForceRedraw flag has been added. It requires a full
redraw but no metrics computation. It is not used in the main code
(yet), but avoids to compute metrics repeatedly in consecutive
processUpdateFlags calls.

The process is now as follows:
- if flags is just None, return immediately, there is nothing to do.
- the Force flag is honored (full metrics computation) and replaced
  with ForceDraw.
- the FitCursor flag is honored and removed from the flags.
- the SinglePar update is added if ForceDraw is not in flags and only
  the current par has been modified.

The remaining flags are only then added to the BufferView update
flags, and the update strategy is computed for the next paint event.

Finally the dubious call to updateMacros in updateMetrics has been
removed for performance reasons.

(cherry picked from commit 8d8988de47)
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
2b1b33189d Create new method GuiWorkArea::Private:::updateCaretGeometry
This replaces a showCaret/hideCaret pair and avoids an update.

Also remove an update() call in resizeBufferView: is is not necessary
since we are already in a pintEvent handler.

(cherry picked from commit add342d088)
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
6bd158dcba Improve the logic of caret repainting
For some reason the existing code only considered the bottom row that
contained the cursor. There is no need for that, and actually it
caused painting problems in nested insets.

Tweak the logic of repaint_caret_row_ a bit: there is no need for
repainting when there is currently no caret on screen.

(cherry picked from commit 764a153c69)
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
f6cbc08a7d Fix bad refresh when changing zoom level
Replace the tricky code in LFUN_SCREEN_FONT_UPDATE and replace it with
proper use of DispatchResult flags.

LFUN_BUFFER_ZOOM* does not need to call LFUN_SCREEN_FONT_UPDATE, since
it already does everything that is required.

(cherry picked from commit 9df59aac63)
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
7b99bf6a37 Do not presume what the defaults for a new QPainter are
(cherry picked from commit 275d306c73)
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
c43b6a9ecf Remember correctly pixel ratio used for painting
This avoids endless resize issues on HiDPI systems (e.g. Retina Mac).

Rename pixel_ratio_ to last_pixel_ratio_ to emphasize that this is a
cached value.

Inline needResize method to make the logic clearer in paintEvent.

(cherry picked from commit 6532e5104d)
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
a1579c583a Compute metrics when graphics is updated
Remove the old schedule_redraw_ mechanism that was only useful because
of our synchronous drawing code. Now that actual painting is
scheduled instead of forced, it becomes pointless.

Rename WorkArea::redraw(bool) to scheduleRedraw(bool), to show that
the drawing is not done right away.

In GuiView::updateInset, call scheduleRedraw(true), so that metrics
are correctly computed (this was the whole point of the exercise).

(cherry picked from commit a31d3dc67d)
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
9bb41f0943 Update insets position in cache in more cases
This patch makes sure that, every time a ParagraphMetrics has its
position set, the inset positions for the insets held by this
paragraph are remembered too.

This is complementary to BufferView::updatePosCache, but I do not have
hard evidence that this is required other than to increase robustness.
It may help in some cases when scrolling the document (scrollbar,
cursor up/down, page up/down).
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
94b1d04f2c Rename more instances of "cursor" to "caret"
Thanks to Pavel for the hint.
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
410605385f Remove workaround that is not necessary anymore.
This code was necessary to handle cases where the insets positions
were not yet in cache. This cannot happen anymore thanks to the
nodraw stage.
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
9ef52806f8 Make input methods support great again
This unbreaks input methods by splitting the part of the code that
does the actual drawing to a separate paintPreeditText() method which
is called from paintEvent().

The proper solution would have been to introduce the preedit string in
the Row object, like is done for completion, but this is too complex
to do at this point.

The only change in behavior is that now the commit string is inserted
in one fell swoop, intead of emulating a number of key events.
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
418bf09879 Cleanup and simplify WorkArea code
Rename cursor to caret to in order to avoid ambiguity. The caret is
now the blinking thing only.

Remove unused header contents, and some not so useful methods.

No intended change of behavior.
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
ef1d502070 Fix caret painting
The trick is to remember in BufferView what has been done at the
previous draw, so that the row that contained the caret can be
repainted if needed.

To this end, add an argument paint_caret to BufferView, although
painting the caret is not the job of the BufferView (at this point).

BufferView::needRepaint will act as an interface with
TextMetrics::drawParagraph to know whether the painting of a given
row should be forced.

Currently everything is done at the top row level, so that, if the
caret is in a large table, the whole table will have to be repainted.
It is not clear yet that this is necessary.
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
7b8b3e38a1 Do the actual drawing in the paint event
Historically, because of two-stage drawing, LyX has been painting on a
Pixmap, and this pixmap is copied to screen at paint event time.

Now that we have three-stage drawing, it is possible to delay the
painting to actual paint event and avoid the intermediate Pixmap.

Known bug: the cursor is never erased.
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
d222e0f48e three-stage drawing: add a nodraw stage
Normally the two stages of drawing are
1/ compute metrics of insets/rows/paragraphs/mathrow...
2/ draw the elements and cache their positions

Now the three stages are
1/ metrics
2/ nodraw: do not draw the elements, but cache their position
3/ draw the elements (and store again their position; it does not
   seems to hurt performance).

Revive the NullPainter: this replaces the setDrawingEnabled mechanism
with a painter that does nothing. The advantage is that updatePosCache
(renamed from setPosCache) does not need anymore to be invoked from
the frontend.

updatePosCache (the nodraw stage) is called at the end of
BufferView::updateMetrics.
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
9a1728c70a Implement buffer-anonymize more efficiently
The work is done now in Paragraph::anonymize().

Move the handling of the lfun to Buffer class.

Document the new feature in release notes.

(cherry picked from commit 1dba36c7ce)
2018-02-15 12:07:33 +01:00
Pavel Sanda
9966f098ea forgotten glitch 2018-02-15 11:55:51 +01:00
Pavel Sanda
624a6ed91d LFUN_DOC_ANONYMIZE -> LFUN_BUFFER_ANONYMIZE per JMarc's suggestion. 2018-02-15 11:49:21 +01:00
Pavel Sanda
08f6354bc9 Add LFUN_DOC_ANONYMIZE, quick fix for #7259.
Backport from master.
2018-02-15 11:47:10 +01:00
Jean-Marc Lasgouttes
2e1863b704 Implement display of roots more faithfully
This is a follow-up to 758de957.

- unify the metrics and drawing of \sqrt and \root using helper
  functions mathed_root_metrics and mathed_draw_root.

- compute the vertical spacing above the nucleus of the root following
  rule 11 of the TeXbook. In particular, it is different in inline and
  display style.

- draw the root glyph without hard-coded pixel values. Make the line
  width depend on the zoom.

more work is needed to implement properly rule 11:

- Ideally, we should use sqrt glyphs from the math fonts. Note that
  then we would get rule thickness from there.

- The positioning of the root MathData is arbitrary. It should
  follow the definition of \root...\of... in The Texbook in
  Apprendix B page 360.

Fixes bug #10814.

(cherry picked from commit 16af6e7c50)
(cherry picked from commit 6cb6f78ae9)
2018-02-15 11:34:00 +01:00
Jean-Marc Lasgouttes
1dc134fb60 Improve UndoGroupHelper and use it more
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.

(cherry picked from commit cd9e42dc35)
2018-02-15 10:36:17 +01:00
Jean-Marc Lasgouttes
51e80361b2 Better handling of multiple buffers in UndoGroupHelper
It may happen that the buffers are visited in order buffer1,
buffer2, buffer1. In this case, we want to have only one undo group
in buffer1. The solution is to replace buffer_ with a set<Buffer*>.

A use case among others is InsetLabel::updateReferences.

(cherry picked from commit cc7364dfc5)
2018-02-15 10:33:17 +01:00
Juergen Spitzmueller
bf94074114 Disable unsupported ref types in mathed.
Also repair prettyref in InsetMathRef.

Part of #9798

(cherry picked from commit 47e85b37eb)
2018-02-15 06:48:38 +01:00
Jean-Marc Lasgouttes
5f6c681b76 Handle properly top/bottom of inset with mac-like cursor movement
The correct behavior is to go to position 0 going up from first row,
and to end of row when going down on last row.

The targetx value of the cursor is not updated, which makes cursor
movement more natural.

Fixes bug #10701.

(cherry picked from commit 34285cc683)
2018-02-14 17:06:03 +01:00
Jean-Marc Lasgouttes
e11c8ba81b Disable and hide the pixmap cache feature 2018-02-14 10:12:11 +01:00
Richard Heck
0dfca93139 Fix crash when citeengine is unknown.
(cherry picked from commit 5ee3396459)
2018-02-12 23:31:42 -05:00
Juergen Spitzmueller
fe414fcdd8 Fix race condition in processFuncRequestQueue
The issue here was that the element was only removed from the queue
after the func request was processed, but within that process, other
function could access the queue, so the queue could even be empty
when this function finally wanted to remove the item.

Fixes: #10406.
(cherry picked from commit dadec50a18)
2018-02-10 18:32:03 +01:00
Enrico Forestieri
e43bf58223 Avoid an infinite loop
When pasting "\big" without any following delimiter, avoid
processing the same token again and again. For unknown reasons,
the delim docstring turns out to always be not empty: even when
it simply contains a '0' (no delimiter follows), its length is 1.

Fixes bug #11027.

(cherry picked from commit 8e8b3f6104)
2018-02-10 10:36:48 +01:00
Juergen Spitzmueller
2d923e4243 Fix child document regex in scanLogFile
Several problems:
* The regex failed at names such as 1_text_2_text.tex
  (returned "2_text.tex)
* The regex failed at names such as 12_text.tex
  (returned "2_text.tex)
* Masters with digits in the name (2018_text.tex) were
  tracked as their own children

(cherry picked from commit 398e026250)
2018-02-10 07:59:30 +01:00
Juergen Spitzmueller
04e995e807 tex2lyx: normalize bib and bst paths
Fixes: #7637
(cherry picked from commit 3cc98a9bf6)
2018-02-09 18:57:53 +01:00
Juergen Spitzmueller
af91405786 Consider class-provided citation engines
Do not attempt to load, nor allow to set, a different engine in this
case.

Fixes: #11022
(cherry picked from commit 2f6ada6644)
2018-02-09 09:50:43 +01:00
Juergen Spitzmueller
5549d3033f Reset cur.pit() when pasting into tables.
The number of paragraphs can change here, so pit() can become invalid.

Fixes: #9983
(cherry picked from commit 6e4e086900)
2018-02-09 09:37:51 +01:00
Juergen Spitzmueller
78911c7379 Revert "Mark follow-up paragraphs in a paragraph group as nested."
This reverts commit 70d580fea7.
2018-02-08 17:09:15 +01:00
Juergen Spitzmueller
4285438558 Add missing connection.
This activates the OK/Apply when a biblatex style file is changed
manually

(cherry picked from commit 6236bcb653)
2018-02-06 17:58:13 +01:00
Juergen Spitzmueller
14e0a27098 Enable CompressorProxy for all Workareas (incl. EmbeddedWorkarea)
This fixes the Advanced F&R.

(cherry picked from commit 5ce36019e5)
2018-02-03 09:43:36 +01:00
Jean-Marc Lasgouttes
19c90f3a89 Make sure to add at least one element in row if possible
breakRow should only produce an empty row when there is nothing left
in the paragraph.

Fixes bug #10996.

(cherry picked from commit 253b935f65)
2018-01-30 11:07:44 +01:00
Jean-Marc Lasgouttes
34c1b3c42c Remove 'premature optimization' that proved buggy
At some time it seemed like a good idea in breakRow() to return early
when the row was bound to be empty. It turns out that this creates two
symptoms:

* empty paragraphs will not have an end of paragraph marker

* since row width is not correctly computed in this case, caret ghosts
  can appear in master.

This commit removes the oprimization and replace the do {} while()
construct to a straightforward while() {}.

Related to bug #10952.

(cherry picked from commit 76f0a3dd4e)
2018-01-30 11:06:30 +01:00
Juergen Spitzmueller
275d5d30de Differentiate Buffer strings and GUI strings in citeengines
The former need to be translated to the buffer language, the latter to
the GUI language.

Fixes: #10946
(cherry picked from commit 5db4d712ef)
2018-01-30 08:21:21 +01:00
Richard Heck
bb30118ff4 Revert "Fix bug #11055."
This reverts commit 0be5ae123c.

Unintentionally committed. Sorry!!
2018-01-28 23:51:40 -05:00
Richard Heck
0be5ae123c Fix bug #11055.
See also https://marc.info/?l=lyx-devel&m=151709211602688&w=2.

(cherry picked from commit d3ee87eea2)
2018-01-28 23:46:39 -05:00
Juergen Spitzmueller
cf6ff2cac7 Properly communicate forced encodings
This is currently only relevant fo InsetListings, which falls back to
a fixed-width encoding under specific conditions. It is now possible
to query the inset about that and report the correct encoding in
DocIterator::getEncoding.

Addresses the second part of #10995

(cherry picked from commit f924ef2966)
2018-01-27 18:35:16 +01:00
Juergen Spitzmueller
463c994de2 Account for custom encoding in DocIteratior::getEncoding
Addresses #10995

(cherry picked from commit 7b169de401)
2018-01-27 18:34:51 +01:00
Juergen Spitzmueller
fdc98c3fa8 Make another GUI string translatable
Part of #10999.

(cherry picked from commit 6ed7bbbf7e)
2018-01-27 18:30:14 +01:00
Juergen Spitzmueller
47adfa661e Make GUI string translatable
Part of #10999

(cherry picked from commit 26755a015e)
2018-01-27 18:29:46 +01:00
Juergen Spitzmueller
d65eee3688 Use proper localization chain for Box special width/height
Fixes: #11000
(cherry picked from commit e2160ec960)
2018-01-27 18:25:52 +01:00
Jean-Marc Lasgouttes
f27d2cfa30 Revert "Remove 'premature optimization' that proved buggy"
This reverts commit 894ae19224.

Fixes bug 10996.
2018-01-27 12:18:25 +01:00