From 7658bca0e9d6bf3ef33cdf8a7c242678eb2dd1af Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Thu, 28 Sep 2023 15:28:13 +0100 Subject: [PATCH 1/4] Fix an old and incorrect comment --- src/textual/command.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/textual/command.py b/src/textual/command.py index 04e5b60eaf..217abcfb92 100644 --- a/src/textual/command.py +++ b/src/textual/command.py @@ -816,7 +816,7 @@ async def _gather_commands(self, search_value: str) -> None: # We're ready to show results, ensure the list is visible. self._list_visible = True - # Go into a busy mode. + # Reset busy mode. self._show_busy = False # A flag to keep track of if the current content of the command hit From f339cb50e9ae4ae1fce84f36a3a452ac9c573046 Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Thu, 28 Sep 2023 15:38:14 +0100 Subject: [PATCH 2/4] Only show the command palette command list when it's needed Rather than open the command palette the moment we start looking for hits, only show it when a hit comes in, or when we need to say that no matches were found. Fixes #3277. --- src/textual/command.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/textual/command.py b/src/textual/command.py index 217abcfb92..d45d941d85 100644 --- a/src/textual/command.py +++ b/src/textual/command.py @@ -586,6 +586,7 @@ def _show_no_matches() -> None: id=self._NO_MATCHES, ) ) + self._list_visible = True self._no_matches_timer = self.set_timer( self._NO_MATCHES_COUNTDOWN, @@ -765,6 +766,7 @@ def _refresh_command_list( command_list.clear_options().add_options(sorted(commands, reverse=True)) if highlighted is not None: command_list.highlighted = command_list.get_option_index(highlighted.id) + self._list_visible = bool(command_list.option_count) _RESULT_BATCH_TIME: Final[float] = 0.25 """How long to wait before adding commands to the command list.""" @@ -813,9 +815,6 @@ async def _gather_commands(self, search_value: str) -> None: # grab a reference to that. worker = get_current_worker() - # We're ready to show results, ensure the list is visible. - self._list_visible = True - # Reset busy mode. self._show_busy = False From 09274c4c94ab0837f5199eb374174ead7b6e2d3d Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Thu, 28 Sep 2023 15:41:36 +0100 Subject: [PATCH 3/4] Update snapshot tests --- .../__snapshots__/test_snapshots.ambr | 152 +++++++++--------- 1 file changed, 76 insertions(+), 76 deletions(-) diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots.ambr b/tests/snapshot_tests/__snapshots__/test_snapshots.ambr index a1b1206dbe..fbbf0968e8 100644 --- a/tests/snapshot_tests/__snapshots__/test_snapshots.ambr +++ b/tests/snapshot_tests/__snapshots__/test_snapshots.ambr @@ -33443,152 +33443,152 @@ font-weight: 700; } - .terminal-1131328884-matrix { + .terminal-1978519803-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-1131328884-title { + .terminal-1978519803-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-1131328884-r1 { fill: #c5c8c6 } - .terminal-1131328884-r2 { fill: #e1e1e1;font-weight: bold } - .terminal-1131328884-r3 { fill: #737373 } - .terminal-1131328884-r4 { fill: #474747 } - .terminal-1131328884-r5 { fill: #0178d4 } - .terminal-1131328884-r6 { fill: #454a50 } - .terminal-1131328884-r7 { fill: #e1e1e1 } - .terminal-1131328884-r8 { fill: #e0e0e0 } - .terminal-1131328884-r9 { fill: #e2e3e3;font-weight: bold } - .terminal-1131328884-r10 { fill: #14191f } - .terminal-1131328884-r11 { fill: #000000 } - .terminal-1131328884-r12 { fill: #1e1e1e } - .terminal-1131328884-r13 { fill: #dde0e6 } - .terminal-1131328884-r14 { fill: #99a1b3 } - .terminal-1131328884-r15 { fill: #dde2e8 } - .terminal-1131328884-r16 { fill: #99a7b9 } - .terminal-1131328884-r17 { fill: #dde4ea } - .terminal-1131328884-r18 { fill: #99adc1 } - .terminal-1131328884-r19 { fill: #dde6ed } - .terminal-1131328884-r20 { fill: #99b4c9 } - .terminal-1131328884-r21 { fill: #dde8f3;font-weight: bold } - .terminal-1131328884-r22 { fill: #ddedf9 } + .terminal-1978519803-r1 { fill: #c5c8c6 } + .terminal-1978519803-r2 { fill: #e1e1e1;font-weight: bold } + .terminal-1978519803-r3 { fill: #737373 } + .terminal-1978519803-r4 { fill: #474747 } + .terminal-1978519803-r5 { fill: #0178d4 } + .terminal-1978519803-r6 { fill: #454a50 } + .terminal-1978519803-r7 { fill: #e1e1e1 } + .terminal-1978519803-r8 { fill: #e0e0e0 } + .terminal-1978519803-r9 { fill: #e2e3e3;font-weight: bold } + .terminal-1978519803-r10 { fill: #000000 } + .terminal-1978519803-r11 { fill: #1e1e1e } + .terminal-1978519803-r12 { fill: #dde0e6 } + .terminal-1978519803-r13 { fill: #99a1b3 } + .terminal-1978519803-r14 { fill: #dde2e8 } + .terminal-1978519803-r15 { fill: #99a7b9 } + .terminal-1978519803-r16 { fill: #dde4ea } + .terminal-1978519803-r17 { fill: #99adc1 } + .terminal-1978519803-r18 { fill: #dde6ed } + .terminal-1978519803-r19 { fill: #99b4c9 } + .terminal-1978519803-r20 { fill: #23568b } + .terminal-1978519803-r21 { fill: #dde8f3;font-weight: bold } + .terminal-1978519803-r22 { fill: #ddedf9 } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - ColorsApp + ColorsApp - - - - - Theme ColorsNamed Colors - ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -  primary ▇▇ - ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -  secondary "primary" - ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -  background $primary-darken-3$t - ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -  primary-background $primary-darken-2$t - ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▆▆ -  secondary-background $primary-darken-1$t - ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -  surface $primary$t - ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -  D  Toggle dark mode  + + + + + Theme ColorsNamed Colors + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +  primary  + ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +  secondary "primary" + ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +  background $primary-darken-3$t + ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +  primary-background $primary-darken-2$t + ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +  secondary-background $primary-darken-1$t + ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +  surface $primary$t + ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + +  D  Toggle dark mode  From 8c8928dee11f0b06e492ea3a4c9fe9592f4d1517 Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Mon, 2 Oct 2023 09:26:49 +0100 Subject: [PATCH 4/4] Update snapshot tests --- .../__snapshots__/test_snapshots.ambr | 152 +++++++++--------- 1 file changed, 76 insertions(+), 76 deletions(-) diff --git a/tests/snapshot_tests/__snapshots__/test_snapshots.ambr b/tests/snapshot_tests/__snapshots__/test_snapshots.ambr index fbbf0968e8..a1b1206dbe 100644 --- a/tests/snapshot_tests/__snapshots__/test_snapshots.ambr +++ b/tests/snapshot_tests/__snapshots__/test_snapshots.ambr @@ -33443,152 +33443,152 @@ font-weight: 700; } - .terminal-1978519803-matrix { + .terminal-1131328884-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-1978519803-title { + .terminal-1131328884-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-1978519803-r1 { fill: #c5c8c6 } - .terminal-1978519803-r2 { fill: #e1e1e1;font-weight: bold } - .terminal-1978519803-r3 { fill: #737373 } - .terminal-1978519803-r4 { fill: #474747 } - .terminal-1978519803-r5 { fill: #0178d4 } - .terminal-1978519803-r6 { fill: #454a50 } - .terminal-1978519803-r7 { fill: #e1e1e1 } - .terminal-1978519803-r8 { fill: #e0e0e0 } - .terminal-1978519803-r9 { fill: #e2e3e3;font-weight: bold } - .terminal-1978519803-r10 { fill: #000000 } - .terminal-1978519803-r11 { fill: #1e1e1e } - .terminal-1978519803-r12 { fill: #dde0e6 } - .terminal-1978519803-r13 { fill: #99a1b3 } - .terminal-1978519803-r14 { fill: #dde2e8 } - .terminal-1978519803-r15 { fill: #99a7b9 } - .terminal-1978519803-r16 { fill: #dde4ea } - .terminal-1978519803-r17 { fill: #99adc1 } - .terminal-1978519803-r18 { fill: #dde6ed } - .terminal-1978519803-r19 { fill: #99b4c9 } - .terminal-1978519803-r20 { fill: #23568b } - .terminal-1978519803-r21 { fill: #dde8f3;font-weight: bold } - .terminal-1978519803-r22 { fill: #ddedf9 } + .terminal-1131328884-r1 { fill: #c5c8c6 } + .terminal-1131328884-r2 { fill: #e1e1e1;font-weight: bold } + .terminal-1131328884-r3 { fill: #737373 } + .terminal-1131328884-r4 { fill: #474747 } + .terminal-1131328884-r5 { fill: #0178d4 } + .terminal-1131328884-r6 { fill: #454a50 } + .terminal-1131328884-r7 { fill: #e1e1e1 } + .terminal-1131328884-r8 { fill: #e0e0e0 } + .terminal-1131328884-r9 { fill: #e2e3e3;font-weight: bold } + .terminal-1131328884-r10 { fill: #14191f } + .terminal-1131328884-r11 { fill: #000000 } + .terminal-1131328884-r12 { fill: #1e1e1e } + .terminal-1131328884-r13 { fill: #dde0e6 } + .terminal-1131328884-r14 { fill: #99a1b3 } + .terminal-1131328884-r15 { fill: #dde2e8 } + .terminal-1131328884-r16 { fill: #99a7b9 } + .terminal-1131328884-r17 { fill: #dde4ea } + .terminal-1131328884-r18 { fill: #99adc1 } + .terminal-1131328884-r19 { fill: #dde6ed } + .terminal-1131328884-r20 { fill: #99b4c9 } + .terminal-1131328884-r21 { fill: #dde8f3;font-weight: bold } + .terminal-1131328884-r22 { fill: #ddedf9 } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - ColorsApp + ColorsApp - - - - - Theme ColorsNamed Colors - ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -  primary  - ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -  secondary "primary" - ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -  background $primary-darken-3$t - ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -  primary-background $primary-darken-2$t - ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -  secondary-background $primary-darken-1$t - ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ - ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ -  surface $primary$t - ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ - -  D  Toggle dark mode  + + + + + Theme ColorsNamed Colors + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +  primary ▇▇ + ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +  secondary "primary" + ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +  background $primary-darken-3$t + ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +  primary-background $primary-darken-2$t + ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▆▆ +  secondary-background $primary-darken-1$t + ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +  surface $primary$t + ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ + ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ +  D  Toggle dark mode