[LyX/master] Merge branch 'master' of git.lyx.org:lyx

2023-07-21 Thread Juergen Spitzmueller
commit c3e0ae4bfdf7e718f0048cf73df9ca3002cd65a6
Merge: 07c2440 f31bf0d
Author: Juergen Spitzmueller 
Date:   Fri Jul 21 09:09:30 2023 +0200

Merge branch 'master' of git.lyx.org:lyx

 development/FORMAT |3 +
 po/sk.po   |  106 
 src/Cursor.cpp |6 +-
 3 files changed, 104 insertions(+), 11 deletions(-)
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] de.po

2023-07-21 Thread Juergen Spitzmueller
commit 07c2440a2bb675308ea32c441642ca8691c0f607
Author: Juergen Spitzmueller 
Date:   Thu Jul 20 16:47:19 2023 +0200

de.po
---
 po/de.po |  194 +
 1 files changed, 105 insertions(+), 89 deletions(-)

diff --git a/po/de.po b/po/de.po
index 73d962e..138eda6 100644
--- a/po/de.po
+++ b/po/de.po
@@ -94,8 +94,8 @@ msgid ""
 msgstr ""
 "Project-Id-Version: LyX 2.4git\n"
 "Report-Msgid-Bugs-To: lyx-de...@lists.lyx.org\n"
-"POT-Creation-Date: 2023-07-20 15:23+0200\n"
-"PO-Revision-Date: 2023-07-20 15:31+0200\n"
+"POT-Creation-Date: 2023-07-20 16:46+0200\n"
+"PO-Revision-Date: 2023-07-20 16:47+0200\n"
 "Last-Translator: Juergen Spitzmueller \n"
 "Language-Team: German \n"
 "Language: de\n"
@@ -14795,327 +14795,343 @@ msgstr "Unterbeispiel-Vorspann"
 msgid "Subex. Preamble"
 msgstr "Unterbsp.-Vorspann"
 
-#: lib/layouts/linguistics.module:171
+#: lib/layouts/linguistics.module:166
+msgid "Example Postamble"
+msgstr "Beispiel-Nachspann"
+
+#: lib/layouts/linguistics.module:169
+msgid "Ex. Postamble"
+msgstr "Bsp.-Nachspann"
+
+#: lib/layouts/linguistics.module:172
+msgid "Subexample Postamble"
+msgstr "Unterbeispiel-Nachspann"
+
+#: lib/layouts/linguistics.module:175
+msgid "Subex. Postamble"
+msgstr "Unterbsp.-Nachspann"
+
+#: lib/layouts/linguistics.module:184
 msgid "Interlinear Gloss (2 Lines)"
 msgstr "Interlinear-Glosse (2 Zeilen)"
 
-#: lib/layouts/linguistics.module:173
+#: lib/layouts/linguistics.module:186
 msgid "Gloss"
 msgstr "Glosse"
 
-#: lib/layouts/linguistics.module:189 lib/layouts/linguistics.module:245
+#: lib/layouts/linguistics.module:202 lib/layouts/linguistics.module:258
 msgid "Gloss options"
 msgstr "Glossen-Optionen"
 
-#: lib/layouts/linguistics.module:190 lib/layouts/linguistics.module:246
+#: lib/layouts/linguistics.module:203 lib/layouts/linguistics.module:259
 msgid "Gloss Options|s"
 msgstr "Glossen-Optionen"
 
-#: lib/layouts/linguistics.module:191
+#: lib/layouts/linguistics.module:204
 msgid "Add digloss options here"
 msgstr "Fügen Sie hier digloss-Optionen ein."
 
-#: lib/layouts/linguistics.module:194 lib/layouts/linguistics.module:195
-#: lib/layouts/linguistics.module:250 lib/layouts/linguistics.module:251
+#: lib/layouts/linguistics.module:207 lib/layouts/linguistics.module:208
+#: lib/layouts/linguistics.module:263 lib/layouts/linguistics.module:264
 msgid "Sentence Comment"
 msgstr "Kommentar zum Satz"
 
-#: lib/layouts/linguistics.module:196 lib/layouts/linguistics.module:252
+#: lib/layouts/linguistics.module:209 lib/layouts/linguistics.module:265
 msgid "Add an optional sentence comment here"
 msgstr "Geben Sie hier optional einen Kommentar zum glossierten Satz ein"
 
-#: lib/layouts/linguistics.module:200 lib/layouts/linguistics.module:201
+#: lib/layouts/linguistics.module:213 lib/layouts/linguistics.module:214
 msgid "Interlinear Gloss"
 msgstr "Interlinear-Glosse"
 
-#: lib/layouts/linguistics.module:202
+#: lib/layouts/linguistics.module:215
 msgid "Add the inter-linear gloss here"
 msgstr "Geben Sie hier die Interlinear-Glossierung ein"
 
-#: lib/layouts/linguistics.module:209 lib/layouts/linguistics.module:210
+#: lib/layouts/linguistics.module:222 lib/layouts/linguistics.module:223
 msgid "Gloss Comment"
 msgstr "Kommentar zur Glossierung"
 
-#: lib/layouts/linguistics.module:211 lib/layouts/linguistics.module:267
-#: lib/layouts/linguistics.module:282
+#: lib/layouts/linguistics.module:224 lib/layouts/linguistics.module:280
+#: lib/layouts/linguistics.module:295
 msgid "Add an optional gloss comment here"
 msgstr "Geben Sie hier optional einen Kommentar zur Glossierung ein."
 
-#: lib/layouts/linguistics.module:215 lib/layouts/linguistics.module:286
+#: lib/layouts/linguistics.module:228 lib/layouts/linguistics.module:299
 msgid "Translation"
 msgstr "Übersetzung"
 
-#: lib/layouts/linguistics.module:216 lib/layouts/linguistics.module:287
+#: lib/layouts/linguistics.module:229 lib/layouts/linguistics.module:300
 msgid "Gloss Translation"
 msgstr "Glossen-Übersetzung"
 
-#: lib/layouts/linguistics.module:217
+#: lib/layouts/linguistics.module:230
 msgid "Add a free translation for the gloss"
 msgstr "Fügt der Glosse eine freie Übersetzung (Paraphrase) hinzu"
 
-#: lib/layouts/linguistics.module:227
+#: lib/layouts/linguistics.module:240
 msgid "Interlinear Gloss (3 Lines)"
 msgstr "Interlinear-Glosse (3 Zeilen)"
 
-#: lib/layouts/linguistics.module:229
+#: lib/layouts/linguistics.module:242
 msgid "Tri-Gloss"
 msgstr "Tri-Glosse"
 
-#: lib/layouts/linguistics.module:247
+#: lib/layouts/linguistics.module:260
 msgid "Add trigloss options here"
 msgstr "Geben Sie hier trigloss-Optionen ein"
 
-#: lib/layouts/linguistics.module:256
+#: lib/layouts/linguistics.module:269
 msgid "Interlinear Gloss (1)"
 msgstr "Interlinear-Glosse (1)"
 
-#: lib/layouts/linguistics.module:257
+#: lib/layouts/linguistics.module:270
 msgid "Interlinear Gloss (Line 1)|1"
 msgstr "Interlinear-Glosse (Zeile 1)|1"
 
-#: lib/lay

[LyX/master] Fix lyx2lyx reversion problem for covington examples

2023-07-21 Thread Juergen Spitzmueller
commit dfab2898de3a63f7ccb0144098846fda7008ebd7
Author: Juergen Spitzmueller 
Date:   Fri Jul 21 09:46:47 2023 +0200

Fix lyx2lyx reversion problem for covington examples

Do not take arguments of nested insets/layouts as your own
---
 lib/lyx2lyx/lyx_2_4.py |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/lib/lyx2lyx/lyx_2_4.py b/lib/lyx2lyx/lyx_2_4.py
index 33bf92c..6e4bdbb 100644
--- a/lib/lyx2lyx/lyx_2_4.py
+++ b/lib/lyx2lyx/lyx_2_4.py
@@ -5296,6 +5296,9 @@ def revert_exarg2(document):
  continue
 
 arg = find_token(document.body, "\\begin_inset Argument 1", i, l)
+if arg != -1 and layouttype != "\\begin_layout " + 
get_containing_layout(document.body, arg)[0]:
+ # this is not our argument!
+ arg = -1
 if subexpl or arg == -1:
 iarg = find_token(document.body, "\\begin_inset Argument 
item:1", i, l)
 if iarg == -1:
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Current covington requires varwidth

2023-07-21 Thread Juergen Spitzmueller
commit 03268082a3d5caf56fac9c2af3c5e39cf4568472
Author: Juergen Spitzmueller 
Date:   Fri Jul 21 14:31:45 2023 +0200

Current covington requires varwidth
---
 lib/examples/Modules/Linguistics.lyx|   69 ++-
 lib/examples/de/Modules/Linguistics.lyx |   53 +++
 lib/layouts/linguistics.module  |2 +-
 3 files changed, 122 insertions(+), 2 deletions(-)

diff --git a/lib/examples/Modules/Linguistics.lyx 
b/lib/examples/Modules/Linguistics.lyx
index 676ce01..0a4506f 100644
--- a/lib/examples/Modules/Linguistics.lyx
+++ b/lib/examples/Modules/Linguistics.lyx
@@ -511,7 +511,7 @@ es.
 \begin_deeper
 \begin_layout Itemize
 
-\change_inserted -712698321 1561276163
+\change_inserted -712698321 1689942218
 Installed on your system:
  
 \begin_inset Info
@@ -520,6 +520,40 @@ arg   "pict2e"
 \end_inset
 
 .
+\end_layout
+
+\end_deeper
+\begin_layout Enumerate
+
+\change_inserted -712698321 1689942481
+
+\emph on
+varwidth.sty
+\emph default
+ 
+\begin_inset CommandInset citation
+LatexCommand cite
+key "varwidth"
+literal "true"
+
+\end_inset
+
+:
+ Needed by covington (as of version 2.11) for gloss comments.
+\end_layout
+
+\begin_deeper
+\begin_layout Itemize
+
+\change_inserted -712698321 1689942218
+Installed on your system:
+ 
+\begin_inset Info
+type  "package"
+arg   "varwidth"
+\end_inset
+
+.
 \change_unchanged
 
 \end_layout
@@ -4338,6 +4372,39 @@ http://www.ctan.org/tex-archive/fonts/tipa/
 \end_inset
 
 .
+\change_inserted -712698321 1689942343
+
+\end_layout
+
+\begin_layout Bibliography
+
+\change_inserted -712698321 1689942407
+\begin_inset CommandInset bibitem
+LatexCommand bibitem
+key "varwidth"
+literal "false"
+
+\end_inset
+
+The varwidth package:
+ 
+\begin_inset Flex URL
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1689942372
+
+https://ctan.org/tex-archive/macros/latex/contrib/varwidth
+\change_unchanged
+
+\end_layout
+
+\end_inset
+
+.
+\change_unchanged
+
 \end_layout
 
 \end_body
diff --git a/lib/examples/de/Modules/Linguistics.lyx 
b/lib/examples/de/Modules/Linguistics.lyx
index 29ccd8d..58ae9f3 100644
--- a/lib/examples/de/Modules/Linguistics.lyx
+++ b/lib/examples/de/Modules/Linguistics.lyx
@@ -433,6 +433,36 @@ arg   "pict2e"
 \end_layout
 
 \end_deeper
+\begin_layout Enumerate
+
+\emph on
+varwidth.sty
+\emph default
+ 
+\begin_inset CommandInset citation
+LatexCommand cite
+key "varwidth"
+literal "true"
+
+\end_inset
+
+:
+ Dieses Paket wird von covington (ab Version 2.11) für Glossen-Kommentare 
gebraucht.
+\end_layout
+
+\begin_deeper
+\begin_layout Itemize
+Auf Ihrem System installiert:
+ 
+\begin_inset Info
+type  "package"
+arg   "varwidth"
+\end_inset
+
+.
+\end_layout
+
+\end_deeper
 \begin_layout Section
 Nummerierte Beispiele
 \end_layout
@@ -3378,5 +3408,28 @@ http://www.ctan.org/tex-archive/fonts/tipa/
 .
 \end_layout
 
+\begin_layout Bibliography
+\begin_inset CommandInset bibitem
+LatexCommand bibitem
+key "varwidth"
+literal "false"
+
+\end_inset
+
+Das varwidth-Paket:
+ 
+\begin_inset Flex URL
+status collapsed
+
+\begin_layout Plain Layout
+
+https://ctan.org/tex-archive/macros/latex/contrib/varwidth
+\end_layout
+
+\end_inset
+
+.
+\end_layout
+
 \end_body
 \end_document
diff --git a/lib/layouts/linguistics.module b/lib/layouts/linguistics.module
index a5379da..9672376 100644
--- a/lib/layouts/linguistics.module
+++ b/lib/layouts/linguistics.module
@@ -1,4 +1,4 @@
-#\DeclareLyXModule[covington.sty,drs.sty,forest.sty,pict2e.sty]{Linguistics}
+#\DeclareLyXModule[covington.sty,drs.sty,forest.sty,pict2e.sty,varwidth.sty]{Linguistics}
 #\DeclareCategory{Academic Field Specifics}
 #DescriptionBegin
 #Defines some special environments useful for linguistics (numbered examples,
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Create the other side of conversion chain when IM is banned (bug #12646).

2023-07-21 Thread Pavel Sanda
commit 179c0d6ff25de361d801f5e4a58564d6e8e29c67
Author: Pavel Sanda 
Date:   Fri Jul 21 23:17:55 2023 +0200

Create the other side of conversion chain when IM is banned (bug #12646).

We allow png, jpg to channel through already existing tiff2ps (library
libtiff-tools). Other formats can be added if there is a request.

For future reference:
- using pnmtops seem to have issues with landscape/portrait flip, so
  tiff2ps seems better alternative.
- using GraphicsMagick won't help because some distros ban postscript
  processing directly in its code (e.g. openSUSE)

This patch finishes IM policy ban handling, we can't probably do much
better.
---
 lib/configure.py |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/configure.py b/lib/configure.py
index 7a5052f..e5f71f7 100644
--- a/lib/configure.py
+++ b/lib/configure.py
@@ -1206,8 +1206,10 @@ def checkConverterEntries():
 except:
 removeFiles(['mock.eps'])
 #needs empty record otherwise default converter will be issued
-rc_entry = r'\converter epspng""   ""'
-addToRC(rc_entry)
+addToRC(r'''\converter epspng""""
+\converter pngeps""""
+\converter jpgtiff"convert $$i $$o"""
+\converter pngtiff"convert $$i $$o"""''')
 logger.info('ImageMagick seems to ban conversions from EPS. 
Disabling direct EPS->PNG.')
 #
 # no agr -> pdf6 converter, since the pdf library used by gracebat is not
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] * RELEASE-NOTES

2023-07-21 Thread Pavel Sanda
commit 8335dc49e1ab0bd76f1476bf02b77d7bfecfb373
Author: Pavel Sanda 
Date:   Fri Jul 21 23:19:05 2023 +0200

* RELEASE-NOTES
---
 lib/RELEASE-NOTES |   16 
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/lib/RELEASE-NOTES b/lib/RELEASE-NOTES
index 9e9611b..9060410 100644
--- a/lib/RELEASE-NOTES
+++ b/lib/RELEASE-NOTES
@@ -84,6 +84,22 @@
 * Postscript -> PDF convertor (ps2pdf) uses -dALLOWPSTRANSPARENCY by
   default now (implemented since ghostscript 9.53.3, see bug #12303).
 
+* There is a widespread ban on postscript conversions across different
+  linux distributions and there are currently two way how to address
+  various image conversion errors when typesetting your documents: 
+  - either manually remove the bans of EPS/PDF coders in ImageMagick
+policy.xml configuration file
+  - or install alternative converters for bitmap <-> postscript.
+In particular pdftoppm (poppler-utils) and tiff2ps (libtiff-tools)
+are now recognized and activated in case LyX detects ImageMagick
+policy ban. These will allow eps<->png(jpg) conversion chain to
+be found when processing your documents. 
+  Package maintainers of distributions (e.g. openSUSE or Debian derivates)
+  where ghostscript conversions of ImageMagick are banned can simply 
+  add dependencies for poppler-utils and libtiff-tools to workaround
+  the problem.
+
+
 !!!The following pref variables were added in 2.4:
 
 * \ct_additions_underlined true|false: determines whether additions in change 
tracking
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Switch delimiters for hebrew keyboard (bug #12829).

2023-07-21 Thread Pavel Sanda
commit 00a98856f88bb2bcbdeef8ca58b975a2abb8537c
Author: Pavel Sanda 
Date:   Fri Jul 21 23:37:39 2023 +0200

Switch delimiters for hebrew keyboard (bug #12829).

Patch from Udi Fogiel.
---
 lib/kbd/hebrew.kmap |   12 
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/lib/kbd/hebrew.kmap b/lib/kbd/hebrew.kmap
index 38ed7e4..9056650 100644
--- a/lib/kbd/hebrew.kmap
+++ b/lib/kbd/hebrew.kmap
@@ -86,3 +86,15 @@
 \kmap B ֲ  #   Hataf patah
 \kmap N ֳ  #   Hataf qamats
 \kmap M ֵ  # Shift+Tsadi = Tsere
+
+# mirroring delimiters
+\kmap ( )
+\kmap ) (
+\kmap [ ]
+\kmap ] [
+\kmap { }
+\kmap } {
+\kmap < >
+\kmap > <
+
+
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Use macros with parameters for modulo macros

2023-07-21 Thread Jean-Marc Lasgouttes
commit d59046512c204968122917758ee38d4529b1a03f
Author: Jean-Marc Lasgouttes 
Date:   Tue Jul 18 14:27:24 2023 +0200

Use macros with parameters for modulo macros

It turns out that it is possible to use macros with parameters in 
lib/symbols.

I use this to simplify the use of mod-like macros.

Update documentation.
---
 lib/doc/Math.lyx |  250 --
 lib/symbols  |   22 -
 2 files changed, 260 insertions(+), 12 deletions(-)

diff --git a/lib/doc/Math.lyx b/lib/doc/Math.lyx
index 0f14609..a9fbcf9 100644
--- a/lib/doc/Math.lyx
+++ b/lib/doc/Math.lyx
@@ -236,6 +236,7 @@ logicalmkup
 \docbook_mathml_prefix 1
 \author -584632292 "Richard Kimberly Heck"
 \author -563046850 "Jean-Marc LASGOUTTES"
+\author -495245474 "Jean-Marc Lasgouttes"
 \author 177693 "x"
 \author 5863208 "ab"
 \author 47243155 "Jean-Marc"
@@ -29069,24 +29070,257 @@ modulo-
 \begin_layout Standard
 The modulo-function is special,
  because it exists in four variants.
- The variants in a displayed formula are:
+ The variants in a
+\change_deleted -495245474 1689684546
+ displayed
+\change_inserted -495245474 1689684548
+n inline
+\change_unchanged
+ formula are:
+\change_deleted -495245474 1689684526
+
 \begin_inset Formula 
 \begin{align*}
 \underline{\textrm{Command}\raisebox{-0.9mm}{}} &  & 
\underline{\textrm{Result}}\\
-\mathrm{a\backslash mod\textrm{␣}b} &  & a\mod b\\
-\mathrm{a\backslash pmod\textrm{␣}b} &  & a\pmod b\\
-\mathrm{a\backslash bmod\textrm{␣}b} &  & a\bmod b\\
-\mathrm{a\backslash pod\textrm{␣}b} &  & a\pod b
+\mathrm{a\backslash mod\textrm{␣}b\textrm{␣}} &  & a\mod b\\
+\mathrm{a\backslash pmod\textrm{␣}b\textrm{␣}} &  & a\pmod b\\
+\mathrm{a\backslash bmod\textrm{␣}b\textrm{␣}} &  & a\bmod b\\
+\mathrm{a\backslash pod\textrm{␣}b\textrm{␣}} &  & a\pod b
 \end{align*}
 
 \end_inset
 
 
+\change_inserted -495245474 1689684215
+
 \end_layout
 
 \begin_layout Standard
-In an inline formula less space is set before the function names for all 
variants.
- By default the modulo-functions take only the first character following the 
command into account.
+\noindent
+\align center
+
+\change_inserted -495245474 1689684215
+\begin_inset Tabular
+
+
+
+
+
+
+\begin_inset Text
+
+\begin_layout Plain Layout
+
+\change_inserted -495245474 1689684215
+Command
+\end_layout
+
+\end_inset
+
+
+\begin_inset Text
+
+\begin_layout Plain Layout
+
+\change_inserted -495245474 1689684215
+Result
+\end_layout
+
+\end_inset
+
+
+
+
+\begin_inset Text
+
+\begin_layout Plain Layout
+
+\change_inserted -495245474 1689684286
+a
+\backslash
+mod
+\begin_inset space \textvisiblespace{}
+\end_inset
+
+b
+\change_unchanged
+
+\end_layout
+
+\end_inset
+
+
+\begin_inset Text
+
+\begin_layout Plain Layout
+
+\change_inserted -495245474 1689684457
+\begin_inset Formula $a\mod b$
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+
+
+\begin_inset Text
+
+\begin_layout Plain Layout
+
+\change_inserted -495245474 1689684416
+a
+\backslash
+pmod
+\begin_inset space \textvisiblespace{}
+\end_inset
+
+b
+\begin_inset space \textvisiblespace{}
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\begin_inset Text
+
+\begin_layout Plain Layout
+
+\change_inserted -495245474 1689684474
+\begin_inset Formula $a\pmod b$
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+
+
+\begin_inset Text
+
+\begin_layout Plain Layout
+
+\change_inserted -495245474 1689684419
+a
+\backslash
+bmod
+\begin_inset space \textvisiblespace{}
+\end_inset
+
+b
+\begin_inset space \textvisiblespace{}
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\begin_inset Text
+
+\begin_layout Plain Layout
+
+\change_inserted -495245474 1689684488
+\begin_inset Formula $a\bmod b$
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+
+
+\begin_inset Text
+
+\begin_layout Plain Layout
+
+\change_inserted -495245474 1689684421
+a
+\backslash
+pod
+\begin_inset space \textvisiblespace{}
+\end_inset
+
+b
+\begin_inset space \textvisiblespace{}
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+\begin_inset Text
+
+\begin_layout Plain Layout
+
+\change_inserted -495245474 1689684502
+\begin_inset Formula $a\pod b$
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
+
+
+\end_inset
+
+
+\change_unchanged
+
+\end_layout
+
+\begin_layout Standard
+In a
+\change_deleted -495245474 1689684554
+n inline
+\change_inserted -495245474 1689684556
+ display
+\change_unchanged
+ formula
+\change_inserted -495245474 1689684559
+,
+
+\change_unchanged
+ 
+\change_deleted -495245474 1689684562
+less
+\change_inserted -495245474 1689684563
+more
+\change_unchanged
+ space is set before the function names for all variants
+\change_inserted -495245474 1689684688
+ but 
+\series bold
+
+\backslash
+mod.
+
+\series default
+ This later version is also the only one that does not take the 
+\series bold
+b
+\series default
+ as argument but acts as a binary operator
+\change_unchanged
+.
+ 
+\change_deleted -495245474 1689684609
+By default the modulo-functions take onl

[LyX/master] Detect when one tries to bind a lfun to a prefix of longer commands

2023-07-21 Thread Jean-Marc Lasgouttes
commit c8c589353ade8d8b82248e8adf79ea2feb43b454
Author: Jean-Marc Lasgouttes 
Date:   Fri Dec 9 14:45:14 2022 +0100

Detect when one tries to bind a lfun to a prefix of longer commands

Change KeyMap::getBinding to return FuncRequest::prefix in this case.

Add handling of this case in PrefShortcuts::validateNewShortcut.

What does not seem to work is that if, for example, accent-acute is
bound to M-s (which is a prefix for size-related bindings), and then
the binding is removed, the functions are not visibly restored.

Part of bug #10131.
---
 src/KeyMap.cpp|2 +-
 src/KeyMap.h  |5 +++--
 src/frontends/qt/GuiPrefs.cpp |   17 +
 3 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/src/KeyMap.cpp b/src/KeyMap.cpp
index c530f5f..c34fe7e 100644
--- a/src/KeyMap.cpp
+++ b/src/KeyMap.cpp
@@ -203,7 +203,7 @@ FuncRequest KeyMap::getBinding(KeySequence const & seq, 
unsigned int r)
&& mod1 == it->mod.first
&& mod2 == it->mod.second) {
if (r + 1 == seq.length())
-   return it->func;
+   return (it->prefixes) ? FuncRequest::prefix : 
it->func;
else if (it->prefixes)
return it->prefixes->getBinding(seq, r + 1);
}
diff --git a/src/KeyMap.h b/src/KeyMap.h
index 9386c1f..ac9de62 100644
--- a/src/KeyMap.h
+++ b/src/KeyMap.h
@@ -65,8 +65,9 @@ public:
unsigned int r = 0);
 
 
-   /// returns the function bound to this key sequence, or
-   /// FuncRequest::unknown if no binding exists for it.
+   /// returns the function bound to this key sequence, or:
+   /// * FuncRequest::unknown if no binding exists for it;
+   /// * FuncRequest::prefix if this is the start of longer keysequences
/// @param r an internal recursion counter
// FIXME Surely there's a better way to do that?
FuncRequest getBinding(KeySequence const & seq, unsigned int r = 0);
diff --git a/src/frontends/qt/GuiPrefs.cpp b/src/frontends/qt/GuiPrefs.cpp
index a2ac0c8..a5f4014 100644
--- a/src/frontends/qt/GuiPrefs.cpp
+++ b/src/frontends/qt/GuiPrefs.cpp
@@ -3408,6 +3408,23 @@ bool PrefShortcuts::validateNewShortcut(FuncRequest 
const & func,
// nothing to change
return false;
 
+   // Check whether the key sequence is a prefix for other shortcuts.
+   if (oldBinding == FuncRequest::prefix) {
+   docstring const new_action_string = makeCmdString(func);
+   docstring const text = bformat(_("Shortcut `%1$s' is already a 
prefix for other commands.\n"
+"Are you sure you want to 
unbind these commands and bind it to %2$s?"),
+  
k.print(KeySequence::ForGui), new_action_string);
+   int ret = Alert::prompt(_("Redefine shortcut?"),
+   text, 0, 1, _("&Redefine"), 
_("&Cancel"));
+   if (ret != 0)
+   return false;
+   QString const sequence_text = 
toqstr(k.print(KeySequence::ForGui));
+   QList items = 
shortcutsTW->findItems(sequence_text,
+   Qt::MatchFlags(Qt::MatchStartsWith | 
Qt::MatchRecursive), 1);
+   deactivateShortcuts(items);
+   return true;
+   }
+
// make sure this key isn't already bound---and, if so, prompt user
// (exclude the lfun the user already wants to modify)
docstring const action_string = makeCmdString(oldBinding);
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs