Commit Graph

28403 Commits

Author SHA1 Message Date
Juergen Spitzmueller
b77b9d1565 Start to cleanup mathes/BUGS (#3493)
This one is implemented.
2022-11-22 09:59:01 +01:00
Juergen Spitzmueller
869247b617 Add button to stop processing
(rather than having it stop by clicking on the spinner)
2022-11-21 18:56:28 +01:00
Enrico Forestieri
1ac2dc2082 Do not allow nesting macro names in macro names
LyX removes a single backslash when it is inserted in a
macro name by the keyboard. However if it is followed by
another character before moving the cursor, it is retained
causing an assertion (bug #12601).
2022-11-21 18:24:29 +01:00
Jean-Marc Lasgouttes
593bfe248a Substack should not be allowed to change columns
Disable the arguments append-column and delete-column of tabular-features.

The code is taken from InsetMathCases, with some changes
* no need to record undo here
* in dispatch, return is prefered to break, since we do not want to invoke
  InsetMathGrid::doDispatch.
Propagate these changes to InsetMathCases.

Cleanup of the InsetMathCases error messages to fit with other parts
of the code.

The handling of tabular-features in mathed needs to be unified somehow.

Based on a commit from lynx <lorenzobertini97@gmail.com>

Part of bug #12590.
2022-11-21 12:08:17 +01:00
Enrico Forestieri
a11780b59f Do not allow pasting backslashes in macro names
Backslashes are not allowed in macro names and LyX
enforces this by not allowing entering them by keyboard.
However, it was possible to paste them and this may cause
crashes (see bug #12596).
2022-11-20 19:01:38 +01:00
Juergen Spitzmueller
e26a60edef Regenerate previews after zoom (#11919) 2022-11-20 18:18:59 +01:00
Thibaut Cuvelier
f3862130cf Amend 48d9d01a: remove debug output 2022-11-20 16:19:31 +01:00
Thibaut Cuvelier
48d9d01a82 InsetIndex: when building the IndexNode tree, ignore IndexEntry when empty
The previous code always considered it had at least one term (an assumption that is wrong at least for doc/de/Math.lyx).
2022-11-20 14:49:14 +01:00
Thibaut Cuvelier
77f0fbdc9a InsetIndex: enable escaping for terms in the index
The previous code explicitly disabled it and this behaviour caused problems (like "A&A" being output as-is, which is wrong in HTML: it should be "A&amp;A").
2022-11-20 00:19:53 +01:00
Thibaut Cuvelier
e9f21f2e83 InsetIndex: improve formatting of resulting XHTML
There was no line feed before the closing </li> for entries, which was inconsistent with the other block tags.
2022-11-20 00:14:43 +01:00
Pavel Sanda
d984730235 Drop C++17 if init-statements to support older compilers. 2022-11-16 21:23:01 +01:00
Jean-Marc Lasgouttes
94e7421a0a Fix compilation with gcc 4.9
It appears that gcc 4.9 does not implement the following part of C++11:
https://cplusplus.github.io/CWG/issues/1148.html

Therefore, we have to use a special case in C++11 mode that does an
explicit std:move.

With recent compilers (gcc >= 9), this leads in C++11 mode to a warning:

MetricsInfo.cpp: In member function ‘lyx::Changer lyx::MetricsBase::changeFontSet(const string&)’:
../../master/src/MetricsInfo.cpp:83:13: warning: redundant move in return statement [-Wredundant-move]
   83 |  return move(rc);
      |         ~~~~^~~~
MetricsInfo.cpp:83:13: note: remove ‘std::move’ call

Partly reverts commit fff28c57.
2022-11-16 17:49:52 +01:00
Jean-Marc Lasgouttes
12bff77722 Merge branch 'breakspace'
This branch improves handling of spaces on display (see #10117):
* caret is correctly shown in the middle of double spaces in justified rows;

* sequence spaces are correctly shown at the end of rows before
  automatic row breaks.

Moreover, this branch:
* streamlines the code that handles spaces in row breaking

* improves display in Qt4 : although the improvements outlined above
  are not present in Qt4 for monospaced fonts, some dsplay glitches
  are resolved.

* improves performance for very long paragraphs (#12598).
2022-11-16 10:22:11 +01:00
Juergen Spitzmueller
5bf7f938a4 Fix tex2lyx corner case (#12537) 2022-11-11 08:12:14 +01:00
Jean-Marc Lasgouttes
50e1bdf320 (almost) Fix Qt4 support
When is it detected that our zero-width characters are not really
zero-width, avoid to use them altogether. Currently, this is known to
happen in Qt4 with monospace fonts.

This allow to remove the special Qt4 code in breaskString_helper.

Related to bug #10117.
2022-11-10 17:27:45 +01:00
Jean-Marc Lasgouttes
23cd38bc1c Use TextLayoutHelper in x2pos and pos2x
This leads to substantial code simplification.

No intended behavior change.

Related to ticket #10117.
2022-11-10 16:13:29 +01:00
Jean-Marc Lasgouttes
7fdc604606 Refactor GuiFontMetrics::getLayout
This allows to create a new version that takes an already built
TextLayoutHelper struct as parameter.

No intended change.

See discussion in bug #10117.
2022-11-10 16:13:28 +01:00
Jean-Marc Lasgouttes
201c95a76e Handle multiple spaces at row break
In order to work around the Qt row breaking algorithm, which considers
multiple spaces as one at QTextLine break, we insert word_joiner unicode
characters beteween each pair of spaces.

The TextLayoutHelper class makes it easy to handle that.

Update Row::Element::rtrim() to only remove one space at row end.

Update support::countExpanders() to count all spaces, without special
handling for consecutive ones.

Fixes bug #10117.
2022-11-10 15:21:02 +01:00
Jean-Marc Lasgouttes
a48efa03b1 Introduce a struct to handle docstring <-> QString index translation
This new code allows to get rid of some hardcoded stuff and will be a
foundation for handling of consecutive spaces.

This code can be used in the future for getTextLayout, x2pos, and
pos2x in order to streamline code. Actually some features as the naked
parameter are here to prepare for this second set of changes.

No change intended. The modified code is much clearer, though.

Related to bug #10117.
2022-11-10 12:06:15 +01:00
Jean-Marc Lasgouttes
a99f76477d Revert "Fixup 572b06d6: reduce cache size for breakString"
10MB cache is not so large after all, and it can be helpful with
Scott's perverse examples.

This reverts commit 2abe771407.

Fixes part of bug #12598.
2022-11-08 00:12:40 +01:00
Jean-Marc Lasgouttes
ec151de2cc Fix expensive thinko: operator++ returns a reference, not a copy
This accounts for 45% of the row breaking time on the (huge) paragraph
of the MWE in bug #12598.

Fixes part of bug #12598.
2022-11-08 00:12:40 +01:00
Jean-Marc Lasgouttes
90ea508111 Fix pasting as LaTeX in documents with no modules
When there is no module, the old code would invoke tex2lyx with option
 -m
instead of
 -m ""
and an error would ensue.

This is because the QProcess command line parser used in Systemcall is
broken and does not recognize empty parameters as such. The solution
is to rewrite our parsecmd() parser to generate a list of parameters.
This is post-2.4.0 work.

The workaround used here is:

- set the list of modules to "," when it should be empty. In effect,
  this is a list of two empty modules.

- change tex2lyx to accept empty module names and ignore them; this is
  good in terms of robustness anyway.

Additionally, when there is no receiving buffer, set the defaults as
the BufferParams defaults instead of empty (this is cleaner, but
should not make a difference in practice).

In the long term, we should switch to use the QStringList-based API of
QProcess in Systemcall (see QTBUG-80640).
2022-11-06 13:20:02 +01:00
Scott Kostyshak
378c19bfc2 Guard some debug code
Amend f352a375 and 3bf1b97a.
2022-11-05 14:35:27 -04:00
Juergen Spitzmueller
3bbce7f24a Introduce index-tag-all lfun
This is a convenience function for indexing. It adds a copy of the
index inset under cursor after any word in the buffer that is equal
(case-insensitively) to the word preceding the index inset.

The function can be easily used to generate bad indexes (and I warn
about that in the UserGuide), but if used with care, it can also be
extremely convenient.
2022-11-05 18:39:33 +01:00
Daniel Ramoeller
89394bcd0f Show suggestions containing the input in the command buffer
Previously, only the suggestions starting with the current input were
shown.

Contains the following minor improvements:
- Add space to indicate when only one suggestion is found

- Select first item in suggestion-list in order to make selecting with
  arrow keys more intuitive

- Fix selection with Shift+Up/Down in text-field

Fix for bug #12572.
2022-11-04 22:27:31 +01:00
Jean-Marc Lasgouttes
fad170be1a New lfun to copy index insets from ToC
The new function inset-insert-copy can only be invoked from the ToC.
It is currently only implemented for Index inset.

It is a special lfun because Inset::dispatch is called directly from
the ToC widget with cursor pointing to the inset, whereas the patch
happens in the workarea at caret position. This function cannot be
called directly.

Add an entry for this function in the toc context menu.

Fixes bug #4582.
2022-11-04 21:52:46 +01:00
Jean-Marc Lasgouttes
d2f05b9e6f When Inset::dispatch is called from TOC, process screen flags
This is needed because we are not using the complete dispatch
machinery here.

Part of bug #4582.
2022-11-04 21:46:32 +01:00
Jean-Marc Lasgouttes
0b27eb7deb Introduce new function copyInsetToTemp
This is a version of copyInset that does touch the cut stack and the X
selection.

Part of bug #4582.
2022-11-04 21:44:24 +01:00
Jean-Marc Lasgouttes
2c53f0315e Fix another use of unqualified std::move 2022-11-04 21:36:43 +01:00
Kornel Benko
2333af615d Amend 9be6a425, Workaround for advanced search in 'uncover'-inset.
Use getInset(i)->toString() instead of getInset(i)->plaintext()
if searching, so that we get the option of 'uncover' visible to the search engine.
2022-11-04 15:34:49 +01:00
Juergen Spitzmueller
68e268e117 Add some options to index context menu 2022-11-04 11:29:56 +01:00
Juergen Spitzmueller
55870df5c7 Do not \protect stuff in index when we postpone the index
\protect us not needed here and affects sorting
2022-11-04 08:32:34 +01:00
Juergen Spitzmueller
d41e0c9231 Fix page range without page format 2022-11-04 07:57:56 +01:00
Juergen Spitzmueller
975f304185 Indicate see[also] refs in label and outliner 2022-11-02 15:56:59 +01:00
Juergen Spitzmueller
293b8dbe67 Do not unnecessarily reset the outliner to TOC on internal model changes
The activated() signal is only issued on user changes, what we want here,
not internal model changes (as with currentIndexChanged())
2022-11-02 12:33:20 +01:00
Juergen Spitzmueller
b51f1f7800 Remove wrong count comment 2022-11-02 10:46:52 +01:00
Kornel Benko
9be6a425df Workaround for advanced search in 'uncover'-inset.
Allows for matches inside style Uncover if used
	Settings->Adhere to search string formatting
This does not cover all of #12594 though.
2022-11-02 10:33:29 +01:00
Juergen Spitzmueller
5a53a5f608 Fix output of subentry with sortkey 2022-11-01 11:55:57 +01:00
Juergen Spitzmueller
fd5adacef2 Handle empty index subentries (#7820) 2022-11-01 10:20:50 +01:00
Thibaut Cuvelier
3bf1b97ae5 InsetIndex: hide printTree behind a LYX_INSET_INDEX_DEBUG flag
The change ensures that the function is not seen by the compiler when
the debug mode is not enabled. The flag is not set by default, because
it might have a significant performance impact for large indices.

The reason for the flag is that the default configuration under Linux
forbids the definition of unused functions.
2022-11-01 00:00:37 +01:00
Juergen Spitzmueller
3c488c22e1 Update tex2lyx tests 2022-10-31 21:11:07 +01:00
Juergen Spitzmueller
ca89c6c18e Typo 2022-10-31 07:52:11 +01:00
Juergen Spitzmueller
077ccf905d Rename subindex to subentry
Makes more sense, and distinguishes it better from printsubindex
2022-10-31 06:51:38 +01:00
Juergen Spitzmueller
fba3dace9e Display subinsets in inset button and outliner 2022-10-31 06:04:13 +01:00
Juergen Spitzmueller
9dc9fa68ce Enter subindex on Enter in index 2022-10-31 05:25:04 +01:00
Juergen Spitzmueller
874f559bc7 Add last missing bit to insetindexmacros: file format change and lyx2lyx
The feature is now ready for primetime!
2022-10-29 15:11:11 +02:00
Juergen Spitzmueller
e39c755b85 Enable pagination property with inset sortkey 2022-10-29 12:48:45 +02:00
Juergen Spitzmueller
3a949b32f0 Merge branch 'master' into features/indexmacros 2022-10-29 11:42:14 +02:00
Juergen Spitzmueller
6415afc1fe Minor improvements to the screen width UI
* fix order of input and unit widgets
* remove redundant "Screen used" label
* Add tooltip
2022-10-29 11:17:22 +02:00
Scott Kostyshak
172e544e2c Whitespace 2022-10-28 18:28:31 -04:00