Guest User

Untitled

a guest
Apr 27th, 2026
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 6 0.67 KB | None | 0 0
  1. method !wire-input() {
  2.     $!input.on-submit.tap: -> $text {
  3.         if $!editing-msg-id.defined {
  4.             # Ignore empty-edit submits — treat as no-op rather than
  5.             # deleting the message's content. Cancel via Esc.
  6.             self!commit-edit($text) if $text.chars > 0;
  7.         } elsif !$!streaming && $text.chars > 0 && self!current-conversation.defined {
  8.             self!send-user-message($text);
  9.             $!input.clear;
  10.         }
  11.     };
  12.  
  13.     # Esc on the input cancels an in-flight edit (without clearing
  14.     $!input.on-key: 'esc', -> $ {
  15.         self!cancel-edit if $!editing-msg-id.defined;
  16.     }, :description('Cancel message edit');
  17. }
  18.  
Advertisement
Add Comment
Please, Sign In to add comment