Fix index handling in a taglist example #2810
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Quote (with some minor changes) from 1:
I'd like to use the code presented at the top of the documentation
page for the taglist widget 2. However, I prefer my taglist to be
filtered and display only noempty tags BUT to keep the numbering so
that pressing Mod+3 always shows the same tag.
If I only update the
so that it reads
then my tags are displayed with a wrong number, since the index
parameter in the callback function (a few lines below) is based on the
list of selected_tags and not the global list of tags.
The answers by Veratil are:
Prefix index with c3. so that it becomes c3.index in the
update_callback.
Thanks for pointing this out, I can make a PR to fix it.
and
Maybe update the one in create_callback as well.
I just reproduced the problem and tested that the proposed change makes
things work as expected. Since the comments were written two months ago
and nothing happened yet, I am just turning this into a PR. The idea is
that the PR is only accepted if someone who understands this code
decides that this change is correct. Let's see if that works out...
Signed-off-by: Uli Schlachter [email protected]
CC @Veratil