Repository navigation
ctrl+v image + @file accepts images - #1695
Conversation
Previously pressing tab would switch TUI focus to the history scrollbox - no longer necessary.
…ult files for @file command to prompt user what they can search
|
Can we have cmd + v also? |
| /// Time window for debouncing redraw requests. | ||
| const REDRAW_DEBOUNCE: Duration = Duration::from_millis(10); | ||
|
|
||
| // Testable helper: generic over paste function so we can inject stubs in unit tests. |
There was a problem hiding this comment.
Move it closer to the tests
There was a problem hiding this comment.
For reference:
There was a problem hiding this comment.
Though also, app.rs should be focused on driving the event loop. The specifics for how each event is handled should live in their own files.
There was a problem hiding this comment.
Moved it closer to test. @bolinfest do you suggest I move this to another file?
| // Drop popup borrow before using self mutably again. | ||
| self.insert_selected_path(&sel_path); | ||
| // If selected path looks like an image (png/jpeg), attach as image instead of inserting text. | ||
| let is_image = { |
There was a problem hiding this comment.
let's move the logic to a helper function so that we have better abstraction
|
All contributors have signed the CLA ✍️ ✅ |
d9a4b4f to
194dc82
Compare
| /// Time window for debouncing redraw requests. | ||
| const REDRAW_DEBOUNCE: Duration = Duration::from_millis(10); | ||
|
|
||
| // Testable helper: generic over paste function so we can inject stubs in unit tests. |
There was a problem hiding this comment.
Though also, app.rs should be focused on driving the event loop. The specifics for how each event is handled should live in their own files.
| && key_event.code == KeyCode::Char('v') | ||
| && key_event | ||
| .modifiers | ||
| .contains(crossterm::event::KeyModifiers::CONTROL) |
There was a problem hiding this comment.
So does cmd get mapped to CONTROL in this case on macOS?
There was a problem hiding this comment.
No, terminal don't paste events on CMD+V if content in clipboard is an image unfortunately, hence the ctrl+v. We could however change shortcuts or ask users to change shortcuts to support this (by sending keystroke we could listen for) but I feel like ctrl+v is a good start (similar to how we did ctrl+j for new lines for terminals that don't support shift+enter/kitty protocol).
Windows should work with ctrl+maj+v as this conditions should satisfy it, ignoring maj but sending the event. Ctrl+v will not work on windows as its the paste event and will probably not be sent to the terminal
Co-authored-by: Michael Bolin <[email protected]>
allow ctrl+v in TUI for images + @file that are images are appended as raw files (and read by the model) rather than pasted as a path that cannot be read by the model.
Re-used components and same interface we're using for copying pasted content in 72504f1. @aibrahim-oai as you've implemented this, mind having a look at this one?
ctrl-v-image.mp4