mirror of
https://seed.radicle.dev/rad:z39mP9rQAaGmERfUMPULfPUi473tY.git
synced 2026-11-16 08:20:39 +08:00
feat(lib): Make widget states (de)serializable
This commit is contained in:
Generated
+5
@@ -300,6 +300,9 @@ name = "bitflags"
|
||||
version = "2.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "block-buffer"
|
||||
@@ -468,6 +471,7 @@ dependencies = [
|
||||
"itoa",
|
||||
"rustversion",
|
||||
"ryu",
|
||||
"serde",
|
||||
"static_assertions",
|
||||
]
|
||||
|
||||
@@ -2095,6 +2099,7 @@ dependencies = [
|
||||
"itertools",
|
||||
"lru",
|
||||
"paste",
|
||||
"serde",
|
||||
"strum",
|
||||
"termion 4.0.2",
|
||||
"time 0.3.34",
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ radicle-term = { version = "0.12.0" }
|
||||
radicle-cli = { version = "0.12.1" }
|
||||
radicle-surf = { version = "0.22.0" }
|
||||
radicle-signals = { version = "0.10.0" }
|
||||
ratatui = { version = "0.29.0", default-features = false, features = ["all-widgets", "termion"] }
|
||||
ratatui = { version = "0.29.0", default-features = false, features = ["all-widgets", "termion", "serde"] }
|
||||
simple-logging = { version = "2.0.2" }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = { version = "1.0" }
|
||||
|
||||
+6
-5
@@ -6,6 +6,7 @@ use ratatui::text::{Line, Span, Text};
|
||||
use ratatui::widgets::{Block, BorderType, Row, Scrollbar, ScrollbarState};
|
||||
use ratatui::Frame;
|
||||
use ratatui::{layout::Constraint, widgets::Paragraph};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use termion::event::Key;
|
||||
|
||||
use crate::ui::ext::{FooterBlock, FooterBlockType, HeaderBlock};
|
||||
@@ -60,7 +61,7 @@ impl Window {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct PanesState {
|
||||
len: usize,
|
||||
focus: Option<usize>,
|
||||
@@ -151,7 +152,7 @@ impl<'a> Panes<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct CompositeState {
|
||||
len: usize,
|
||||
focus: usize,
|
||||
@@ -235,7 +236,7 @@ impl<'a> Widget for Label<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct TableState {
|
||||
internal: ratatui::widgets::TableState,
|
||||
}
|
||||
@@ -660,7 +661,7 @@ impl<'a> Widget for Bar<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct TextViewState {
|
||||
cursor: Position,
|
||||
}
|
||||
@@ -879,7 +880,7 @@ impl<'a> Widget for CenteredTextView<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct TextEditState {
|
||||
pub text: String,
|
||||
pub cursor: usize,
|
||||
|
||||
Reference in New Issue
Block a user