Commit Graph

28438 Commits

Author SHA1 Message Date
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
Jean-Marc Lasgouttes
a852423781 Revert "WIP: refactor Systemcall"
This reverts commit c8015878e1.

Committed by mistake obviously!
2022-10-28 18:04:45 +02:00
Jean-Marc Lasgouttes
6c2d4f9392 constify 2022-10-28 18:03:50 +02:00
Jean-Marc Lasgouttes
c8015878e1 WIP: refactor Systemcall
**WARNING; only compilation has been ested; even that does not work**

The goal of this commit is to use the list-based API to
QProcess::start, to avoid annoying syntax issues (see issues with
pasting from LaTeX).

* Create a new latexEnvironment() in filetools.h that returns a
  map<string, string> containing the variables and their values.

* Rewrite parsecmd() so that it returns a QStringList of tokenized parameters.

* Use this in startProcess. This is the part is is not finished yet.

Obviously, this will not be possible to get right for 2.4.0.
2022-10-28 17:21:33 +02:00
chillenb
22e5903bf3 adjust text display width in windowed mode 2022-10-27 17:49:43 +02:00
Jean-Marc Lasgouttes
4ce45a5bcd Remove unused method 2022-10-27 17:17:19 +02:00
Jean-Marc Lasgouttes
a559616cbd Revert "Always remove selection after cursor up/down"
This reverts commit 008a0825e8.

This commit was part of bug #12310. The goal was to remove the
selection when using "up" at the start of selection (so that the
cursor cannot move). Unfortunately, it creates navigation issues for
insets inside tabulars.

Since the fix was minor, the safest decision is to revert.

The part of ticket #12310 that resets selection with
char-forwars/backward when moving is not possible still works.

Fixes bug #12593.
2022-10-27 15:07:57 +02:00
Juergen Spitzmueller
b3b22b0c70 Sync with master 2022-10-26 10:52:21 +02:00
Jean-Marc Lasgouttes
fff28c5756 Always qualify calls to std::move()
This quashes a new warning in clang++ 15, when std::move() (the
one-parameter version) is used as simply move(). There is a strong
recommendation from WG21 to avoid that.

Details here: https://reviews.llvm.org/D119670

It might be that we should not use that many move()s. I am not
competent to decide on that.

I also used this occasion to get rid of a spacial casing for C++11
that does not seem necessary after all.
2022-10-21 14:11:36 +02:00
Juergen Spitzmueller
647c7b1ac3 GuiLog: don't miss package warnings for packages with dashes
(e.g. scrlayer-scrpage)
2022-10-16 12:08:21 +02:00
Juergen Spitzmueller
d4d4654d63 Only load subscript package with LaTeX < 2005/12/01 (#12387) 2022-10-13 16:05:03 +02:00
Juergen Spitzmueller
ac3562dbc9 Need cellvarwidth also in left-aligned cells if they use newlines (#12587) 2022-10-11 16:01:29 +02:00
Juergen Spitzmueller
2c72884f26 GuiLyXFiles: differentiate user and system folders 2022-10-09 16:13:48 +02:00
Juergen Spitzmueller
0e4ca9aa88 GuiLyXFiles: Hide empty categories on filtering (#12584) 2022-10-09 16:01:49 +02:00
Juergen Spitzmueller
5ee0ba6403 GuiLyXFiles: Visually distinguish folders from files (#12584) 2022-10-08 16:45:52 +02:00
Jean-Marc Lasgouttes
49fee942cf Fix inline completion prefix for macro insets
As it was, the prefix was empty when completion popups were disabled.

Related to bug #12581.
2022-10-08 14:22:18 +02:00
Jean-Marc Lasgouttes
786a6edb54 Disable completion when document is read-only.
Being able to insert completion in a read-only document is definitely
a bad idea.

This patch acts both on indication of completion and on insertion
itself.

Fixes bug #12582.
2022-10-08 12:52:05 +02:00
Yuriy Skalko
8f43f83ddf Show branches from master document in branch inset dialog 2022-10-07 19:00:37 +03:00
Jean-Marc Lasgouttes
8508c3fe04 Completion: handle undo in insets' insertCompletion methods
I mathed, undo should record the underlying inset on completion,
whereas in test recording the paragraph is enough.

Therefore the recordUndo() in GuiCompleter::tab is removed, and the
relevant recordUndo/recordUndoInset are used at the right places.

As a further cleanup, the parameter `finished' of
Text::insertCompletion is removed as it is useless.

Fixes bug #12581.
2022-10-05 09:48:01 +02:00
Scott Kostyshak
300160df1c Whitespace 2022-10-03 20:43:54 -04:00
Enrico Forestieri
65b4c3fcd2 Fix bug #12580
This amends [4a7a1935/lyxgit]. Before 4a7a1935 it was assumed
that a labeled row was also numbered. Hence, when unnumbering
a row a label was also deleted. We now have to do this explicitly.
2022-10-02 14:59:03 +02:00
Scott Kostyshak
725168baba Fix gcc-12 warning
From Kornel:

>  /usr2/src/lyx/lyx-git/src/Paragraph.cpp:1931:1: warning: control reaches end of non-void
>  function [-Wreturn-type]
>
> This is with gcc-12, compiled in debug mode.
2022-09-24 21:05:38 -04:00
Jean-Marc Lasgouttes
bbaebd15ce Fix line breaking at trailing space
With a string like "abc def [inset]", it should be possible to break
between the "def" and the inset. A case of interest is when "abc def "
is too long, but "abc def" is not.

To this end, tweak the test that look whether breaking was successful:
the right width to look at is nscp_width, the width without the final
space.
2022-09-23 18:31:10 +02:00
Jean-Marc Lasgouttes
3bba2ad150 vocabulary 2022-09-21 19:29:52 +02:00
Jean-Marc Lasgouttes
2abe771407 Fixup 572b06d6: reduce cache size for breakString
This was necessary only due to bug #12534.

Reduce the size from 10Mb to 1Mb. Profiling shows that the cache hit rate
is the same.
2022-09-21 19:10:57 +02:00
Enrico Forestieri
90551a03ac Amend f426470a
The synctex option can also be specified by a single dash and
any value different from zero will do.
2022-09-14 20:10:01 +02:00
Jean-Marc Lasgouttes
8319bdbbbe Unify wording for statistics
Use 'no blanks' uniformly.

Also remove separator in zoom menu.
2022-09-13 12:42:28 +02:00
Daniel Ramoeller
974534f28a Disentangle status bar and zoom menu
- Moves the zoom menu to the zoom value
2022-09-13 11:49:41 +02:00
Pavel Sanda
e0b1cc902c * doxy 2022-09-06 22:12:25 +02:00
Thibaut Cuvelier
0bda6950e4 MathML: amend 26300c565f as discussed in bug 12513
Contributed by lynx
2022-09-02 02:00:12 +02:00
Thibaut Cuvelier
5b405426f1 MathML: should display "Text" MathFont using proper <mtext> tag
Fixes bug 12397

Contributed by lynx
2022-09-02 01:57:06 +02:00
Thibaut Cuvelier
962785cb0f InsetTabular: fix a typo 2022-09-02 01:30:25 +02:00
Thibaut Cuvelier
8074b696bc InsetTabular: move more helper methods to private 2022-09-02 01:29:19 +02:00
Thibaut Cuvelier
89c203faa4 InsetTabular: replace a Boolean parameter to choose between XHTML and DocBook by an enum class
The only goal is to improve code readability: this enum class is strictly equivalent to a Boolean, with the same meaning as the previous is_xhtml arguments (arbitrary choice).
2022-09-02 01:26:30 +02:00
Thibaut Cuvelier
ff9f3c774e InsetTabular: move XML helper methods to private
They are not needed outside InsetTabular.
2022-09-02 01:26:30 +02:00
Thibaut Cuvelier
3637d6d408 DocBook: amend 50374e38e1
All table rows were generated in the same XML dialect, irrespectively of the caller context (XHTML or DocBook).
2022-09-01 23:33:56 +02:00
Thibaut Cuvelier
5e87cfbf4c Fix a warning related to comparing different signedness 2022-09-01 10:57:04 +02:00
Thibaut Cuvelier
92ba758441 LyXHTML: implement index ranges 2022-09-01 02:22:50 +02:00
Thibaut Cuvelier
2b177172f1 LyXHTML: implement multiple indices 2022-09-01 02:04:16 +02:00
Thibaut Cuvelier
f4b0cf9b59 DocBook: amend 34ea4080
@ for sorting is implemented at 34ea4080, but the user was still shown a warning (now removed).
2022-09-01 01:17:58 +02:00
Thibaut Cuvelier
35a752e6db DocBook: add test case for multiple indices 2022-09-01 01:17:58 +02:00
Jean-Marc Lasgouttes
337cc97174 Use auto const & when possible to avoid copies
In several range-based for loops, implicit copies are made. Remove
that when possible, and try to shut converity up otherwise.

Fixes issues found by coverity.
2022-08-30 17:31:37 +02:00
Juergen Spitzmueller
0515bfa989 Update stats display if a stat is (un)selected 2022-08-18 19:09:15 +02:00
Juergen Spitzmueller
fee10d2d0d Another inset font switch fix 2022-08-17 18:04:51 +02:00
Juergen Spitzmueller
96d9e748cf Polish status bar statistics 2022-08-17 14:59:50 +02:00
Juergen Spitzmueller
e6b93f7489 Load ucs before utf8x inputenc with recent ucs versions
Otherwise inputenc falls back to utf8 option, which breaks documents
2022-08-16 17:56:07 +02:00
Juergen Spitzmueller
f6fff878a7 fix compiler warning 2022-08-16 17:41:40 +02:00
Stephan Witt
f426470a54 Improved synctex support
- Add check for converter with active synctex support to check for synchronized output for activate forward search.
2022-08-13 14:20:03 +02:00
Stephan Witt
9686fe0c79 Improved synctex support
- Check the state of the synchronize TeX output option of the document to enable or disable the LFUN for forward-search.
- write synctex macro to TeX source not only for PdfLaTeX
2022-08-11 22:45:51 +02:00
Stephan Witt
7391ca961d Additional cursor position validation required to avoid an assertion in Text::selectWord 2022-08-11 22:35:58 +02:00
Pavel Sanda
5b50a97fd7 Add document statistics to statusbar.
https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg217810.html
2022-08-09 23:48:55 +02:00
Juergen Spitzmueller
c69da75dfc Use localized length strings also in space label/tooltip 2022-08-09 17:28:41 +02:00
Juergen Spitzmueller
9214f92599 Mode [un]locLengthString() methods to support/qstring_helpers 2022-08-09 17:27:53 +02:00
Juergen Spitzmueller
079bc8ca40 Localize display of glue lengths in dialogs 2022-08-09 09:44:12 +02:00
Juergen Spitzmueller
60b539e544 Rename function 2022-08-09 09:31:46 +02:00
Juergen Spitzmueller
1487b19803 Allow entering localized lengths with unit (#11852) 2022-08-08 18:35:48 +02:00
Stephan Witt
a89f2fd08c Make "open -a" implicit on macOS
Fix for bug #12570 - add simple check for app bundle name and prefix it with macOS open command if name matches
2022-08-08 10:36:46 +02:00
Juergen Spitzmueller
a8947aaad8 Amend 9e645a5cfc
Only show "System Default" if auto-open is available for the current
format.
2022-08-08 09:49:51 +02:00
Daniel Ramoeller
9e645a5cfc "System Default" viewer/editor option
Fix for bug #12571. More user friendly way to set the system default application aka "auto" option.
2022-08-08 09:18:39 +02:00
Juergen Spitzmueller
14d63f5be8 GuiGraphic: delimit "Scale in LyX" (1--1000%)
Larger values will eventually crash LyX (see #12353), 0 or negative
values make the image disappear in the workarea and impossible to edit.
2022-08-07 16:40:12 +02:00
Juergen Spitzmueller
6a2b220b8d Handle LFUN_FONT_DEFAULT is InsetTabular::Dispatch (fixes #12566) 2022-08-07 14:34:42 +02:00
Juergen Spitzmueller
75aaa8e22b Amend 4ba989000c
If the lfun argument already has a Flex: prefix (which is equivalent),
do not append one
2022-08-07 10:41:02 +02:00
Juergen Spitzmueller
4ba989000c Fixup cd83386363 (#12569) 2022-08-06 19:00:36 +02:00
Juergen Spitzmueller
8ac177f656 Fix font tracking at fontswitch_insets
(hopefully)
2022-08-06 17:29:40 +02:00
Pavel Sanda
6031666b01 another typo 2022-07-31 00:26:04 +02:00
Pavel Sanda
00bba01de9 whitespace 2022-07-31 00:24:33 +02:00