Skip to content
This repository was archived by the owner on Jun 25, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,019 changes: 1,326 additions & 693 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ color-eyre = "0.6.2"
crossterm = { version = "0.27.0", default-features = false, features = ["event-stream", "serde"] }
directories = "5.0.1"
futures = "0.3.28"
human-panic = "1.2.2"
human-panic = "2.0.2"
libc = "0.2.147"
log = { version = "0.4.20", features = ["serde"] }
ratatui = { version = "0.26.3", features = ["serde"] }
ratatui = { version = "0.29.0", features = ["serde"] }
signal-hook = "0.3.17"
serde = "1.0"
textwrap = { version = "0.16.0", features = ["smawk"] }
Expand All @@ -37,7 +37,7 @@ tracing = "0.1.37"
tracing-log = "0.2.0"
tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }
tui-input = "0.9"
tui-logger = { version = "0.11.1", default-features = false, features = ["crossterm", "tracing-support"] }
tui-logger = { version = "0.17.3", default-features = false, features = ["crossterm", "tracing-support"] }
bitflags = { version = "2.6.0", features = ["serde"] }

[dependencies.wiki-api]
Expand Down
1 change: 0 additions & 1 deletion rust-toolchain

This file was deleted.

2 changes: 1 addition & 1 deletion src/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,6 @@ impl Debug for ActionPacket {
return write!(f, "Nothing");
}

f.debug_list().entries(&mut self.actions.iter()).finish()
f.debug_list().entries(self.actions.iter()).finish()
}
}
24 changes: 15 additions & 9 deletions src/components/message_popup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use ratatui::{
layout::{Alignment, Rect},
style::{Style, Stylize},
text::Line,
widgets::{block::Title, Block, Clear},
widgets::{Block, Clear},
};

use crate::{
Expand All @@ -16,8 +16,8 @@ use crate::{

use super::Component;

pub struct MessagePopupComponent<'a> {
title: Title<'a>,
pub struct MessagePopupComponent {
title: String,
content: String,
content_alignment: Alignment,

Expand All @@ -26,10 +26,10 @@ pub struct MessagePopupComponent<'a> {
confirmation: Option<ActionPacket>,
}

impl<'a> MessagePopupComponent<'a> {
impl MessagePopupComponent {
pub fn new_raw(title: String, content: String, theme: Arc<Theme>) -> Self {
Self {
title: Title::from(title).alignment(Alignment::Center),
title,
content,
content_alignment: Alignment::Center,

Expand All @@ -44,7 +44,7 @@ impl<'a> MessagePopupComponent<'a> {
"An error occurred\nCheck the logs for further information\n\nError: {ERROR}";

Self {
title: Title::from("Error".bold().red()).alignment(Alignment::Center),
title: "Error".to_string(),
content: ERROR_MESSAGE.replace("{ERROR}", &error),
content_alignment: Alignment::Left,

Expand All @@ -61,7 +61,7 @@ impl<'a> MessagePopupComponent<'a> {
theme: Arc<Theme>,
) -> Self {
Self {
title: Title::from(title).alignment(Alignment::Center),
title,
content,
content_alignment: Alignment::Center,

Expand All @@ -72,7 +72,7 @@ impl<'a> MessagePopupComponent<'a> {
}
}

impl<'a> Component for MessagePopupComponent<'a> {
impl Component for MessagePopupComponent {
fn handle_key_events(&mut self, key: KeyEvent) -> ActionResult {
match key.code {
KeyCode::Char('y') if self.confirmation.is_some() => self
Expand Down Expand Up @@ -109,7 +109,13 @@ impl<'a> Component for MessagePopupComponent<'a> {
area,
);

let mut block = self.theme.default_block().title(self.title.clone());
let title_line = if self.title == "Error" {
Line::from("Error".bold().red()).centered()
} else {
Line::from(self.title.clone()).centered()
};

let mut block = self.theme.default_block().title_top(title_line);

block = if self.confirmation.is_some() {
block
Expand Down
2 changes: 1 addition & 1 deletion src/components/page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ impl Component for PageComponent {
}

let page_area = if !self.is_zen_mode || zen_mode.contains(ZenModeComponents::SCROLLBAR) {
area.inner(&Margin {
area.inner(Margin {
vertical: 0,
horizontal: 2, // for the scrollbar
})
Expand Down
4 changes: 2 additions & 2 deletions src/components/page_language_popup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@ impl Component for PageLanguageSelectionComponent {
f.render_widget(input_widget, input_area);

if self.focus == FOCUS_INPUT {
f.set_cursor(
f.set_cursor_position((
input_area.x + (cursor.max(scroll) - scroll) as u16,
input_area.y,
);
));
}

let list_items = self
Expand Down
2 changes: 1 addition & 1 deletion src/components/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ impl SearchComponent {
.get_items_mut()
.append(&mut search.results);

self.continue_search = search.continue_data().take();
self.continue_search = search.continue_data();
self.search_info = Some(search.info);

crate::trace_dbg!(has_results);
Expand Down
4 changes: 2 additions & 2 deletions src/components/search_bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ impl Component for SearchBarComponent {
let input_area = centered_rect(area, SEARCH_BAR_X, 100);
f.render_widget(input, input_area);
if self.is_focussed {
f.set_cursor(
f.set_cursor_position((
// Put cursor past the end of the input text
input_area.x + ((self.input.visual_cursor()).max(scroll) - scroll) as u16 + 1,
// Move one line down, from the border to the input line
input_area.y + 1,
);
));
}
}
}
4 changes: 2 additions & 2 deletions src/components/search_language_popup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,10 @@ impl Component for SearchLanguageSelectionComponent {
f.render_widget(input_widget, input_area);

if self.focus == FOCUS_INPUT {
f.set_cursor(
f.set_cursor_position((
input_area.x + (cursor.max(scroll) - scroll) as u16,
input_area.y,
);
));
}

let list_items = self
Expand Down
7 changes: 3 additions & 4 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,10 +372,9 @@ impl Keybinding {
}

pub fn matches_event(&self, event: KeyEvent) -> bool {
return self
.bindings
self.bindings
.iter()
.any(|x| x.code == event.code && x.modifiers == event.modifiers);
.any(|x| x.code == event.code && x.modifiers == event.modifiers)
}
}

Expand Down Expand Up @@ -475,7 +474,7 @@ impl Config {

enable_scrolling: true,
},
padding: Padding::zero(),
padding: Padding::ZERO,

default_zen: false,
zen_mode: ZenModeComponents::empty(),
Expand Down
2 changes: 1 addition & 1 deletion src/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub fn initialize_logging(level: Option<LevelFilter>) -> Result<()> {

tracing_subscriber::registry()
.with(file_subscriber)
.with(tui_logger::tracing_subscriber_layer())
.with(tui_logger::TuiTracingSubscriberLayer)
.init();

tui_logger::set_default_level(level.as_log());
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ async fn main() -> Result<()> {
Action::RenderTick => {
let mut app_component = app_component.lock().await;
tui.terminal
.draw(|frame| app_component.render(frame, frame.size()))
.draw(|frame| app_component.render(frame, frame.area()))
.unwrap();
}
Action::Quit => should_quit = true,
Expand Down
9 changes: 3 additions & 6 deletions src/panic_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,9 @@ pub fn initialize_panic_handler() -> Result<()> {
{
eprintln!("{}", panic_hook.panic_report(panic_info));
use human_panic::{handle_dump, print_msg, Metadata};
let meta = Metadata {
version: env!("CARGO_PKG_VERSION").into(),
name: env!("CARGO_PKG_NAME").into(),
authors: env!("CARGO_PKG_AUTHORS").replace(':', ", ").into(),
homepage: env!("CARGO_PKG_HOMEPAGE").into(),
};
let meta = Metadata::new(env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION"))
.authors(env!("CARGO_PKG_AUTHORS").replace(':', ", "))
.homepage(env!("CARGO_PKG_HOMEPAGE"));

let file_path = handle_dump(&meta, panic_info);
print_msg(file_path, &meta)
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub struct Word {

impl<'a> Word {
pub fn node(&self, document: &'a Document) -> Option<Node<'a>> {
return document.nth(self.index);
document.nth(self.index)
}
}

Expand Down
6 changes: 3 additions & 3 deletions wiki-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ keywords = ["tui", "wikipedia"]
[dependencies]
anyhow = "1.0.75"
bitflags = { version = "2.6.0", features = ["serde"] }
ego-tree = "0.6.2"
ego-tree = "0.10.0"
html5ever = "0.26.0"
markup5ever_rcdom = "0.2.0"
reqwest = "0.11.20"
scraper = "0.17.1"
reqwest = "0.12.19"
scraper = "0.23.1"
serde = "1.0.188"
serde_json = "1.0.105"
serde_repr = "0.1.16"
Expand Down
6 changes: 2 additions & 4 deletions wiki-api/src/page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,9 +409,8 @@ impl<I, P> PageBuilder<I, P, WithEndpoint, WithLanguage> {
.query(&params)
.send()
.await
.map(|response| {
.inspect(|response| {
debug!("response url: '{}'", response.url().as_str());
response
})
.context("failed sending the request")
}
Expand Down Expand Up @@ -504,9 +503,8 @@ impl<I, P> PageBuilder<I, P, WithEndpoint, WithLanguage> {
})
.collect::<Vec<LanguageLink>>()
})
.map(|x| {
.inspect(|x| {
debug!("language_links: '{}'", x.len());
x
});

let sections = res_json
Expand Down
2 changes: 1 addition & 1 deletion wiki-api/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ impl WikipediaParser {
)));
}

let page = link_url.path_segments()?.last()?;
let page = link_url.path_segments()?.next_back()?;

const NAMESPACE_DELIMITER: char = ':';
let (namespace, page) =
Expand Down
Loading