Skip to content

Commit

Permalink
Simplify editor example
Browse files Browse the repository at this point in the history
  • Loading branch information
hecrj committed Sep 19, 2023
1 parent 4e757a2 commit 06dc12b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions examples/editor/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 06dc12b

Please sign in to comment.