andygrove opened a new issue, #2602:
URL: https://github.com/apache/datafusion-ballista/issues/2602

   **Is your feature request related to a problem or challenge? Please describe 
what you are trying to do.**
   
   In 
[`ballista-cli/src/tui/app.rs`](https://github.com/apache/datafusion-ballista/blob/ea1126c0649b2bc08e1e233b1972b64318821c16/ballista-cli/src/tui/app.rs),
 [`App::on_key` (L206-L533, `#[cfg(not(feature = 
"web"))]`)](https://github.com/apache/datafusion-ballista/blob/ea1126c0649b2bc08e1e233b1972b64318821c16/ballista-cli/src/tui/app.rs#L206-L533)
 and [`App::on_key_sync` (L949-L1291, `#[cfg(feature = 
"web")]`)](https://github.com/apache/datafusion-ballista/blob/ea1126c0649b2bc08e1e233b1972b64318821c16/ballista-cli/src/tui/app.rs#L949-L1291)
 are two ~320-line copies of the same popup-priority cascade and key-to-action 
mapping. The edit-mode block, every popup block and the sort-column arms for 
keys 1-7 are textually identical (e.g. L208-L240 vs L950-L978, L454-L504 vs 
L1183-L1240). They differ only in whether async work is awaited inline or 
returned as a `WebKeyAsyncAction`. Every new key binding has to be added twice, 
and the two builds can silently behave differently.
   
   [`render_footer` 
(tui/ui/footer.rs#L25-L173)](https://github.com/apache/datafusion-ballista/blob/ea1126c0649b2bc08e1e233b1972b64318821c16/ballista-cli/src/tui/ui/footer.rs#L25-L173)
 (cognitive complexity 78, nesting 7) re-implements the same popup precedence 
to build key hints, so the hints shown and the keys actually handled can drift 
apart.
   
   **Describe the solution you'd like**
   
   - Make the sync handler the single source of truth: have it return an 
`Option<KeyAsyncAction>` (the existing `WebKeyAsyncAction`, renamed and no 
longer feature-gated), and implement the native `on_key` as "call 
`on_key_sync`, then run the returned action". Delete the native duplicate.
   - Split the handler into per-popup methods called in precedence order, and 
replace the '1'..'7' arms with one `KeyCode::Char(c @ '1'..='7')` arm.
   - Optionally have each popup state expose its own `key_hints()` next to its 
key handler, so `render_footer` stays in sync.
   
   **Describe alternatives you've considered**
   
   Only split each copy into per-popup handlers without unifying them.
   
   **Additional context**
   
   Line references are pinned to commit ea1126c0649b.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to