Commit Graph

44488 Commits

Author SHA1 Message Date
Pavel Sanda
d79637a88e Various python fixes suggested by pyupgrade.
Patch from Jose.
https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg217770.html
2022-07-31 00:36:51 +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
Pavel Sanda
130282a418 Doxy for zoom args in ui-toggle lfun. 2022-07-31 00:23:09 +02:00
Kornel Benko
95166772ee Amend 1dedd398: Adapt some tests to use unspecified unbind. 2022-07-27 20:27:59 +02:00
Jean-Marc Lasgouttes
1dedd39864 Allow to unbind without specifying the lfun
When unbinding a shortcut, it may happen that the exact definition of
the request is not known. A typical example it Tab, which is bound to
a complex command sequence.

In this case it is convenient to use the syntax
\unbind "Tab" "*"

To make this word, the special "*" value is translated to the
FuncRequest::unknown lfun and this value is considered specially in
several places.
2022-07-27 18:57:03 +02:00
Scott Kostyshak
11d5e31c65 Remove unneeded code
This code was triggering the following warnings:

  src/mathed/InsetMathHull.cpp:234:15: error: variable 'counters_to_save' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]
          const char * counters_to_save[] = {"section", "chapter"};
                       ^
  src/mathed/InsetMathHull.cpp:235:21: error: unused variable 'numcnts' [-Werror,-Wunused-const-variable]
          unsigned int const numcnts = sizeof(counters_to_save)/sizeof(char *);

The original code was put in at 645f9fdf (and the comment at 8a226ec4).

This commit amends a65e12d6.
2022-07-27 07:29:11 -04:00
Jean-Marc Lasgouttes
e0e548217e Do not redefine \jobname for previews
This reverts the fix for #9627, with the agreement of original reporter.

Fixes preview of citation insets.
2022-07-27 12:42:10 +02:00
Jean-Marc Lasgouttes
20d5851fb7 Regenerate equations previews when their numbering changes.
Time will tell whether this is too expensive (because most equations
after this on will change too, unless equations are numbered by
section).

Related to bug #11535.
2022-07-26 23:16:41 +02:00
Jean-Marc Lasgouttes
a65e12d6f3 Reimplement support for numbering of equation previews
This patch simplifies and fixes the generation of previews with
numbering. Instead of saving the counter values (which is complicated
and error prone), the \thequation macro is set to the numbers_ string
which has been computed by updateBuffer for screen display.

Harcoding the number in the formula means that two equations with
different numbers have different previews, which is the subject of the
bug.

The special code for saving counters in updateBuffer and outputing
them in preparePreview from 645f9fdf (ticket #6894) is removed and
replaced by this simpler approach.

This fixes ticket #11535.
2022-07-26 22:47:53 +02:00
Jean-Marc Lasgouttes
a42f7ea7cd Rename eolString() to eol() and pass a MathTeXStream parameter
This is completely equivalent, but will allow in eol() to determine
whether one is preparing a preview.

Related to bug #11535.
2022-07-26 22:21:44 +02:00
Jean-Marc Lasgouttes
01da93521d Fixup 1d08af62: unused variable 2022-07-26 00:54:54 +02:00
Jean-Marc Lasgouttes
1d08af621d Implement on screen numbering for Subequation module
The module subequation allows to number equations in the "Subfigure"
inset to be numbered (1a), (1b), (1c), etc.

To implement this on screen, we need to redefine temporarily the
"equation" counter to use this different numbering.

To this end, implement Counters::copy method that can be used to
backup full counter definitions.

Fixes bug #12567.
2022-07-26 00:49:09 +02:00
Jean-Marc Lasgouttes
f5c7acb140 Revert "Implement on screen numbering for Subequation module"
This reverts commit c6f35b6ad6.
2022-07-26 00:47:28 +02:00
Jean-Marc Lasgouttes
1fc08f57e1 Revert "Rename eolString() to eol() ans pass a MathTeXStream parameter"
This reverts commit 2db682b97e.
2022-07-26 00:46:13 +02:00
Jean-Marc Lasgouttes
7261fa9448 Revert "Reimplement support for numbering of equation previews"
This reverts commit f4da29306f.
2022-07-26 00:45:57 +02:00
Jean-Marc Lasgouttes
f0c180a29b Improve comment 2022-07-26 00:44:16 +02:00
Jean-Marc Lasgouttes
f4da29306f Reimplement support for numbering of equation previews
This patch simplifies and fixes the generation of previews with
numbering. Instead of saving the counter values (which is complicated
and error prone), the \thequation macro is set to the numbers_ string
which has been computed by updateBuffer for screen display.

Harcoding the number in the formula means that two equations with
different numbers have different previews, which is the subject of the
bug.

The special code for saving counters in updateBuffer and putputing
them in preparePreview from 645f9fdf (ticket #6894) is removed and
replaced by this simpler approach.

This fixes ticket #11535.
2022-07-26 00:19:20 +02:00
Jean-Marc Lasgouttes
2db682b97e Rename eolString() to eol() ans pass a MathTeXStream parameter
This is completely equivalent, but will allow in eol() to determine
whether one is preparing a preview.

Related to bug #11535.
2022-07-26 00:19:07 +02:00
Jean-Marc Lasgouttes
c6f35b6ad6 Implement on screen numbering for Subequation module
The module subequation allows to number equations in the "Subfigure"
inset to be numbered (1a), (1b), (1c), etc.

To implement this on screen, we need to redefine temporarily the
"equation" counter to use this different numbering.

To this end, implement Counters::copy method that can be used to
backup full counter definitions.

Fixes bug #12567.
2022-07-25 23:53:46 +02:00
Jean-Marc Lasgouttes
ad3e6c69b2 Export ' as ’ in HTML
This is similar to what LaTeX does in its output.

See the (long) discussion in ticket #11244.
2022-07-25 23:07:23 +02:00
Jean-Marc Lasgouttes
2203078111 Fix flicker due to changing metrics while selecting with the mouse
This patch has been backported from the lyx-unstable branch
https://gitlab.com/gadmm/lyx-unstable/-/commit/9d7ed42389ba

Actual author is Guillaume Munch.

Fixes bug #8951.
2022-07-25 23:04:08 +02:00
Daniel Ramoeller
f5e66ba3c2 Improved layout adoption on paste
The layout from the paste content is adopted only if
- the paragraph is empty (ie. empty after the selection has been
  erased) and Standard or Plain Layout, or
- empty and multiple lines are pasted, or
- multiple lines are pasted at the beginning of a paragraph

As for what other applications do:
- MS Word decides the adoption of a layout depending on whether the end of line
character is copied
- Libre Writer adopts the paste content layout only if the paragraph is empty
(otherwise it makes *all* pasted paragraph the target layout)

In LyX, as in Libre Writer, one cannot copy the end of line character by
selecting a single line. However, the Libre Writer solution is problematic
because one always has to make sure that a paragraph is in Standard layout if
one wants to paste several lines with their source layout. The implemented
behaviour differs from Libre Writer in that the source format is kept when end
of line characters are pasted, i.e. several lines are pasted, and hence does
what MS Word does in that situation.

Fix for bug #11023: Copy and paste from one list into another often leads to
undesired result.
2022-07-25 22:56:00 +02:00
Jean-Marc Lasgouttes
61d68d05bd Add proper extension as needed in Save as and Export
Introduce the new FileName method ensureExtension, which does the following:
* if the extension is already correct (in a case-insensitive way), do nothing.
* if it is not correct, add the extension to the file name.

This is different from changeExtension that will fail in a case where
the file contains dots, but not a real extension, like newfile2.1.

Use this new method in renameBuffer() and exportBufferAs().

Fixes bug #11008.
2022-07-25 22:52:07 +02:00
Daniel Ramoeller
d7eecccfd4 Fix for blue rectangles on math Style icon
Fix for bug #12103.
2022-07-23 17:15:50 +02:00
Jean-Marc Lasgouttes
7823d3b01b Fix display of bindings for StaticMenuButton
This requires to add a parameter to GuiToolbar::addItem so that it is
possble to make a difference between toolbar buttons and menu items.

The long-term solution is to rely on the menu backend for such things.

Fixes bug #12004.
2022-07-19 20:58:06 +02:00
Jean-Marc Lasgouttes
23a27e90ba Revert "Fix display of bindings for View-other-formats dynamic toolbar menu"
This reverts commit e2e7794c7e.
2022-07-19 13:36:12 +02:00
Jean-Marc Lasgouttes
e2e7794c7e Fix display of bindings for View-other-formats dynamic toolbar menu
Do it the same way as in menus. Also remove the tooltip, which is not used.

Fixes bug #12004.
2022-07-19 13:30:31 +02:00
Jean-Marc Lasgouttes
cd83386363 Disable flex-insert when inset does not exist
This is useful when adding icons to the toolbar that insert insets not
availble by default (but provided by a module).

Fixes bug #11690.
2022-07-19 12:31:50 +02:00
Jean-Marc Lasgouttes
96e7fcd4e0 When pasting as LaTeX, honor textclass and modules
There are several small parts that are needed here:

* Implement LayoutModuleList::asString() that returns a comma-separated
  list of modules.

* in Converter::convert(), handle the new tokens $$c for the current
  textclass and $$m for the list of modules.

* in Buffer::importFile(), pass the current buffer as parameter instead
  of nullptr.

* in pasteClipboardText(), copy the parameters of the current buffer to
  the internal one used for importation, so that the textclass and
  modules information is available to convert().

* finally, modify configure.py to pass "-c $$c -m $$m" to tex2lyx for
  the latexclipoard->lyx converter.

Fixes bug #11312.
2022-07-19 00:28:28 +02:00
Kornel Benko
f771f77c67 Amend 2b24c03e: Do not override (Back)Tab in Adv F&R when it is useful
While testing we want to override 'Tab' in Adv F&R.
Unbinding 'Tab' seems to help, thanks to JMarc for the suggestion.
2022-07-18 22:55:03 +02:00
Jean-Marc Lasgouttes
efef533d91 Fix forcing of text class for LaTeX snippets
When the input document is not a full document, make sure that the -c
is taken into account.
2022-07-18 19:40:41 +02:00
Jean-Marc Lasgouttes
2b24c03e8b Do not override (Back)Tab in Adv F&R when it is useful
In Advanced Find and Replace, Tab can be used to move the focus from
Search field to the replace field. This is inconvenient when Tab has
another use, like completion.

To fix this, check that the function bound to Tab is disabled before switching focus.

The same is done for BackTab.

Fixes bug #11114.
2022-07-18 12:02:28 +02:00
Daniel Ramoeller
3305b9301e Properly draw changed Captions
Fix for bug #12555.
2022-07-17 15:11:45 +02:00
Jean-Marc Lasgouttes
45191d04f9 Rename Row::right_boundary to end_boundary
This is more correct for RtL paragraphs.
2022-07-16 18:13:47 +02:00
Jean-Marc Lasgouttes
31579edd76 Fixup b2a7b715a2: At least one 'HFill' should remain in the doc. 2022-07-16 00:33:55 +02:00
Enrico Forestieri
6355fceafc Update it.po 2022-07-14 20:59:47 +02:00
Jean-Marc Lasgouttes
045aff3d9f Avoid duplicates in minibuffer history
The removal of duplicates is done in LastCommandsSection::add and uses
the erase-remove idiom for performance.

Most of the patch is a cleanup of GuiCommandBuffer:

* remove history_ member, that was a copy of the session lastcommands
  vector. Use instead a wrapper history() around it and a addHistory
  wrapper for adding new entries.

* Make sure that there is only one place where commands are added to
  history. The code used to maintain a list for interactive editing,
  and a list for saving the session. They could be different in terms
  of leading/trailing spaces.

* [unrelated] remove command_ member, which is just a copy of
  LyXAction list of commmands. Use directly lyxaction instead.
2022-07-13 19:53:08 +02:00
Enrico Forestieri
4a7a19352c Fix bug #12561
In mathed it is assumed that a labeled line is also implicitly numbered.
However, latex allows to label an equation without numbering it.
The label is then assigned the value of a nearby numbered one.
This commit drops the above mathed assumption in order to allow to import
valid latex code with a labeled but not numbered equation line.

The screen representation omits the line number and encloses the label
in square brackets for further differentiation. However, it is still not
possible to label an equation without numbering it using the GUI.
2022-07-13 19:11:03 +02:00
Jean-Marc Lasgouttes
f71a11f693 Fixup 95da2707: document getAlias. 2022-07-13 13:10:57 +02:00
Kornel Benko
7f32b02306 Amend 95da2707 for Cmake: Check for icon aliases 2022-07-13 09:36:45 +02:00
Scott Kostyshak
c63e9d4caa Style 2022-07-12 17:55:04 -04:00
Daniel Ramoeller
95da270711 Check for icon aliases
The aliases are defined by a file in the (system or user) image
directory. The format is pretty simple: each line is like
  <str1> <str2>
Where every instance of <str1> will be replaced with <str2>.

Fixes bug #12509.
2022-07-12 23:35:48 +02:00
Scott Kostyshak
21eb2c4f74 Allow negative values for counters
enumi, for example, can be negative.
2022-07-09 16:40:22 -04:00
Kornel Benko
e481981dea Update sk.po 2022-07-05 08:58:40 +02:00
Scott Kostyshak
74dfb2e323 Amend 2022-07-04 14:36:03 -04:00
Scott Kostyshak
7281b8d50d ctests: log an upstream issue that wasted time 2022-07-04 14:29:07 -04:00
Jean-Marc Lasgouttes
2104ae8068 Fixup c30b0aac: protect against bad recursion
Adding this particular line created bad redraw interactions. See
thread on lyx-devel here:
https://marc.info/?l=lyx-devel&m=165648365808777&w=2

The code is reorganized a bit:

- the part of updateGUI() that (en|dis)abled elements is not moved to
  updateBottons ; the rest is renamed updateWorkAreas()

- only updateButtons is called now in eventFilter

- finally the recursion curse is fixed now in updateWorkAreas() by
  setting the old_buffer value _before_ calling copy_params. This
  avoid recursion if some bad update were to happen again.
2022-07-02 13:10:16 +02:00
Scott Kostyshak
8c8f558c4d ctests: log issue triggered by microtype update
These tests were already inverted at 93066f13.
2022-07-01 10:18:40 -04:00
Jean-Marc Lasgouttes
4c6dce1b0b Remove useless message (and avoid endless loop)
When changing the document class, the message "Converting document to
new document class..." is shown in minibuffer. This message leads to
weird GUI update interactions with the FindAndReplace panel, and
ultimately infinite loops. It would only be useful if the conversion
took a long time.

See this thread for rreference:
https://marc.info/?l=lyx-devel&m=165648365808777&w=2

Therefore, just remove it.
2022-06-30 12:30:01 +02:00