mirror of
https://github.com/sharkdp/hexyl.git
synced 2026-10-30 09:05:54 +00:00
Change columns type to u16
This commit is contained in:
1 parent
361ded43fd
commit
ab381e88f8
1 file changed
+3
-5
+3
-5
@@ -4,7 +4,7 @@ extern crate clap;
|
|||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::{self, prelude::*, SeekFrom};
|
use std::io::{self, prelude::*, SeekFrom};
|
||||||
use std::num::{NonZeroI64, NonZeroU16, NonZeroU8};
|
use std::num::{NonZeroI64, NonZeroU16};
|
||||||
|
|
||||||
use clap::{crate_name, crate_version, AppSettings, Arg, ColorChoice, Command};
|
use clap::{crate_name, crate_version, AppSettings, Arg, ColorChoice, Command};
|
||||||
|
|
||||||
@@ -308,7 +308,7 @@ fn run() -> Result<(), AnyhowError> {
|
|||||||
let columns = if let Some(columns) = matches
|
let columns = if let Some(columns) = matches
|
||||||
.value_of("columns")
|
.value_of("columns")
|
||||||
.map(|s| {
|
.map(|s| {
|
||||||
s.parse::<NonZeroU8>().map(u8::from).context(anyhow!(
|
s.parse::<NonZeroU16>().map(u16::from).context(anyhow!(
|
||||||
"failed to parse `--columns` arg {:?} as unsigned nonzero integer",
|
"failed to parse `--columns` arg {:?} as unsigned nonzero integer",
|
||||||
s
|
s
|
||||||
))
|
))
|
||||||
@@ -340,9 +340,7 @@ fn run() -> Result<(), AnyhowError> {
|
|||||||
if (terminal_width - offset) / col_width < 1 {
|
if (terminal_width - offset) / col_width < 1 {
|
||||||
1
|
1
|
||||||
} else {
|
} else {
|
||||||
((terminal_width - offset) / col_width)
|
(terminal_width - offset) / col_width
|
||||||
.try_into()
|
|
||||||
.expect("there is a maximum of 255 columns")
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
2
|
2
|
||||||
|
|||||||
Reference in new issue
Block a user