summaryrefslogtreecommitdiffstats
path: root/examples/editor
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-09-19 19:35:28 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-09-19 19:35:28 +0200
commit06dc12bfbf75958c6534306b3d1b57ae47bdb37a (patch)
tree62267866366048ce3445eb096760003d17bb1975 /examples/editor
parent4e757a26d0c1c58001f31cf0592131cd5ad886ad (diff)
downloadiced-06dc12bfbf75958c6534306b3d1b57ae47bdb37a.tar.gz
iced-06dc12bfbf75958c6534306b3d1b57ae47bdb37a.tar.bz2
iced-06dc12bfbf75958c6534306b3d1b57ae47bdb37a.zip
Simplify `editor` example
Diffstat (limited to 'examples/editor')
-rw-r--r--examples/editor/src/main.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/examples/editor/src/main.rs b/examples/editor/src/main.rs
index 277eb3e9..6def2082 100644
--- a/examples/editor/src/main.rs
+++ b/examples/editor/src/main.rs
@@ -4,7 +4,7 @@ use iced::widget::{
button, column, container, horizontal_space, pick_list, row, text,
text_editor, tooltip,
};
-use iced::{Application, Command, Element, Font, Length, Settings};
+use iced::{Alignment, Application, Command, Element, Font, Length, Settings};
use highlighter::Highlighter;
@@ -169,7 +169,8 @@ impl Application for Editor {
.text_size(14)
.padding([5, 10])
]
- .spacing(10);
+ .spacing(10)
+ .align_items(Alignment::Center);
let status = row![
text(if let Some(path) = &self.file {
@@ -275,8 +276,7 @@ fn action<'a, Message: Clone + 'a>(
label: &'a str,
on_press: Option<Message>,
) -> Element<'a, Message> {
- let action =
- button(container(content).width(Length::Fill).center_x()).width(40);
+ let action = button(container(content).width(30).center_x());
if let Some(on_press) = on_press {
tooltip(
@@ -316,7 +316,7 @@ mod highlighter {
use std::ops::Range;
use syntect::highlighting;
- use syntect::parsing::{self, SyntaxReference};
+ use syntect::parsing;
#[derive(Debug, Clone, PartialEq)]
pub struct Settings {
@@ -374,7 +374,7 @@ mod highlighter {
pub struct Highlighter {
syntaxes: parsing::SyntaxSet,
- syntax: SyntaxReference,
+ syntax: parsing::SyntaxReference,
theme: highlighting::Theme,
caches: Vec<(parsing::ParseState, parsing::ScopeStack)>,
current_line: usize,