diff --git a/src/parser.rs b/src/parser.rs index f8a71d182..4d8462ff0 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -30,6 +30,7 @@ use crate::util::get_time; use crate::wait_handle::WaitHandleStore; use crate::wchar::{wstr, WString, L}; +use crate::wchar_ext::WExt; use crate::wutil::{perror, wgettext, wgettext_fmt}; use crate::{function, FLOG}; use libc::c_int; @@ -1067,7 +1068,7 @@ pub fn job_get_with_index_from_pid(&self, pid: Pid) -> Option<(usize, JobRef)> { /// Returns a new profile item if profiling is active. The caller should fill it in. /// The Parser will deallocate it. - /// If profiling is not active, this returns nullptr. + /// If profiling is not active, this returns None. pub fn create_profile_item(&self) -> Option { if PROFILING_ACTIVE.load() { let mut profile_items = self.profile_items.borrow_mut(); @@ -1271,7 +1272,12 @@ fn print_profile(items: &[ProfileItem], out: &mut File) { ) .as_bytes(), ); - let _ = out.write_all(&wcs2string(&item.cmd)); + let indentation_level = col_width + 1 + col_width + 1 + level + 1; + let indented_cmd = item.cmd.replace( + L!("\n"), + &(WString::from("\n") + &wstr::repeat(L!(" "), indentation_level)[..]), + ); + let _ = out.write_all(&wcs2string(&indented_cmd)); let _ = out.write_all(b"\n"); } }