Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Application panics in small terminal windows #238

Open
2 tasks done
d-rens opened this issue Dec 7, 2024 · 6 comments
Open
2 tasks done

[BUG] Application panics in small terminal windows #238

d-rens opened this issue Dec 7, 2024 · 6 comments
Assignees
Labels
type: bug This fixes a bug. Increment the minor version

Comments

@d-rens
Copy link

d-rens commented Dec 7, 2024

General Information
Version: 0.9.1
Installation Method: cargo install --locked
Operating System: MacOS 15.0 Beta (24A5298h)

Used configuration (if available):

didn't touch the config

Describe the bug
On querying for "World War 2", so a long post, the application panics. On searching smaller articles such as "wort" it works well. It only panics on said page.

To Reproduce
Steps to reproduce the behavior:

  1. Open wiki-tui
  2. Query "World war 2"
  3. Press enter
  4. See error

Expected behavior
I would expect the program to work. Or at least not panic.

Crash report

The application panicked (crashed).
Message:  assertion failed: self.is_char_boundary(n)
Location: /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/alloc/src/string.rs:1908

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
Well, this is embarrassing.

wiki-tui had a problem and crashed. To help us diagnose the problem you can send us a crash report.

We have generated a report file at "/var/folders/13/phqbdkfx4pq4y30h8rf66dhm0000gn/T/report-8a0420a1-824e-4790-9627-327dfa4a7a85.toml". Submit an issue or email with the subject of "wiki-tui Crash Report" and include the report as an attachment.

- Homepage: https://wiki-tui.net
- Authors: builditluc <37375448+Builditluc@users.noreply.github.com>

We take privacy seriously, and do not perform any automated error collection. In order to improve the software, we rely on people to submit reports.

Thank you kindly!

Checklist

  • checked other issues for the same bug
  • read CONTRIBUTING.md
@d-rens d-rens added the type: bug This fixes a bug. Increment the minor version label Dec 7, 2024
@d-rens
Copy link
Author

d-rens commented Dec 7, 2024

Here the report file:

name = "wiki-tui"
operating_system = "Mac OS 15.0.0 [64-bit]"
crate_version = "0.9.1"
explanation = """
Panic occurred in file '/rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/alloc/src/string.rs' at line 1908
"""
cause = "assertion failed: self.is_char_boundary(n)"
method = "Panic"
backtrace = """

   0: 0x1053a5f48 - core::panicking::panic_fmt::h33e40d2a93cab78f
                at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72
   1: 0x1053a5fd0 - core::panicking::panic::h57fd475c037a9df3
                at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:144
   2: 0x10500c890 - alloc::string::String::replace_range::h840035fcf0033525
   3: 0x104f8b3bc - <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold::h233bd55775b1b881
   4: 0x104f7b090 - <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter::h3673a9f044b9e8c7
   5: 0x104fb3dec - wiki_tui::components::page::PageComponent::render_contents::h47b0d19a4dc67c72
   6: 0x104fb72d0 - <wiki_tui::components::page::PageComponent as wiki_tui::components::Component>::render::hf3c276c6895c1922
   7: 0x104ffb178 - <wiki_tui::app::AppComponent as wiki_tui::components::Component>::render::h259bbe9745e84800
   8: 0x104f4b52c - ratatui::terminal::terminal::Terminal<B>::draw::h6380525214404c66
   9: 0x104f34b44 - tokio::runtime::park::CachedParkThread::block_on::h30cfda1ecd5d2986
  10: 0x104f52e70 - wiki_tui::main::h0f7f8c0679eb86db
  11: 0x104f4abd0 - std::sys_common::backtrace::__rust_begin_short_backtrace::he7e163ba7145aef1
  12: 0x104f4bcb0 - std::rt::lang_start::{{closure}}::ha6e2eef459f832d7
  13: 0x105353814 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::hde2a2ae1d756c37f
                at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:284
                 - std::panicking::try::do_call::h96b73f4da16ee7c5
                at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:552
                 - std::panicking::try::h2cb0c14c1266f147
                at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:516
                 - std::panic::catch_unwind::hb8cd2580f659030d
                at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panic.rs:142
                 - std::rt::lang_start_internal::{{closure}}::h00f9c2d0117ea0ef
                at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/rt.rs:148
                 - std::panicking::try::do_call::h134dfd8876bcc105
                at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:552
                 - std::panicking::try::h6595e056250d6043
                at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:516
                 - std::panic::catch_unwind::haad85d5172c9b53a
                at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panic.rs:142
                 - std::rt::lang_start_internal::hf4f3eb1e51305b96
                at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/rt.rs:148
  14: 0x104f53078 - _main"""

@Builditluc
Copy link
Owner

Thank you @d-rens for your bug report!

I've successfully reproduced the issue. The problem lies with our generation of the ... filler when the toc item is longer than the width of the toc.

@Builditluc Builditluc self-assigned this Dec 7, 2024
@Builditluc Builditluc moved this from Todo to Idea in wiki-tui: Roadmap Dec 7, 2024
@Builditluc Builditluc moved this from Idea to In Development in wiki-tui: Roadmap Dec 7, 2024
@0323pin
Copy link
Contributor

0323pin commented Dec 12, 2024

Does this only happen if one does not have a config file? I don't see this?!?

2024-12-12-231851_1366x768_scrot

@d-rens
Copy link
Author

d-rens commented Dec 13, 2024

@0323pin try increasing the fontsize and decreasing the window width to "take space in the TOC", that's how it should break, at least for me.

@0323pin
Copy link
Contributor

0323pin commented Dec 13, 2024

Reducing page.toc.width_percentage from 25 to 10

2024-12-13-101622_1366x768_scrot

Increasing the font size from 8.5 to 15

2024-12-13-101855_1366x768_scrot

No crashes 🤔

@0323pin
Copy link
Contributor

0323pin commented Dec 13, 2024

Ok, I've managed to reproduce it by resizing the window which, I never do manually as I use a tiling window manager. I guess I had never launched any other application in the same workspace as a running instance of wiki-tui.

@Builditluc Builditluc changed the title [BUG] Application panics when opening large page [BUG] Application panics in small terminal windows Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug This fixes a bug. Increment the minor version
Projects
Status: In Development
Development

No branches or pull requests

3 participants