feat(windows): add text channel with preview offset for windows (#514)

![image](https://github.com/user-attachments/assets/9f8935db-82fe-4235-8584-ab8b0508b20f)
This commit is contained in:
Alex Pasmantier 2025-05-16 12:23:09 +02:00 committed by GitHub
parent d106adafc0
commit 3b3a0ec1ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 1 deletions

View File

@ -4,6 +4,14 @@ name = "files"
source_command = "Get-ChildItem -Recurse -File | Select-Object -ExpandProperty FullName"
preview.command = "bat -n --color=always {}"
# Text
[[cable_channel]]
name = "text"
source_command = "rg . --no-heading --line-number"
preview.command = "bat -n --color=always {0}"
preview.delimiter = ":"
preview.offset = "{1}"
# Directories
[[cable_channel]]
name = "dirs"

View File

@ -85,7 +85,12 @@ impl Channel {
};
return Entry::new(name).with_line_number(
offset_str.parse::<usize>().unwrap(),
offset_str.parse::<usize>().unwrap_or_else(|_| {
panic!(
"Failed to parse line number from {}",
offset_str
);
}),
);
}
}