Rename new modules to old module names

This commit is contained in:
Joscha 2023-04-17 10:14:01 +02:00
parent bc8c5968d6
commit 21bb87fd45
24 changed files with 46 additions and 46 deletions

View file

@ -1,9 +1,9 @@
mod chat2;
mod chat;
mod euph;
mod input;
mod rooms;
mod util2;
mod widgets2;
mod util;
mod widgets;
use std::convert::Infallible;
use std::io;
@ -23,11 +23,11 @@ use crate::macros::{logging_unwrap, ok_or_return, some_or_return};
use crate::util::InfallibleExt;
use crate::vault::Vault;
pub use self::chat2::ChatMsg;
use self::chat2::ChatState;
pub use self::chat::ChatMsg;
use self::chat::ChatState;
use self::input::{key, InputEvent, KeyBindingsList};
use self::rooms::Rooms;
use self::widgets2::ListState;
use self::widgets::ListState;
/// Time to spend batch processing events before redrawing the screen.
const EVENT_PROCESSING_TIME: Duration = Duration::from_millis(1000 / 15); // 15 fps

View file

@ -16,7 +16,7 @@ use toss::{AsyncWidget, Frame, Pos, Size, Terminal, WidthDb};
use crate::store::{Msg, MsgStore};
use crate::ui::input::{key, InputEvent, KeyBindingsList};
use crate::ui::{util2, ChatMsg, UiError};
use crate::ui::{util, ChatMsg, UiError};
use crate::util::InfallibleExt;
use self::renderer::{TreeContext, TreeRenderer};
@ -255,7 +255,7 @@ impl<M: Msg, S: MsgStore<M>> TreeViewState<M, S> {
fn list_editor_key_bindings(&self, bindings: &mut KeyBindingsList) {
bindings.binding("esc", "close editor");
bindings.binding("enter", "send message");
util2::list_editor_key_bindings_allowing_external_editing(bindings, |_| true);
util::list_editor_key_bindings_allowing_external_editing(bindings, |_| true);
}
#[allow(clippy::too_many_arguments)]
@ -289,7 +289,7 @@ impl<M: Msg, S: MsgStore<M>> TreeViewState<M, S> {
}
_ => {
let handled = util2::handle_editor_input_event_allowing_external_editing(
let handled = util::handle_editor_input_event_allowing_external_editing(
editor,
terminal,
crossterm_lock,

View file

@ -8,9 +8,9 @@ use toss::widgets::{EditorState, Empty, Predrawn, Resize};
use toss::{AsyncWidget, Size, WidthDb};
use crate::store::{Msg, MsgStore, Tree};
use crate::ui::chat2::blocks::{Block, Blocks, Range};
use crate::ui::chat2::cursor::Cursor;
use crate::ui::chat2::renderer::{self, overlaps, Renderer};
use crate::ui::chat::blocks::{Block, Blocks, Range};
use crate::ui::chat::cursor::Cursor;
use crate::ui::chat::renderer::{self, overlaps, Renderer};
use crate::ui::ChatMsg;
use crate::util::InfallibleExt;

View file

@ -2,7 +2,7 @@ use toss::widgets::EditorState;
use toss::WidthDb;
use crate::store::{Msg, MsgStore};
use crate::ui::chat2::cursor::Cursor;
use crate::ui::chat::cursor::Cursor;
use crate::ui::ChatMsg;
use super::renderer::{TreeContext, TreeRenderer};

View file

@ -5,7 +5,7 @@ use toss::widgets::{BoxedAsync, EditorState, Join2, Join4, Join5, Text};
use toss::{Style, Styled, WidgetExt};
use crate::store::Msg;
use crate::ui::chat2::widgets::{Indent, Seen, Time};
use crate::ui::chat::widgets::{Indent, Seen, Time};
use crate::ui::ChatMsg;
pub const PLACEHOLDER: &str = "[...]";

View file

@ -6,8 +6,8 @@ use toss::{Style, Terminal, WidgetExt};
use crate::euph::{self, Room};
use crate::ui::input::{key, InputEvent, KeyBindingsList};
use crate::ui::widgets2::Popup;
use crate::ui::{util2, UiError};
use crate::ui::widgets::Popup;
use crate::ui::{util, UiError};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
enum Focus {
@ -133,7 +133,7 @@ impl AccountUiState {
Focus::Password => bindings.binding("enter", "log in"),
}
bindings.binding("tab", "switch focus");
util2::list_editor_key_bindings(bindings, |c| c != '\n');
util::list_editor_key_bindings(bindings, |c| c != '\n');
}
Self::LoggedIn(_) => bindings.binding("L", "log out"),
}
@ -166,7 +166,7 @@ impl AccountUiState {
return EventResult::Handled;
}
if util2::handle_editor_input_event(
if util::handle_editor_input_event(
&mut logged_out.email,
terminal,
event,
@ -188,7 +188,7 @@ impl AccountUiState {
return EventResult::Handled;
}
if util2::handle_editor_input_event(
if util::handle_editor_input_event(
&mut logged_out.password,
terminal,
event,

View file

@ -3,8 +3,8 @@ use toss::{Terminal, WidgetExt};
use crate::euph::Room;
use crate::ui::input::{key, InputEvent, KeyBindingsList};
use crate::ui::widgets2::Popup;
use crate::ui::{util2, UiError};
use crate::ui::widgets::Popup;
use crate::ui::{util, UiError};
pub fn new() -> EditorState {
EditorState::new()
@ -21,7 +21,7 @@ pub fn widget(editor: &mut EditorState) -> BoxedAsync<'_, UiError> {
pub fn list_key_bindings(bindings: &mut KeyBindingsList) {
bindings.binding("esc", "abort");
bindings.binding("enter", "authenticate");
util2::list_editor_key_bindings(bindings, |_| true);
util::list_editor_key_bindings(bindings, |_| true);
}
pub enum EventResult {
@ -45,7 +45,7 @@ pub fn handle_input_event(
EventResult::ResetState
}
_ => {
if util2::handle_editor_input_event(editor, terminal, event, |_| true) {
if util::handle_editor_input_event(editor, terminal, event, |_| true) {
EventResult::Handled
} else {
EventResult::NotHandled

View file

@ -5,7 +5,7 @@ use toss::widgets::{BoxedAsync, Text};
use toss::{Style, Styled, WidgetExt};
use crate::ui::input::{key, InputEvent, KeyBindingsList};
use crate::ui::widgets2::Popup;
use crate::ui::widgets::Popup;
use crate::ui::UiError;
macro_rules! line {

View file

@ -6,7 +6,7 @@ use toss::widgets::{BoxedAsync, Text};
use toss::{Style, Styled, WidgetExt};
use crate::ui::input::{key, InputEvent, KeyBindingsList};
use crate::ui::widgets2::{ListState, Popup};
use crate::ui::widgets::{ListState, Popup};
use crate::ui::UiError;
pub struct LinksState {

View file

@ -4,8 +4,8 @@ use toss::{Style, Terminal, WidgetExt};
use crate::euph::{self, Room};
use crate::ui::input::{key, InputEvent, KeyBindingsList};
use crate::ui::widgets2::Popup;
use crate::ui::{util2, UiError};
use crate::ui::widgets::Popup;
use crate::ui::{util, UiError};
pub fn new(joined: Joined) -> EditorState {
EditorState::with_initial_text(joined.session.name)
@ -26,7 +26,7 @@ fn nick_char(c: char) -> bool {
pub fn list_key_bindings(bindings: &mut KeyBindingsList) {
bindings.binding("esc", "abort");
bindings.binding("enter", "set nick");
util2::list_editor_key_bindings(bindings, nick_char);
util::list_editor_key_bindings(bindings, nick_char);
}
pub enum EventResult {
@ -50,7 +50,7 @@ pub fn handle_input_event(
EventResult::ResetState
}
_ => {
if util2::handle_editor_input_event(editor, terminal, event, nick_char) {
if util::handle_editor_input_event(editor, terminal, event, nick_char) {
EventResult::Handled
} else {
EventResult::NotHandled

View file

@ -8,7 +8,7 @@ use toss::widgets::{BoxedAsync, Empty, Text};
use toss::{Style, Styled, WidgetExt};
use crate::euph;
use crate::ui::widgets2::{List, ListState};
use crate::ui::widgets::{List, ListState};
use crate::ui::UiError;
pub fn widget<'a>(

View file

@ -2,7 +2,7 @@ use crossterm::style::Stylize;
use toss::widgets::{BoxedAsync, Text};
use toss::{Style, Styled, WidgetExt};
use crate::ui::widgets2::Popup;
use crate::ui::widgets::Popup;
use crate::ui::UiError;
pub enum RoomPopup {

View file

@ -14,10 +14,10 @@ use toss::{AsyncWidget, Style, Styled, Terminal, WidgetExt};
use crate::config;
use crate::euph;
use crate::macros::logging_unwrap;
use crate::ui::chat2::{ChatState, Reaction};
use crate::ui::chat::{ChatState, Reaction};
use crate::ui::input::{key, InputEvent, KeyBindingsList};
use crate::ui::widgets2::ListState;
use crate::ui::{util2, UiError, UiEvent};
use crate::ui::widgets::ListState;
use crate::ui::{util, UiError, UiEvent};
use crate::vault::EuphRoomVault;
use super::account::{self, AccountUiState};
@ -495,13 +495,13 @@ impl EuphRoom {
}
fn list_nick_list_focus_key_bindings(&self, bindings: &mut KeyBindingsList) {
util2::list_list_key_bindings(bindings);
util::list_list_key_bindings(bindings);
bindings.binding("i", "inspect session");
}
fn handle_nick_list_focus_input_event(&mut self, event: &InputEvent) -> bool {
if util2::handle_list_input_event(&mut self.nick_list, event) {
if util::handle_list_input_event(&mut self.nick_list, event) {
return true;
}

View file

@ -5,7 +5,7 @@ use crossterm::style::Stylize;
use toss::widgets::{BoxedAsync, Empty, Join2, Text};
use toss::{Style, Styled, WidgetExt};
use super::widgets2::ListState;
use super::widgets::ListState;
use super::UiError;
#[derive(Debug, Clone)]

View file

@ -18,8 +18,8 @@ use crate::vault::Vault;
use super::euph::room::EuphRoom;
use super::input::{key, InputEvent, KeyBindingsList};
use super::widgets2::{List, ListState, Popup};
use super::{util2, UiError, UiEvent};
use super::widgets::{List, ListState, Popup};
use super::{util, UiError, UiEvent};
enum State {
ShowList,
@ -405,7 +405,7 @@ impl Rooms {
fn list_showlist_key_bindings(bindings: &mut KeyBindingsList) {
bindings.heading("Rooms");
util2::list_list_key_bindings(bindings);
util::list_list_key_bindings(bindings);
bindings.empty();
bindings.binding("enter", "enter selected room");
bindings.binding("c", "connect to selected room");
@ -421,7 +421,7 @@ impl Rooms {
}
fn handle_showlist_input_event(&mut self, event: &InputEvent) -> bool {
if util2::handle_list_input_event(&mut self.list, event) {
if util::handle_list_input_event(&mut self.list, event) {
return true;
}
@ -519,13 +519,13 @@ impl Rooms {
bindings.heading("Rooms");
bindings.binding("esc", "abort");
bindings.binding("enter", "connect to room");
util2::list_editor_key_bindings(bindings, Self::room_char);
util::list_editor_key_bindings(bindings, Self::room_char);
}
State::Delete(_, _) => {
bindings.heading("Rooms");
bindings.binding("esc", "abort");
bindings.binding("enter", "delete room");
util2::list_editor_key_bindings(bindings, Self::room_char);
util::list_editor_key_bindings(bindings, Self::room_char);
}
}
}
@ -573,7 +573,7 @@ impl Rooms {
return true;
}
_ => {
if util2::handle_editor_input_event(ed, terminal, event, Self::room_char) {
if util::handle_editor_input_event(ed, terminal, event, Self::room_char) {
return true;
}
}
@ -590,7 +590,7 @@ impl Rooms {
return true;
}
_ => {
if util2::handle_editor_input_event(editor, terminal, event, Self::room_char) {
if util::handle_editor_input_event(editor, terminal, event, Self::room_char) {
return true;
}
}

View file

@ -6,7 +6,7 @@ use toss::widgets::EditorState;
use toss::Terminal;
use super::input::{key, InputEvent, KeyBindingsList};
use super::widgets2::ListState;
use super::widgets::ListState;
pub fn prompt(
terminal: &mut Terminal,