Skip to content

Commit

Permalink
#43: fix negative positions
Browse files Browse the repository at this point in the history
  • Loading branch information
russelltg committed Dec 4, 2023
1 parent 4758a45 commit eabd6dd
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ pub struct Args {
)]
filename: String,

#[clap(long, short, value_parser=parse_geometry, help="geometry to capture, format x,y WxH. Compatiable with the output of `slurp`. Mutually exclusive with --output")]
geometry: Option<(u32, u32, u32, u32)>,
#[clap(long, short, value_parser=parse_geometry, help="geometry to capture, format x,y WxH. Compatiable with the output of `slurp`. Mutually exclusive with --output", allow_hyphen_values=true)]
geometry: Option<(i32, i32, u32, u32)>,

#[clap(
long,
Expand Down Expand Up @@ -216,7 +216,7 @@ enum ParseGeometryError {
Size,
}

fn parse_geometry(s: &str) -> Result<(u32, u32, u32, u32), ParseGeometryError> {
fn parse_geometry(s: &str) -> Result<(i32, i32, u32, u32), ParseGeometryError> {
use ParseGeometryError::*;
let mut it = s.split(' ');
let loc = it.next().ok_or(Structure)?;
Expand Down Expand Up @@ -1024,8 +1024,6 @@ impl State {
}
}
(Some((x, y, w, h)), "") => {
let x = x as i32;

This comment has been minimized.

Copy link
@ThatOneCalculator

ThatOneCalculator Jan 12, 2024

This completely ignores x & y.

let y = y as i32;
let w = w as i32;
let h = h as i32;
// --geometry but no --output
Expand Down

0 comments on commit eabd6dd

Please sign in to comment.