mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-04 07:21:14 -03:00
Add the commandline to the OSC 133 command start
Given $ cat ~/.config/kitty/kitty.conf notify_on_cmd_finish unfocused 0.1 command notify-send "job finished with status: %s" %c kitty will send a notification whenever a long-running (>.1s) foreground command finishes while kitty is not focused. The %c placeholder will be replaced by the commandline. This is passed via the OSC 133 command start marker, kitty's fish shell integration. That integration has been disabled for fish 4.0.0 because it's no longer necessary since fish already prints OSC 133. But we missed the parameter for the command string. Fix it. (It's debatable whether the shell or the terminal should provide this feature but I think we should fix this regression?) Closes #11203 See https://github.com/kovidgoyal/kitty/issues/8385#issuecomment-2692659161
This commit is contained in:
@@ -105,6 +105,7 @@
|
||||
use crate::operation_context::{get_bg_context, OperationContext};
|
||||
use crate::output::parse_color;
|
||||
use crate::output::parse_color_maybe_none;
|
||||
use crate::output::BufferedOuputter;
|
||||
use crate::output::Outputter;
|
||||
use crate::pager::{PageRendering, Pager, SelectionMotion};
|
||||
use crate::panic::AT_EXIT;
|
||||
@@ -690,8 +691,13 @@ fn read_i(parser: &Parser) -> i32 {
|
||||
|
||||
data.clear(EditableLineTag::Commandline);
|
||||
data.update_buff_pos(EditableLineTag::Commandline, None);
|
||||
// OSC 133 End of command
|
||||
data.screen.write_bytes(b"\x1b]133;C\x07");
|
||||
// OSC 133 "Command start"
|
||||
write!(
|
||||
BufferedOuputter::new(&mut Outputter::stdoutput().borrow_mut()),
|
||||
"\x1b]133;C;cmdline_url={}\x07",
|
||||
escape_string(&command, EscapeStringStyle::Url),
|
||||
)
|
||||
.unwrap();
|
||||
event::fire_generic(parser, L!("fish_preexec").to_owned(), vec![command.clone()]);
|
||||
let eval_res = reader_run_command(parser, &command);
|
||||
signal_clear_cancel();
|
||||
|
||||
Reference in New Issue
Block a user