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

Handle messages individually #444

Open
Retropaint opened this issue Sep 26, 2024 · 1 comment
Open

Handle messages individually #444

Retropaint opened this issue Sep 26, 2024 · 1 comment
Labels
feat New feature or request need help

Comments

@Retropaint
Copy link
Contributor

Retropaint commented Sep 26, 2024

Currently, messages are rendered using a single tview.TextView. Since TextViews do not support editing its own text, any updates to messages can only be done by updating it all over again. This has 2 issues that, while not major now, will cause problems as the project grows in complexity:

  • Performance - having to update all messages for any kind of edit (be it as small as opening spoilers), will cause more slowdown as support for loading more messages is added (Fetch more messages by scrolling #308)
  • Overcomplicated code - any and all logic pertaining to editing messages has to pass through the creation process first. This means that if, for example, support for adding spoilers were added, it needs to be tracked separately so that the creation logic knows to render it as it should, rather than simply having to update a single message.

Proposal:
Create a new tview Primitive for handling and rendering messages. Here's how it will fix the above issues:

  • Messages will only be rendered as much as the screen can actually show, or a config limit. Any message updates will simply require a redraw for the actual message, rather than everything.
  • Everything pertaining to messages will be handled on a per-message basis within the code, and will not require some weird way of tracking what and where things are done. Want to open a message's spoiler? Just make it redraw only that message with them open.
@ayn2op ayn2op added feat New feature or request need help labels Sep 26, 2024
@ayn2op
Copy link
Owner

ayn2op commented Sep 26, 2024

@Retropaint Retropaint changed the title Render messages individually Handle messages individually Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request need help
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants