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

Add line pointer to line_data struct #1885

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nilscc
Copy link

@nilscc nilscc commented Feb 21, 2023

Hi!

I would like to add a pointer to the t_gui_line struct to the t_gui_line_data struct, mainly to reference the next/previous line easily from a _buffer_line_added relay message.

@codecov-commenter
Copy link

Codecov Report

Merging #1885 (444d12e) into master (f6fdecb) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head 444d12e differs from pull request most recent head 3f1fd0e. Consider uploading reports for the commit 3f1fd0e to get more accurate results

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@           Coverage Diff           @@
##           master    #1885   +/-   ##
=======================================
  Coverage   44.19%   44.19%           
=======================================
  Files         211      211           
  Lines       87143    87146    +3     
=======================================
+ Hits        38509    38512    +3     
  Misses      48634    48634           
Impacted Files Coverage Δ
src/plugins/relay/weechat/relay-weechat-protocol.c 0.00% <ø> (ø)
src/gui/gui-line.c 59.79% <100.00%> (+0.12%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@flashcode
Copy link
Member

Hi,

Thanks for the PR.

Some remarks:

  1. Multiple lines can point to same line_data structure (that's why there's a separate structure there), when buffers are merged.
  2. Adding a pointer in the line_data structure will use some extra memory.
  3. Relay has already the line pointer, but it's not given to the client, we could try to find a way to give it, while staying compatible with existing clients.

I think we need a different approach to send the line pointer to the relay clients.

…age instead of adding line pointer to all line_data structs
@nilscc
Copy link
Author

nilscc commented Feb 22, 2023

Current version sends two hdata objects on _buffer_line_added, one for the line_data and one for the original line sent in the core hook.

Since two instead of one objects are sent relay clients with this new logic should either:

  • check the hPath if the hdata object is line or line_data (most stable) or
  • only use the first hdata object (less stable if order is ever changed)

Maybe this could be added as hint to the documentation if this current approach is taken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants