From e336aa18b594c3cf3f05d78a6f677f1e38b14ba4 Mon Sep 17 00:00:00 2001 From: Yash Sharma Date: Tue, 7 May 2024 21:30:16 -0700 Subject: [PATCH] attempts to fix #13 --- Cargo.lock | 7 +++++++ Cargo.toml | 1 + src/inputs/events.rs | 9 ++------- src/ui/text_box.rs | 2 +- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 91718a8..04a169e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1111,6 +1111,12 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "portable-atomic" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" + [[package]] name = "proc-macro2" version = "1.0.74" @@ -1257,6 +1263,7 @@ dependencies = [ "log", "ngrammatic", "parking_lot", + "portable-atomic", "ratatui", "regex", "reqwest", diff --git a/Cargo.toml b/Cargo.toml index 92780bb..12c201f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,3 +34,4 @@ base64 = "0.22.0" bunt = "0.2.8" strum = "0.26.2" strum_macros = "0.26.2" +portable-atomic = "1.6.0" diff --git a/src/inputs/events.rs b/src/inputs/events.rs index 450b7d5..7a3b3aa 100644 --- a/src/inputs/events.rs +++ b/src/inputs/events.rs @@ -1,12 +1,7 @@ use super::{key::Key, mouse::Mouse, InputEvent}; use log::error; -use std::{ - sync::{ - atomic::{AtomicBool, Ordering}, - Arc, - }, - time::Duration, -}; +use portable_atomic::{AtomicBool, Ordering}; +use std::{sync::Arc, time::Duration}; pub struct Events { rx: tokio::sync::mpsc::Receiver, diff --git a/src/ui/text_box.rs b/src/ui/text_box.rs index de3e861..d714dba 100644 --- a/src/ui/text_box.rs +++ b/src/ui/text_box.rs @@ -4,6 +4,7 @@ use crate::{ inputs::key::Key, util::{num_digits, replace_tabs, spaces}, }; +use portable_atomic::{AtomicU64, Ordering}; use ratatui::{ buffer::Buffer, layout::{Alignment, Rect}, @@ -14,7 +15,6 @@ use ratatui::{ use std::{ cmp, collections::VecDeque, - sync::atomic::{AtomicU64, Ordering}, }; #[derive(Clone, Debug)]