commit f771f77c67f546fd315bebff65124fe334a3e0f6
Author: Kornel Benko <[email protected]>
Date:   Mon Jul 18 22:55:03 2022 +0200

    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.
---
 development/autotests/findadv-01-in.txt    |    4 ++++
 development/autotests/findadv-02-in.txt    |    4 ++++
 development/autotests/findadv-04-in.txt    |    4 ++++
 development/autotests/findadv-12-in.txt    |    4 ++++
 development/autotests/findadv-20-in.txt    |    3 +++
 development/autotests/findadv-logo-in.txt  |    4 ++++
 development/autotests/findadv-re-04-in.txt |    2 ++
 development/autotests/keytest.py           |   27 ++++++++++++++++++++++++---
 8 files changed, 49 insertions(+), 3 deletions(-)

diff --git a/development/autotests/findadv-01-in.txt 
b/development/autotests/findadv-01-in.txt
index c480e82..f761e25 100644
--- a/development/autotests/findadv-01-in.txt
+++ b/development/autotests/findadv-01-in.txt
@@ -1,6 +1,10 @@
 # After replacing with something that matches the search pattern, the next
 # match should not consider the just replaced text (#4388)
 #
+UnuseShortcut "Tab" "command-alternatives 
completion-accept;cell-forward;tab-insert;outline-in;depth-increment"
+
+PrepareShortcuts
+
 Lang it_IT.utf8
 CO: findadv-01.ctrl
 KD: 100
diff --git a/development/autotests/findadv-02-in.txt 
b/development/autotests/findadv-02-in.txt
index 5b3bdb5..08509c2 100644
--- a/development/autotests/findadv-02-in.txt
+++ b/development/autotests/findadv-02-in.txt
@@ -1,5 +1,9 @@
 # Basic test on refactoring of mathematics notation
 #
+UnuseShortcut "Tab" "command-alternatives 
completion-accept;cell-forward;tab-insert;outline-in;depth-increment"
+
+PrepareShortcuts
+
 Lang it_IT.utf8
 CO: findadv-02.ctrl
 TestBegin test.lyx -dbg key,find > findadv-02.loga.txt 2>&1
diff --git a/development/autotests/findadv-04-in.txt 
b/development/autotests/findadv-04-in.txt
index 891a8ed..c6fc1e8 100644
--- a/development/autotests/findadv-04-in.txt
+++ b/development/autotests/findadv-04-in.txt
@@ -1,5 +1,9 @@
 # Regression test for #7245
 #
+UnuseShortcut "Tab" "command-alternatives 
completion-accept;cell-forward;tab-insert;outline-in;depth-increment"
+
+PrepareShortcuts
+
 Lang it_IT.utf8
 CO: findadv-04.ctrl
 TestBegin test.lyx -dbg key,find > findadv-04.loga.txt 2>&1
diff --git a/development/autotests/findadv-12-in.txt 
b/development/autotests/findadv-12-in.txt
index efa5595..cdec3b5 100644
--- a/development/autotests/findadv-12-in.txt
+++ b/development/autotests/findadv-12-in.txt
@@ -2,6 +2,10 @@
 # again the search pattern, should not result in a double replacement
 # (#7442)
 #
+UnuseShortcut "Tab" "command-alternatives 
completion-accept;cell-forward;tab-insert;outline-in;depth-increment"
+
+PrepareShortcuts
+
 Lang sk_SK.utf8
 CO: findadv-12.ctrl
 TestBegin test.lyx -dbg key,find > findadv-12.loga.txt 2>&1
diff --git a/development/autotests/findadv-20-in.txt 
b/development/autotests/findadv-20-in.txt
index 744dcae..a71d13b 100644
--- a/development/autotests/findadv-20-in.txt
+++ b/development/autotests/findadv-20-in.txt
@@ -1,6 +1,9 @@
 # Avoiding recursive replacements when replaced text matches search pattern
 # Addresses #7675.
 #
+UnuseShortcut "Tab" "command-alternatives 
completion-accept;cell-forward;tab-insert;outline-in;depth-increment"
+
+PrepareShortcuts
 
 Lang it_IT.utf8
 
diff --git a/development/autotests/findadv-logo-in.txt 
b/development/autotests/findadv-logo-in.txt
index d5f5021..9ffc733 100644
--- a/development/autotests/findadv-logo-in.txt
+++ b/development/autotests/findadv-logo-in.txt
@@ -1,6 +1,10 @@
 # Test for searching the special LyX and LaTeX words
 # when ignoring format
 
+UnuseShortcut "Tab" "command-alternatives 
completion-accept;cell-forward;tab-insert;outline-in;depth-increment"
+
+PrepareShortcuts
+
 Lang sk_SK.utf8
 TestBegin test.lyx -dbg key,find > findadv-logo.loga.txt 2>&1
 KK: This should be a LaTeX logo: 
diff --git a/development/autotests/findadv-re-04-in.txt 
b/development/autotests/findadv-re-04-in.txt
index 7868ebd..ec5d16b 100644
--- a/development/autotests/findadv-re-04-in.txt
+++ b/development/autotests/findadv-re-04-in.txt
@@ -1,5 +1,7 @@
 # Finding styles with regexp
 UseShortcut "C-F20" "regexp-mode"
+UnuseShortcut "Tab" "command-alternatives 
completion-accept;cell-forward;tab-insert;outline-in;depth-increment"
+
 PrepareShortcuts
 
 Lang sk_SK.utf8
diff --git a/development/autotests/keytest.py b/development/autotests/keytest.py
index dab92a8..58acd40 100755
--- a/development/autotests/keytest.py
+++ b/development/autotests/keytest.py
@@ -481,7 +481,8 @@ class Shortcuts:
     def __init__(self):
         self.shortcut_entry = re.compile(r'^\s*"([^"]+)"\s*\"([^"]+)\"')
         self.bindings = {}
-        self.bind = re.compile(r'^\s*\\bind\s+"([^"]+)"')
+        self.unbindings = {}
+        self.bind = re.compile(r'^\s*\\(un)?bind\s+"([^"]+)"')
         if lyx_userdir_ver is None:
             self.dir = lyx_userdir
         else:
@@ -496,6 +497,15 @@ class Shortcuts:
         else:
             die(1, "cad shortcut spec(" + c + ")")
 
+    def __UnuseShortcut(self, c):
+        m = self.shortcut_entry.match(c)
+        if m:
+            sh = m.group(1)
+            fkt = m.group(2)
+            self.unbindings[sh] = fkt
+        else:
+            die(1, "cad shortcut spec(" + c + ")")
+
     def __PrepareShortcuts(self):
         if not self.dir is None:
             tmp = tempfile.NamedTemporaryFile(suffix='.bind', delete=False)
@@ -511,11 +521,15 @@ class Shortcuts:
                     m = self.bind.match(line)
                     if m:
                         bindfound = True
-                        val = m.group(1)
+                        val = m.group(2)
                         if val in self.bindings:
                             if self.bindings[val] != "":
                                 tmp.write("\\bind \"" + val + "\" \"" + 
self.bindings[val] + "\"\n")
                                 self.bindings[val] = ""
+                        elif val in self.unbindings:
+                            if self.unbindings[val] != "":
+                                tmp.write("\\unbind \"" + val + "\" \"" + 
self.unbindings[val] + "\"\n")
+                                self.unbindings[val] = ""
                         else:
                             tmp.write(line + '\n')
                     elif not bindfound:
@@ -527,9 +541,14 @@ class Shortcuts:
                 )
             for val in self.bindings:
                 if not self.bindings[val] is None:
-                    if  self.bindings[val] != "":
+                    if self.bindings[val] != "":
                         tmp.write("\\bind \"" + val + "\" \"" + 
self.bindings[val] + "\"\n")
                         self.bindings[val] = ""
+            for val in self.unbindings:
+                if not self.unbindings[val] is None:
+                    if self.unbindings[val] != "":
+                        tmp.write("\\unbind \"" + val + "\" \"" + 
self.unbindings[val] + "\"\n")
+                        self.unbindings[val] = ""
             tmp.close()
             shutil.move(tmp.name, self.dir + '/bind/user.bind')
         else:
@@ -538,6 +557,8 @@ class Shortcuts:
     def dispatch(self, c):
         if c[0:12] == 'UseShortcut ':
             self.__UseShortcut(c[12:])
+        elif c[0:14] == 'UnuseShortcut ':
+            self.__UnuseShortcut(c[14:])
         elif c == 'PrepareShortcuts':
             print('Preparing usefull sortcuts for tests')
             self.__PrepareShortcuts()
-- 
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to