Skip to content

Commit

Permalink
zsh import line break fix
Browse files Browse the repository at this point in the history
Related to #1555, #98.
  • Loading branch information
danielfleischer committed Sep 17, 2024
1 parent 6e15286 commit 3974e60
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions crates/atuin-client/src/import/zsh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,16 @@ impl Importer for Zsh {
_ => continue, // we can skip past things like invalid utf8
};

if let Some(s) = s.strip_suffix('\\') {
line.push_str(s);
line.push_str("\\\n");
if s.ends_with("\\\\") {
if let Some(s) = s.strip_suffix("\\\\") {
line.push_str(s);
line.push_str("\\\n");
}
} else if s.ends_with('\\') {
if let Some(s) = s.strip_suffix('\\') {
line.push_str(s);
line.push_str("\\\n");
}
} else {
line.push_str(&s);
let command = std::mem::take(&mut line);
Expand Down

0 comments on commit 3974e60

Please sign in to comment.