зеркало из
https://github.com/glebtv/tui-textarea.git
synced 2026-08-28 11:36:17 +03:00
* chore: migrate to Rust 2024 edition and bump to v0.9.2 - Bump edition to 2024 and rust-version to 1.85.0 - Replace f64::log10 with usize::ilog10 in num_digits - Fix clippy lints surfaced by edition bump: repeat_n, derived Default, then_some - Expand watch-check and watch-test aliases to cover all feature paths (crossterm_0_28, no-backend, tuirs variants, serde, arbitrary) - Expand CI test and clippy workflows to full 6/8-entry feature matrices including termion on Ubuntu - Apply rustfmt import reordering from edition 2024 rules * fix: revert turis linux checks
22 строки
672 B
Rust
22 строки
672 B
Rust
pub fn spaces(size: u8) -> &'static str {
|
|
const SPACES: &str = " ";
|
|
&SPACES[..size as usize]
|
|
}
|
|
|
|
pub fn num_digits(i: usize) -> u8 {
|
|
if i == 0 { 1 } else { i.ilog10() as u8 + 1 }
|
|
}
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub struct Pos {
|
|
pub row: usize,
|
|
pub col: usize,
|
|
pub offset: usize,
|
|
}
|
|
|
|
impl Pos {
|
|
pub fn new(row: usize, col: usize, offset: usize) -> Self {
|
|
Self { row, col, offset }
|
|
}
|
|
}
|