Checkpoint

This commit is contained in:
Antonio Scandurra 2023-10-20 16:31:03 +02:00
parent 8ad7ebf02f
commit a3dcaf21cb
20 changed files with 183 additions and 152 deletions

View file

@ -111,8 +111,8 @@ impl BufferRow {
#[derive(Element, Clone)]
pub struct Buffer<S: 'static + Send + Sync + Clone> {
id: ElementId,
state_type: PhantomData<S>,
scroll_state: ScrollState,
rows: Option<BufferRows>,
readonly: bool,
language: Option<String>,
@ -121,10 +121,10 @@ pub struct Buffer<S: 'static + Send + Sync + Clone> {
}
impl<S: 'static + Send + Sync + Clone> Buffer<S> {
pub fn new() -> Self {
pub fn new(id: impl Into<ElementId>) -> Self {
Self {
id: id.into(),
state_type: PhantomData,
scroll_state: ScrollState::default(),
rows: Some(BufferRows::default()),
readonly: false,
language: None,
@ -133,10 +133,6 @@ impl<S: 'static + Send + Sync + Clone> Buffer<S> {
}
}
pub fn bind_scroll_state(&mut self, scroll_state: ScrollState) {
self.scroll_state = scroll_state;
}
pub fn set_title<T: Into<Option<String>>>(mut self, title: T) -> Self {
self.title = title.into();
self