in crates/alacritty_terminal/src/term/mod.rs [806:860]
fn new_cmd_internal(&mut self, force: bool, session_id: Option<&str>)
where
T: EventListener,
{
if let Some(remote_session_id) = session_id {
if remote_session_id.is_empty() {
// fallback for old shell integrations
trace!("NewCmd check remote_session_id == \"\"");
} else if let Some(local_session_id) = &self.shell_state.local_context.session_id {
trace!(
"NewCmd check {remote_session_id} != {local_session_id}: {:?}",
remote_session_id != local_session_id
);
if remote_session_id != local_session_id {
return;
}
}
}
if self.windows_delay_end_prompt && !force {
self.delayed_events.push(DelayedEvent::NewCmd);
return;
}
trace!("Fig new command");
self.shell_state.cmd_cursor = Some(self.grid().cursor.point);
trace!("New command cursor: {:?}", self.shell_state.cmd_cursor);
// Add work around for emojis
if let Ok(cursor_offset) = std::env::var("Q_PROMPT_OFFSET_WORKAROUND") {
if let Ok(offset) = cursor_offset.parse::<i32>() {
self.shell_state.cmd_cursor = self.shell_state.cmd_cursor.map(|cursor| Point {
column: Column((cursor.column.0 as i32 - offset).max(0) as usize),
line: cursor.line,
});
trace!(
"Command cursor offset by '{}' to {:?}",
offset, self.shell_state.cmd_cursor
);
}
}
self.shell_state.preexec = false;
self.event_proxy.send_event(Event::Prompt, &self.shell_state);
trace!("Prompt event sent");
if let Some(command) = self.shell_state.command_info.take() {
self.event_proxy
.send_event(Event::CommandInfo(&command), &self.shell_state);
trace!("Command info event sent");
}
}