isImagePath function
File-path recognition for pasted and dropped paths.
Terminals deliver file drops as bracketed pastes of paths (often quoted
or shell-escaped), so drops and path-pastes share one pipeline: extract
candidates here (pure strings, no I/O), let the host check existence,
then attach survivors as media. Formats stay renderable-only: extensions
the overlay cannot decode must not become chips.
Whether path names an image our subsystem can decode, probed via
package:image (the same decoders the terminal pixel pipeline uses).
This is the single source of truth — no hand-maintained extension list.
Formats package:image cannot decode (SVG, HEIC/AVIF) never become
chips, since the overlay could not render them.
Implementation
/// Whether [path] names an image our subsystem can decode, probed via
/// `package:image` (the same decoders the terminal pixel pipeline uses).
///
/// This is the single source of truth — no hand-maintained extension list.
/// Formats `package:image` cannot decode (SVG, HEIC/AVIF) never become
/// chips, since the overlay could not render them.
bool isImagePath(String path) {
return img.findDecoderForNamedImage(p.basename(path)) != null;
}