Rename wrap setting to word_wrap
This commit is contained in:
parent
27523ef3ea
commit
621e9d75eb
4 changed files with 12 additions and 10 deletions
|
|
@ -39,7 +39,7 @@ impl KeyBind {
|
|||
bind!(CTRL, O, OpenFileDialog);
|
||||
bind!(CTRL, S, Save);
|
||||
bind!(CTRL, Q, Quit);
|
||||
bind!(ALT, Z, ToggleWrap);
|
||||
bind!(ALT, Z, ToggleWordWrap);
|
||||
|
||||
keybinds
|
||||
}
|
||||
|
|
@ -65,7 +65,7 @@ impl fmt::Display for KeyBind {
|
|||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Config {
|
||||
pub wrap: bool,
|
||||
pub word_wrap: bool,
|
||||
pub keybinds: HashMap<KeyBind, Message>,
|
||||
}
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ impl Config {
|
|||
//TODO: load from cosmic-config
|
||||
pub fn load() -> Self {
|
||||
Self {
|
||||
wrap: false,
|
||||
word_wrap: false,
|
||||
keybinds: KeyBind::load(),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ pub enum Message {
|
|||
TabActivate(segmented_button::Entity),
|
||||
TabClose(segmented_button::Entity),
|
||||
Todo,
|
||||
ToggleWrap,
|
||||
ToggleWordWrap,
|
||||
}
|
||||
|
||||
impl App {
|
||||
|
|
@ -539,8 +539,8 @@ impl cosmic::Application for App {
|
|||
Message::Todo => {
|
||||
log::warn!("TODO");
|
||||
}
|
||||
Message::ToggleWrap => {
|
||||
self.config.wrap = !self.config.wrap;
|
||||
Message::ToggleWordWrap => {
|
||||
self.config.word_wrap = !self.config.word_wrap;
|
||||
//TODO: provide iterator over data
|
||||
let entities: Vec<_> = self.tab_model.iter().collect();
|
||||
for entity in entities {
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ pub fn menu_bar<'a>(config: &Config) -> Element<'a, Message> {
|
|||
],
|
||||
),
|
||||
MenuTree::new(horizontal_rule(1)),
|
||||
menu_checkbox(fl!("word-wrap"), config.wrap, Message::ToggleWrap),
|
||||
menu_checkbox(fl!("word-wrap"), config.word_wrap, Message::ToggleWordWrap),
|
||||
menu_checkbox(fl!("show-line-numbers"), false, Message::Todo),
|
||||
menu_checkbox(fl!("highlight-current-line"), false, Message::Todo),
|
||||
menu_item(fl!("syntax-highlighting"), Message::Todo),
|
||||
|
|
|
|||
|
|
@ -45,9 +45,11 @@ impl Tab {
|
|||
let mut editor = self.editor.lock().unwrap();
|
||||
let mut font_system = FONT_SYSTEM.lock().unwrap();
|
||||
let mut editor = editor.borrow_with(&mut font_system);
|
||||
editor
|
||||
.buffer_mut()
|
||||
.set_wrap(if config.wrap { Wrap::Word } else { Wrap::None });
|
||||
editor.buffer_mut().set_wrap(if config.word_wrap {
|
||||
Wrap::Word
|
||||
} else {
|
||||
Wrap::None
|
||||
});
|
||||
}
|
||||
|
||||
pub fn open(&mut self, path: PathBuf) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue