mirror of
https://github.com/openai/codex.git
synced 2026-05-04 13:21:54 +03:00
tui: attach real image file on drag/drop
- Parse shell-escaped paths via shlex and unescape backslashes - Recognize and percent-decode file:// URLs - Prefer existing .png/.jpg/.jpeg file paths over clipboard bitmap - Keep ~/ expansion and quoting handling - Fix composer tests to pass placeholder_text to ChatComposer::new
This commit is contained in:
@@ -1476,7 +1476,8 @@ mod tests {
|
||||
use crossterm::event::KeyModifiers;
|
||||
let (tx, _rx) = std::sync::mpsc::channel();
|
||||
let sender = AppEventSender::new(tx);
|
||||
let mut composer = ChatComposer::new(true, sender, false);
|
||||
let mut composer =
|
||||
ChatComposer::new(true, sender, false, "Ask Codex to do anything".to_string());
|
||||
let path = std::path::PathBuf::from("/tmp/image1.png");
|
||||
assert!(composer.attach_image(path.clone(), 32, 16, "PNG"));
|
||||
composer.handle_paste(" hi".into());
|
||||
@@ -1498,7 +1499,8 @@ mod tests {
|
||||
use crossterm::event::KeyModifiers;
|
||||
let (tx, _rx) = std::sync::mpsc::channel();
|
||||
let sender = AppEventSender::new(tx);
|
||||
let mut composer = ChatComposer::new(true, sender, false);
|
||||
let mut composer =
|
||||
ChatComposer::new(true, sender, false, "Ask Codex to do anything".to_string());
|
||||
let path = std::path::PathBuf::from("/tmp/image2.png");
|
||||
assert!(composer.attach_image(path.clone(), 10, 5, "PNG"));
|
||||
let (result, _) =
|
||||
@@ -1520,7 +1522,8 @@ mod tests {
|
||||
use crossterm::event::KeyModifiers;
|
||||
let (tx, _rx) = std::sync::mpsc::channel();
|
||||
let sender = AppEventSender::new(tx);
|
||||
let mut composer = ChatComposer::new(true, sender, false);
|
||||
let mut composer =
|
||||
ChatComposer::new(true, sender, false, "Ask Codex to do anything".to_string());
|
||||
let path = std::path::PathBuf::from("/tmp/image3.png");
|
||||
assert!(composer.attach_image(path.clone(), 20, 10, "PNG"));
|
||||
let placeholder = composer.attached_images[0].0.clone();
|
||||
|
||||
Reference in New Issue
Block a user