summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2023-09-13 07:59:33 +0000
committerGitHub <noreply@github.com>2023-09-13 07:59:33 +0000
commit47ea974f54a0afdd40815ee3479bdb8f52238316 (patch)
treea1faeabb8b40a7dd9a3263747a057386eb8bda19
parent93bb5a96097b10c850bc33dda343327c666be341 (diff)
Bump ratatui from 0.22.0 to 0.23.0 (#1221)
Bumps [ratatui](https://github.com/ratatui-org/ratatui) from 0.22.0 to 0.23.0. - [Release notes](https://github.com/ratatui-org/ratatui/releases) - [Changelog](https://github.com/ratatui-org/ratatui/blob/main/CHANGELOG.md) - [Commits](https://github.com/ratatui-org/ratatui/compare/v0.22.0...v0.23.0) --- updated-dependencies: - dependency-name: ratatui dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
-rw-r--r--Cargo.lock48
-rw-r--r--atuin/Cargo.toml2
2 files changed, 29 insertions, 21 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 5140b781..8074943d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -153,7 +153,7 @@ dependencies = [
"clap",
"clap_complete",
"colored",
- "crossterm 0.27.0",
+ "crossterm",
"directories",
"env_logger",
"eyre",
@@ -683,22 +683,6 @@ dependencies = [
[[package]]
name = "crossterm"
-version = "0.26.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a84cda67535339806297f1b331d6dd6320470d2a0fe65381e79ee9e156dd3d13"
-dependencies = [
- "bitflags 1.3.2",
- "crossterm_winapi",
- "libc",
- "mio",
- "parking_lot",
- "signal-hook",
- "signal-hook-mio",
- "winapi",
-]
-
-[[package]]
-name = "crossterm"
version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df"
@@ -2128,15 +2112,17 @@ dependencies = [
[[package]]
name = "ratatui"
-version = "0.22.0"
+version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8285baa38bdc9f879d92c0e37cb562ef38aa3aeefca22b3200186bc39242d3d5"
+checksum = "2e2e4cd95294a85c3b4446e63ef054eea43e0205b1fd60120c16b74ff7ff96ad"
dependencies = [
"bitflags 2.4.0",
"cassowary",
- "crossterm 0.26.1",
+ "crossterm",
"indoc",
+ "itertools",
"paste",
+ "strum",
"unicode-segmentation",
"unicode-width",
]
@@ -2991,6 +2977,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
+name = "strum"
+version = "0.25.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125"
+dependencies = [
+ "strum_macros",
+]
+
+[[package]]
+name = "strum_macros"
+version = "0.25.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ad8d03b598d3d0fff69bf533ee3ef19b8eeb342729596df84bcc7e1f96ec4059"
+dependencies = [
+ "heck",
+ "proc-macro2",
+ "quote",
+ "rustversion",
+ "syn 2.0.32",
+]
+
+[[package]]
name = "subtle"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/atuin/Cargo.toml b/atuin/Cargo.toml
index ac426cd1..462da3d8 100644
--- a/atuin/Cargo.toml
+++ b/atuin/Cargo.toml
@@ -70,7 +70,7 @@ tiny-bip39 = "1"
futures-util = "0.3"
fuzzy-matcher = "0.3.7"
colored = "2.0.4"
-ratatui = "0.22"
+ratatui = "0.23"
tracing = "0.1"
pe Batcher struct {
+ *fsnotify.Watcher
+ interval time.Duration
+ done chan struct{}
+
+ Event chan []*fsnotify.FileEvent // Events are returned on this channel
+}
+
+func New(interval time.Duration) (*Batcher, error) {
+ watcher, err := fsnotify.NewWatcher()
+
+ batcher := &Batcher{}
+ batcher.Watcher = watcher
+ batcher.interval = interval
+ batcher.done = make(chan struct{}, 1)
+ batcher.Event = make(chan []*fsnotify.FileEvent, 1)
+
+ if err == nil {
+ go batcher.run()
+ }
+
+ return batcher, err
+}
+
+func (b *Batcher) run() {
+ tick := time.Tick(b.interval)
+ evs := make([]*fsnotify.FileEvent, 0)
+OuterLoop:
+ for {
+ select {
+ case ev := <-b.Watcher.Event:
+ evs = append(evs, ev)
+ case <-tick:
+ if len(evs) == 0 {
+ continue
+ }
+ b.Event <- evs
+ evs = make([]*fsnotify.FileEvent, 0)
+ case <-b.done:
+ break OuterLoop
+ }
+ }
+ close(b.done)
+}
+
+func (b *Batcher) Close() {
+ b.done <- struct{}{}
+ b.Watcher.Close()
+}