Skip to content

Commit

Permalink
Disable find by default
Browse files Browse the repository at this point in the history
  • Loading branch information
bkirwi committed Nov 6, 2022
1 parent 47a0e15 commit 1861707
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 41 deletions.
2 changes: 2 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize};
pub struct Config {
pub cell_height: i32,
pub extra_chars: Vec<String>,
pub experimental: bool,
}

impl Config {
Expand Down Expand Up @@ -32,6 +33,7 @@ impl Default for Config {
Config {
cell_height: 40,
extra_chars: vec![],
experimental: false,
}
}
}
83 changes: 42 additions & 41 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,49 +387,50 @@ impl Widget for Editor {
Button::new(&text_tab.title, Msg::SwitchTab { tab: Tab::Meta }, true)
.render_split(&mut header, Side::Left, 0.5);

Spaced(
40,
&[
Button::new(
"find",
Msg::SwitchTab {
tab: Tab::Search {
id,
contents: IndexedString::index(
text_tab.text.buffer.content_string(),
),
results: vec![],
},
},
true,
),
Button::new(
"undo",
Msg::Tab {
let mut buttons = vec![];
if self.config.experimental {
buttons.push(Button::new(
"find",
Msg::SwitchTab {
tab: Tab::Search {
id,
msg: TabMsg::Undo,
contents: IndexedString::index(
text_tab.text.buffer.content_string(),
),
results: vec![],
},
!text_tab.text.undos.is_empty(),
),
Button::new(
"redo",
Msg::Tab {
id,
msg: TabMsg::Redo,
},
!text_tab.text.redos.is_empty(),
),
Button::new(
"save",
Msg::Tab {
id,
msg: TabMsg::Save,
},
text_tab.path.is_some() && text_tab.dirty,
),
],
)
.render_placed(header, 1.0, 0.5);
},
true,
))
}
buttons.extend([
Button::new(
"undo",
Msg::Tab {
id,
msg: TabMsg::Undo,
},
!text_tab.text.undos.is_empty(),
),
Button::new(
"redo",
Msg::Tab {
id,
msg: TabMsg::Redo,
},
!text_tab.text.redos.is_empty(),
),
Button::new(
"save",
Msg::Tab {
id,
msg: TabMsg::Save,
},
text_tab.path.is_some() && text_tab.dirty,
),
]);

Spaced(40, &buttons).render_placed(header, 1.0, 0.5);
}
TabType::Shell(s) => {
Button::new(&s.title, Msg::SwitchTab { tab: Tab::Meta }, true)
Expand Down

0 comments on commit 1861707

Please sign in to comment.