mirror of
https://github.com/TECHNOFAB11/tmux-copyrat.git
synced 2025-12-14 08:53:52 +01:00
fix: tmux options read correctly
This commit is contained in:
parent
7ce0e95c8c
commit
ae19f2b4e4
3 changed files with 11 additions and 19 deletions
|
|
@ -4,11 +4,7 @@ use std::fmt;
|
|||
use std::str::FromStr;
|
||||
|
||||
use super::basic;
|
||||
use crate::{
|
||||
error,
|
||||
textbuf::{alphabet, regexes},
|
||||
tmux, ui,
|
||||
};
|
||||
use crate::{error, textbuf::alphabet, tmux, ui};
|
||||
|
||||
/// Extended configuration for handling Tmux-specific configuration (options
|
||||
/// and outputs). This is only used by `tmux-copyrat` and parsed from command
|
||||
|
|
@ -61,18 +57,12 @@ impl ConfigExt {
|
|||
|
||||
for (name, value) in &tmux_options {
|
||||
match name.as_ref() {
|
||||
"@copyrat-capture" => {
|
||||
"@copyrat-capture-region" => {
|
||||
config_ext.capture_region = CaptureRegion::from_str(&value)?
|
||||
}
|
||||
"@copyrat-alphabet" => {
|
||||
wrapped.alphabet = alphabet::parse_alphabet(value)?;
|
||||
}
|
||||
"@copyrat-pattern-name" => {
|
||||
wrapped.named_patterns = vec![regexes::parse_pattern_name(value)?]
|
||||
}
|
||||
"@copyrat-custom-pattern" => {
|
||||
wrapped.custom_patterns = vec![String::from(value)]
|
||||
}
|
||||
"@copyrat-reverse" => {
|
||||
wrapped.reverse = value.parse::<bool>()?;
|
||||
}
|
||||
|
|
@ -127,8 +117,8 @@ impl FromStr for CaptureRegion {
|
|||
|
||||
fn from_str(s: &str) -> Result<Self, error::ParseError> {
|
||||
match s {
|
||||
"leading" => Ok(CaptureRegion::EntireHistory),
|
||||
"trailing" => Ok(CaptureRegion::VisibleArea),
|
||||
"entire-history" => Ok(CaptureRegion::EntireHistory),
|
||||
"visible-area" => Ok(CaptureRegion::VisibleArea),
|
||||
_ => Err(error::ParseError::ExpectedString(String::from(
|
||||
"entire-history or visible-area",
|
||||
))),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue