Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ansi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ pub fn explain_ansi(line: &str, colorful: bool) -> String {
if colorful {
format!("({}){}", style.to_painted_string(), style.paint(s))
} else {
format!("({}){}", style.to_string(), s)
format!("({}){}", style, s)
}
})
.collect()
Expand Down
12 changes: 10 additions & 2 deletions src/handlers/blame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,9 @@ lazy_static! {
(
\^?[0-9a-f]{4,40} # commit hash (^ is 'boundary commit' marker)
)
(?: .+)? # optional file name (unused; present if file has been renamed; TODO: inefficient?)
(?: [^(]+)? # optional file name (unused; present if file has been renamed; TODO: inefficient?)
[\ ]
\( # open (
\( # open ( which the previous file name may not contain in case a name does (which is more likely)
(
[^\ ].*[^\ ] # author name
)
Expand Down Expand Up @@ -297,6 +297,14 @@ mod tests {
}
}

#[test]
fn test_blame_line_with_parens_in_name() {
let line =
"61f180c8 (Kangwook Lee (이강욱) 2021-06-09 23:33:59 +0900 130) let mut output_type =";
let caps = BLAME_LINE_REGEX.captures(line).unwrap();
assert_eq!(caps.get(2).unwrap().as_str(), "Kangwook Lee (이강욱)");
}

#[test]
fn test_color_assignment() {
let mut writer = Cursor::new(vec![0; 512]);
Expand Down
2 changes: 1 addition & 1 deletion src/utils/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ where
*/

let pid_range = my_pid.saturating_sub(10)..my_pid.saturating_add(20);
for p in pid_range.clone() {
for p in pid_range {
// Processes which were not refreshed do not exist for sysinfo, so by selectively
// letting it know about processes the `find_sibling..` function will only
// consider these.
Expand Down