Remove conditional compilation

This commit is contained in:
Mattias Eriksson 2024-01-22 08:10:57 +01:00
parent 45dd5aa46e
commit c90b5f67e5
2 changed files with 6 additions and 17 deletions

View file

@ -61,7 +61,6 @@ pub fn key_binds() -> HashMap<KeyBind, Action> {
bind!([Ctrl, Shift], Q, WindowClose); bind!([Ctrl, Shift], Q, WindowClose);
bind!([Ctrl, Shift], T, TabNew); bind!([Ctrl, Shift], T, TabNew);
bind!([Ctrl, Shift], V, Paste); bind!([Ctrl, Shift], V, Paste);
#[cfg(target_family = "unix")]
bind!([Shift], Insert, PastePrimary); bind!([Shift], Insert, PastePrimary);
bind!([Ctrl, Shift], W, TabClose); bind!([Ctrl, Shift], W, TabClose);

View file

@ -166,7 +166,6 @@ pub struct Flags {
#[derive(Clone, Copy, Debug, Eq, PartialEq)] #[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum Action { pub enum Action {
Copy, Copy,
#[cfg(target_family = "unix")]
CopyPrimary, CopyPrimary,
Find, Find,
PaneFocusDown, PaneFocusDown,
@ -177,7 +176,6 @@ pub enum Action {
PaneSplitVertical, PaneSplitVertical,
PaneToggleMaximized, PaneToggleMaximized,
Paste, Paste,
#[cfg(target_family = "unix")]
PastePrimary, PastePrimary,
SelectAll, SelectAll,
Settings, Settings,
@ -206,7 +204,6 @@ impl Action {
pub fn message(self, entity_opt: Option<segmented_button::Entity>) -> Message { pub fn message(self, entity_opt: Option<segmented_button::Entity>) -> Message {
match self { match self {
Action::Copy => Message::Copy(entity_opt), Action::Copy => Message::Copy(entity_opt),
#[cfg(target_family = "unix")]
Action::CopyPrimary => Message::CopyPrimary(entity_opt), Action::CopyPrimary => Message::CopyPrimary(entity_opt),
Action::Find => Message::Find(true), Action::Find => Message::Find(true),
Action::PaneFocusDown => Message::PaneFocusAdjacent(pane_grid::Direction::Down), Action::PaneFocusDown => Message::PaneFocusAdjacent(pane_grid::Direction::Down),
@ -217,7 +214,6 @@ impl Action {
Action::PaneSplitVertical => Message::PaneSplit(pane_grid::Axis::Vertical), Action::PaneSplitVertical => Message::PaneSplit(pane_grid::Axis::Vertical),
Action::PaneToggleMaximized => Message::PaneToggleMaximized, Action::PaneToggleMaximized => Message::PaneToggleMaximized,
Action::Paste => Message::Paste(entity_opt), Action::Paste => Message::Paste(entity_opt),
#[cfg(target_family = "unix")]
Action::PastePrimary => Message::PastePrimary(entity_opt), Action::PastePrimary => Message::PastePrimary(entity_opt),
Action::SelectAll => Message::SelectAll(entity_opt), Action::SelectAll => Message::SelectAll(entity_opt),
Action::Settings => Message::ToggleContextPage(ContextPage::Settings), Action::Settings => Message::ToggleContextPage(ContextPage::Settings),
@ -263,7 +259,6 @@ pub enum Message {
FindNext, FindNext,
FindPrevious, FindPrevious,
FindSearchValueChanged(String), FindSearchValueChanged(String),
#[cfg(target_family = "unix")]
MiddleClick(pane_grid::Pane, Option<segmented_button::Entity>), MiddleClick(pane_grid::Pane, Option<segmented_button::Entity>),
PaneClicked(pane_grid::Pane), PaneClicked(pane_grid::Pane),
PaneSplit(pane_grid::Axis), PaneSplit(pane_grid::Axis),
@ -273,7 +268,6 @@ pub enum Message {
PaneResized(pane_grid::ResizeEvent), PaneResized(pane_grid::ResizeEvent),
Modifiers(Modifiers), Modifiers(Modifiers),
Paste(Option<segmented_button::Entity>), Paste(Option<segmented_button::Entity>),
#[cfg(target_family = "unix")]
PastePrimary(Option<segmented_button::Entity>), PastePrimary(Option<segmented_button::Entity>),
PasteValue(Option<segmented_button::Entity>, String), PasteValue(Option<segmented_button::Entity>, String),
SelectAll(Option<segmented_button::Entity>), SelectAll(Option<segmented_button::Entity>),
@ -1072,7 +1066,6 @@ impl Application for App {
Message::FindSearchValueChanged(value) => { Message::FindSearchValueChanged(value) => {
self.find_search_value = value; self.find_search_value = value;
} }
#[cfg(target_family = "unix")]
Message::MiddleClick(pane, entity_opt) => { Message::MiddleClick(pane, entity_opt) => {
self.pane_model.focus = pane; self.pane_model.focus = pane;
return Command::batch([ return Command::batch([
@ -1134,7 +1127,6 @@ impl Application for App {
None => message::none(), None => message::none(),
}); });
} }
#[cfg(target_family = "unix")]
Message::PastePrimary(entity_opt) => { Message::PastePrimary(entity_opt) => {
return clipboard::read_primary(move |value_opt| match value_opt { return clipboard::read_primary(move |value_opt| match value_opt {
Some(value) => message::app(Message::PasteValue(entity_opt, value)), Some(value) => message::app(Message::PasteValue(entity_opt, value)),
@ -1450,16 +1442,14 @@ impl Application for App {
.unwrap_or_else(widget::Id::unique); .unwrap_or_else(widget::Id::unique);
match tab_model.data::<Mutex<Terminal>>(entity) { match tab_model.data::<Mutex<Terminal>>(entity) {
Some(terminal) => { Some(terminal) => {
let mut terminal_box = terminal_box(terminal).id(terminal_id).on_context_menu( let terminal_box = terminal_box(terminal)
move |position_opt| Message::TabContextMenu(entity, position_opt), .id(terminal_id)
); .on_context_menu(move |position_opt| {
Message::TabContextMenu(entity, position_opt)
#[cfg(target_family = "unix")] })
{ .on_middle_click(move || {
terminal_box = terminal_box.on_middle_click(move || {
Message::MiddleClick(pane, Some(entity_middle_click)) Message::MiddleClick(pane, Some(entity_middle_click))
}); });
}
let context_menu = { let context_menu = {
let terminal = terminal.lock().unwrap(); let terminal = terminal.lock().unwrap();