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] Clicking in the table of contents doesn't update the article view sometimes #39

Closed
2 tasks done
ThomasFrans opened this issue Jun 15, 2022 · 26 comments · Fixed by #41 or #46
Closed
2 tasks done

[BUG] Clicking in the table of contents doesn't update the article view sometimes #39

ThomasFrans opened this issue Jun 15, 2022 · 26 comments · Fixed by #41 or #46
Labels
state: approved This issue or pull request was approved and can be worked on type: bug This fixes a bug. Increment the minor version

Comments

@ThomasFrans
Copy link
Contributor

ThomasFrans commented Jun 15, 2022

Describe the bug
When clicking on some parts of the table of contents on the right, the view sometimes doesn't go to that section. I don't see when it works and when it doesn't, but it seems to be pretty random.

To Reproduce

  1. Open a page (I was testing with the Linux Kernel page)
  2. Click on the table of contents
  3. It doesn't scroll in the article view sometimes

Expected behavior
The view should follow the clicked section on the table of contents.

Additional context
Latest version, installed with Cargo (There should probably be a section in the template for this information :))

Checklist

  • checked other issues for the same bug
  • read CONTRIBUTING.md
@Builditluc
Copy link
Owner

Builditluc commented Jun 15, 2022

Hey @ThomasFrans!
Thank you for your bug report!

Upon further testing (I also used the Linux Kernel page) it seems that if the first item in the list is selected if you are at the beginning of the article, you can select every other item and it jumps to that section in the article.

Selecting an item that is higher than the currently selected item also works. The thing that is strange here is that the only thing that doesn't work is selecting an item that is below the current item when you aren't at the top of the page.

I'll work on fixing this as soon as possible

@Builditluc
Copy link
Owner

(There should probably be a section in the template for this information :))

Yes, I honestly don't know why it's not there yet.
Thanks!

Builditluc added a commit that referenced this issue Jun 15, 2022
As pointed out in #39 a section for general information (like version and installation method) is missing in the current bug report issue template. This adds the section
@Builditluc Builditluc linked a pull request Jun 15, 2022 that will close this issue
Builditluc added a commit that referenced this issue Jun 15, 2022
This fixes the bug described in #39 and adds mouse support to the article view
@Builditluc
Copy link
Owner

Builditluc commented Jun 15, 2022

I've uploaded a patch that should fix the issue. Until the next version is released, you can use it by installing wiki-tui from the git repo.

cargo install --git https://github.com/builditluc/wiki-tui

Does this patch fix the issue for you?

@ThomasFrans
Copy link
Contributor Author

I don't know if this is an issue on my pc but now it causes crashes and the program behaves pretty weird. When I use arrows to select an item after entering a search term, the program crashes, and when clicking an item in the table of contents, it crashes as well.

image

@Builditluc
Copy link
Owner

Hm, that's weird.
What does the error message in the crash report say?

@Builditluc Builditluc reopened this Jun 15, 2022
@ThomasFrans
Copy link
Contributor Author

Where do I find the crash report when I installed through Cargo?

@Builditluc
Copy link
Owner

When wiki-tui crashes, it creates a crash report in the current working directory

@ThomasFrans
Copy link
Contributor Author

I found this in my home folder (from where I ran it). It doesn't show any errors...

image

@Builditluc
Copy link
Owner

That's weird. Maybe the problem is with cargo installing it from the git repository (I've never tried cargo --git before).
Can you maybe try building it locally?

@ThomasFrans
Copy link
Contributor Author

ThomasFrans commented Jun 15, 2022

Same thing when I build it locally, it also crashes with no errors in the log...

image

@ThomasFrans
Copy link
Contributor Author

I have the previous version on my system as I made a AUR package for it (which is in the aur now 😉) and that one works. So it must be something in the new fix...

@Builditluc
Copy link
Owner

Hm that's weird because I cannot reproduce this behaviour

@ThomasFrans
Copy link
Contributor Author

Would a video showing the problem help?

@Builditluc
Copy link
Owner

Great idea but without the crash report (which wiki-tui somehow doesn't generate? very weird) it wouldn't be much of a help

@Builditluc
Copy link
Owner

I'm guessing it has something to do with the mouse support (that's the only change I made that affects the event system, aka what happens when you press a key).
I removed the mouse support commit from the development branch of this issue (39-bug-clicking-in-the-table-of-contents-doesnt-update-the-article-view-sometimes). Can you please checkout this branch locally and check if that fixed it?

@ThomasFrans
Copy link
Contributor Author

Not even that one is working. It also crashes and shows the same behavior as the new commit. I don't know what is causing this, cause the 0.4.8 release is working flawlessly.

@ThomasFrans
Copy link
Contributor Author

Just tried the 0.4.8 release with a local build (cargo run), and it works, even without installing. I thought maybe it was a problem with the fact that it wasn't installed, but expected to be installed. There must be a commit between that one (d5fabf2) and the current one that causes this...

@Builditluc
Copy link
Owner

Builditluc commented Jun 15, 2022

Okay, so I've just looked at the diff and the only logical conclusion I've come to is that the keybinding thing (a feature I've added that lets you remap certain actions) is broken on some machines

@Builditluc
Copy link
Owner

I'll look further into this and try to reproduce the bug (because on my machine it works somehow), then I'll work on a fix

@ThomasFrans
Copy link
Contributor Author

ThomasFrans commented Jun 15, 2022

I just took a quick glance at the code and this looks a bit weird. It defines the Vim keybindings, but there is no binding for down. Maybe I'm reading it wrong, but there is no 'j' defined. Also only the 'Down' action seems to crash the program.

image

@ThomasFrans
Copy link
Contributor Author

Jup, that fixes it!

@Builditluc
Copy link
Owner

Thanks to you I know what happens, with the keybindings thing you can remap the keys via the configuration file. The problem here is: If you don't remap the key it creates an infinite event loop and this is why it throws a "stack overflow" error

@Builditluc
Copy link
Owner

And because only the "down" action uses this (I forgot the other ones) only down crashes the program

@Builditluc
Copy link
Owner

Until I've fixed this you can "hack" your way around this by remapping the down key in your configuration file:

[keybindings]
down.key = "j"

@Builditluc
Copy link
Owner

I'll create a new issue for the keybinding error

@Builditluc Builditluc linked a pull request Jun 15, 2022 that will close this issue
@Builditluc
Copy link
Owner

I've linked the PR with the patch to this issue so it'll be closed once merged.

Thank you for your bug report and help in finding the issue!

@Builditluc Builditluc added state: approved This issue or pull request was approved and can be worked on type: bug This fixes a bug. Increment the minor version labels Dec 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: approved This issue or pull request was approved and can be worked on type: bug This fixes a bug. Increment the minor version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants