MCPcopy Create free account
hub / github.com/GCWing/BitFun / handle_non_key_event

Method handle_non_key_event

src/apps/cli/src/modes/chat.rs:1414–1544  ·  view source on GitHub ↗

Handle non-key events (Mouse, Paste, Resize, etc.).

(
        event: Event,
        this: &mut Self,
        chat_view: &mut ChatView,
        chat_state: &mut ChatState,
        session_id: &mut String,
        rt_handle: &tokio::runtime::Handle,
    

Source from the content-addressed store, hash-verified

1412
1413 /// Handle non-key events (Mouse, Paste, Resize, etc.).
1414 fn handle_non_key_event(
1415 event: Event,
1416 this: &mut Self,
1417 chat_view: &mut ChatView,
1418 chat_state: &mut ChatState,
1419 session_id: &mut String,
1420 rt_handle: &tokio::runtime::Handle,
1421 should_quit: &mut bool,
1422 exit_reason: &mut ChatExitReason,
1423 ) -> Result<NonKeyEventOutcome> {
1424 let mut outcome = NonKeyEventOutcome::default();
1425 match event {
1426 Event::Mouse(mouse) => {
1427 if chat_view.command_palette_captures_mouse(&mouse) {
1428 let action = chat_view.command_palette_handle_mouse(&mouse);
1429 match action {
1430 PaletteAction::Execute(id) => {
1431 if let Some(reason) =
1432 this.handle_palette_action(&id, chat_view, chat_state, rt_handle)?
1433 {
1434 Self::apply_exit_reason(
1435 reason,
1436 this,
1437 chat_view,
1438 chat_state,
1439 session_id,
1440 rt_handle,
1441 should_quit,
1442 exit_reason,
1443 );
1444 }
1445 }
1446 PaletteAction::Dismiss | PaletteAction::None => {}
1447 }
1448 } else if chat_view.provider_selector_captures_mouse(&mouse) {
1449 if let Some(selection) = chat_view.provider_selector_handle_mouse(&mouse) {
1450 this.handle_provider_selection(selection, chat_view);
1451 }
1452 } else if chat_view.handle_mouse_event(&mouse) {
1453 if let Some(action) = chat_view.take_pending_skill_action() {
1454 this.handle_skill_selector_action(action, chat_view, chat_state, rt_handle);
1455 }
1456 if let Some(action) = chat_view.take_pending_subagent_action() {
1457 this.handle_subagent_selector_action(
1458 action, chat_view, chat_state, rt_handle,
1459 );
1460 }
1461 } else {
1462 match mouse.kind {
1463 MouseEventKind::ScrollUp => {
1464 let total = chat_view.count_message_lines(chat_state);
1465 chat_view.scroll_up(3, total);
1466 }
1467 MouseEventKind::ScrollDown => {
1468 chat_view.scroll_down(3);
1469 }
1470 MouseEventKind::Down(MouseButton::Left) => {
1471 let _ = chat_view.begin_mouse_selection(mouse.column, mouse.row);

Callers

nothing calls this directly

Tested by

no test coverage detected