chore: run cargo fmt
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
pub mod tabs;
|
pub mod action_bar;
|
||||||
pub mod editor;
|
pub mod editor;
|
||||||
pub mod status_bar;
|
pub mod status_bar;
|
||||||
pub mod action_bar;
|
pub mod tabs;
|
||||||
|
|||||||
@@ -11,8 +11,9 @@ pub fn view<'a>(files: &'a [File], active_index: usize) -> Element<'a, Message>
|
|||||||
let is_focused = index == active_index;
|
let is_focused = index == active_index;
|
||||||
|
|
||||||
let label = text(file.display_name());
|
let label = text(file.display_name());
|
||||||
let close_btn =
|
let close_btn = button(text("x"))
|
||||||
button(text("x")).padding(1).on_press(Message::FileActionSelected(FileAction::Close(Some(index))));
|
.padding(1)
|
||||||
|
.on_press(Message::FileActionSelected(FileAction::Close(Some(index))));
|
||||||
|
|
||||||
button(
|
button(
|
||||||
row![label, close_btn]
|
row![label, close_btn]
|
||||||
@@ -62,7 +63,7 @@ pub fn view<'a>(files: &'a [File], active_index: usize) -> Element<'a, Message>
|
|||||||
bottom: 0.0,
|
bottom: 0.0,
|
||||||
}))
|
}))
|
||||||
.direction(scrollable::Direction::Horizontal(
|
.direction(scrollable::Direction::Horizontal(
|
||||||
scrollable::Scrollbar::new().spacing(1)
|
scrollable::Scrollbar::new().spacing(1),
|
||||||
))
|
))
|
||||||
.style(|theme: &Theme, status: scrollable::Status| {
|
.style(|theme: &Theme, status: scrollable::Status| {
|
||||||
let mut style = scrollable::default(theme, status);
|
let mut style = scrollable::default(theme, status);
|
||||||
|
|||||||
+10
-4
@@ -1,4 +1,7 @@
|
|||||||
use std::{ffi, path::{Path, PathBuf}};
|
use std::{
|
||||||
|
ffi,
|
||||||
|
path::{Path, PathBuf},
|
||||||
|
};
|
||||||
|
|
||||||
use iced::widget::{markdown, text_editor};
|
use iced::widget::{markdown, text_editor};
|
||||||
|
|
||||||
@@ -59,14 +62,16 @@ impl File {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn extension(&self) -> Option<&str> {
|
pub fn extension(&self) -> Option<&str> {
|
||||||
self.path
|
self
|
||||||
|
.path
|
||||||
.as_deref()
|
.as_deref()
|
||||||
.and_then(Path::extension)
|
.and_then(Path::extension)
|
||||||
.and_then(ffi::OsStr::to_str)
|
.and_then(ffi::OsStr::to_str)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn display_name(&self) -> &str {
|
pub fn display_name(&self) -> &str {
|
||||||
self.path
|
self
|
||||||
|
.path
|
||||||
.as_deref()
|
.as_deref()
|
||||||
.and_then(|p| p.file_name())
|
.and_then(|p| p.file_name())
|
||||||
.and_then(|n| n.to_str())
|
.and_then(|n| n.to_str())
|
||||||
@@ -79,7 +84,8 @@ impl File {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn path_summary(&self) -> String {
|
pub fn path_summary(&self) -> String {
|
||||||
self.path
|
self
|
||||||
|
.path
|
||||||
.as_deref()
|
.as_deref()
|
||||||
.map(|p| p.to_string_lossy().to_string())
|
.map(|p| p.to_string_lossy().to_string())
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
|
|||||||
+1
-1
@@ -2,8 +2,8 @@ use std::path::PathBuf;
|
|||||||
|
|
||||||
use iced::widget::text_editor;
|
use iced::widget::text_editor;
|
||||||
|
|
||||||
use crate::{constants, file};
|
|
||||||
use crate::message::{FileAction, ViewAction};
|
use crate::message::{FileAction, ViewAction};
|
||||||
|
use crate::{constants, file};
|
||||||
|
|
||||||
#[derive(Default, Copy, Clone)]
|
#[derive(Default, Copy, Clone)]
|
||||||
pub enum Mode {
|
pub enum Mode {
|
||||||
|
|||||||
Reference in New Issue
Block a user