fix(agenda): goto item with multiple tabpages#1149
Open
torgnylyon wants to merge 1 commit into
Open
Conversation
How to reproduce: 1. open two tabpages 2. in the first tabpage, open the agenda or todo list (there should now be three windows: in the first tabpage: an orgagenda and an empty buffer, in the second tabpage: an empty buffer) 3. move cursor to an item in the agenda 4. attempt to open item in split window (<TAB>) Expected result: the item should open in the window for the empty buffer in the first tabpage Actual Result: the item opens in the window for the agenda Having an org buffer in a window in the second tabpage will cause a similar effect. Also notice that the order of the tab pages matter for triggering the bug, as the search for a suitable window will pick the last window found, which will be in the second tabpage. The bug is caused by the fact that win_id2win() will be called with the window id of the window found in the second tabpage, returning 0, making the command "0windcmd w" stay in the current window. This patch fixes the issue by limiting the search for a suitable window to the current tabpage. A further improvement could be to break the for loops as soon a suitable window is found, but since that would only be noticeable when the current tabpage is already split in more than one window, and would break current behavior, it is left as is.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
How to reproduce:
Expected result: the item should open in the window for the empty buffer in the first tabpage
Actual Result: the item opens in the window for the agenda
Having an org buffer in a window in the second tabpage will cause a similar effect. Also notice that the order of the tab pages matter for triggering the bug, as the search for a suitable window will pick the last window found, which will be in the second tabpage.
The bug is caused by the fact that win_id2win() will be called with the window id of the window found in the second tabpage, returning 0, making the command "0windcmd w" stay in the current window.
This patch fixes the issue by limiting the search for a suitable window to the current tabpage. A further improvement could be to break the for loops as soon a suitable window is found, but since that would only be noticeable when the current tabpage is already split in more than one window, and would break current behavior, it is left as is.
Summary
This PR adds fixes a bug in the agenda view.
Related Issues
None
Related #
Closes #
Changes
No major changes
Checklist
I confirm that I have:
Conventional Commits
specification (e.g.,
feat: add new feature,fix: correct bug,docs: update documentation).make test.