diff --git a/development/autotests/findadv-01-in.txt b/development/autotests/findadv-01-in.txt index c480e82053..f761e25c0a 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 5b3bdb521b..08509c260f 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 891a8edc06..c6fc1e8e2c 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 efa5595bf7..cdec3b5695 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 744dcae95b..a71d13bf69 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 d5f5021146..9ffc733875 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 7868ebd0a4..ec5d16b62e 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 dab92a8ca0..58acd4085b 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()