mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
gh-142318: Fix typing 'q' at interactive help screen exiting Tachyon (#142319)
This commit is contained in:
parent
59f247e43b
commit
dcac498e50
3 changed files with 18 additions and 1 deletions
|
|
@ -861,10 +861,12 @@ def _handle_input(self):
|
|||
# Handle help toggle keys
|
||||
if ch == ord("h") or ch == ord("H") or ch == ord("?"):
|
||||
self.show_help = not self.show_help
|
||||
return
|
||||
|
||||
# If showing help, any other key closes it
|
||||
elif self.show_help and ch != -1:
|
||||
if self.show_help and ch != -1:
|
||||
self.show_help = False
|
||||
return
|
||||
|
||||
# Handle regular commands
|
||||
if ch == ord("q") or ch == ord("Q"):
|
||||
|
|
|
|||
|
|
@ -173,6 +173,19 @@ def test_help_with_question_mark(self):
|
|||
|
||||
self.assertTrue(self.collector.show_help)
|
||||
|
||||
def test_help_dismiss_with_q_does_not_quit(self):
|
||||
"""Test that pressing 'q' while help is shown only closes help, not quit"""
|
||||
self.assertFalse(self.collector.show_help)
|
||||
self.display.simulate_input(ord("h"))
|
||||
self.collector._handle_input()
|
||||
self.assertTrue(self.collector.show_help)
|
||||
|
||||
self.display.simulate_input(ord("q"))
|
||||
self.collector._handle_input()
|
||||
|
||||
self.assertFalse(self.collector.show_help)
|
||||
self.assertTrue(self.collector.running)
|
||||
|
||||
def test_filter_clear(self):
|
||||
"""Test clearing filter."""
|
||||
self.collector.filter_pattern = "test"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
Fix typing ``'q'`` at the help of the interactive tachyon profiler exiting
|
||||
the profiler.
|
||||
Loading…
Add table
Add a link
Reference in a new issue