File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -351,6 +351,9 @@ def on_mount(self) -> None:
351351 input_widget = self .query_one ("#goto-input" , Input )
352352 input_widget .value = str (self .current )
353353 input_widget .focus ()
354+ # Pre-select the current value so the first keystroke replaces it (typing
355+ # a fresh number is the common case); arrows/edits still work as usual.
356+ input_widget .select_all ()
354357
355358 def on_input_submitted (self , event : Input .Submitted ) -> None :
356359 value = event .value .strip ().replace ("_" , "" )
@@ -408,6 +411,9 @@ def on_mount(self) -> None:
408411 input_widget = self .query_one ("#gotocol-input" , Input )
409412 input_widget .value = str (self .current )
410413 input_widget .focus ()
414+ # Pre-select the current index so typing a column name (or a new index)
415+ # replaces it instead of appending (e.g. "0" + "payment.fare").
416+ input_widget .select_all ()
411417
412418 def _fail (self , message : str ) -> None :
413419 self .query_one ("#gotocol-title" , Static ).update (message )
Original file line number Diff line number Diff line change @@ -529,6 +529,21 @@ async def test_ctable_column_paging(store_path):
529529 assert page ["start" ] + table .cursor_row == 150
530530 _assert_ctable_window_values (page , expected )
531531
532+ # Typing a name replaces the pre-filled current index (not appends): the
533+ # modal opens with the current column index selected, so the first
534+ # keystroke overwrites it instead of producing e.g. "0v12".
535+ await pilot .press ("c" )
536+ await pilot .pause ()
537+ gotocol_input = app .screen .query_one ("#gotocol-input" , Input )
538+ assert gotocol_input .value == str (app .table_page ["col_start" ]) # pre-filled
539+ for ch in "v12" :
540+ await pilot .press (ch )
541+ assert gotocol_input .value == "v12" # replaced, not "<index>v12"
542+ await pilot .press ("enter" )
543+ await wait_for_table (pilot )
544+ assert app .table_page ["col_start" ] == all_names .index ("v12" )
545+ assert app .table_page ["columns" ][0 ] == "v12"
546+
532547 # An ambiguous name prefix keeps the modal open; escape cancels
533548 await pilot .press ("c" )
534549 await pilot .pause ()
You can’t perform that action at this time.
0 commit comments