Repository navigation
Make the session sidebar clickable - #19
Merged
Merged
Conversation
The sidebar was drawn as plain strings, so nothing could say which session a cell of it stands for. It is now built the way the dashboard columns are: sidebarLines records each card line as standing for its row in Model.rows (hitRow), and sidebarWindow lays those lines into the column. renderSidebar draws from them. No behaviour change. The rendered sidebar is byte-identical at every cursor position, with the prefix armed and not, on a list long enough to clip at both edges, and with no sessions.
sessionCard and its comments move unchanged from sidebar.go to card.go. The sidebar is about to gain its windowing and hit testing, and the card, which is most of the file, is a separate job: what one session looks like, not where the column scrolls to. No behaviour change.
A click on a sidebar card selects that session through landOn, as ^g j does, so a click from one live agent to another stays attached. A second press in a row on the same card opens it, as on the dashboard, and any key or other press between the two breaks the pair. The wheel over the sidebar moves the cursor; over the pane it still goes to the agent. The sidebar now keeps its place between frames (Model.sidebarTop), as the project list does, so a double click cannot land on a card that scrolled under the pointer. A card is several lines, so the window brings the selected card's last line into view and then its first, and a card that fits is shown whole. The session view is now drawn at the terminal's height. The pane was drawn at the agent terminal's five-row minimum, so a terminal shorter than eight rows got a frame taller than itself, and every card was drawn a row above where a click resolved it. README, architecture and backlog 9 describe the sidebar, and the Known friction entry saying it takes no clicks is gone.
The sidebar was window's last caller outside tests; it now lays out with windowed and draws with fill, so the mouse can read the same layout. window moves to util_test.go, where the windowing tests still use it, and the comment and architecture sentence that described it as the other half of windowed now describe windowed and fill. No behaviour change.
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.
In the session view, a click on a sidebar card selects that session (as
^g jdoes, so moving between live agents stays attached), and a second click in a row opens it. The wheel over the sidebar moves the cursor; over the pane it still goes to the agent.Model.sidebarTop), so a double click cannot land on a card that scrolled. The selected card is always shown whole.Four commits. The first two and the last change no behaviour: the sidebar built as recorded lines (byte-identical render),
sessionCardmoved unchanged tocard.go, andwindowmoved into the tests that are its only caller.Checked by hand in a real tmux with default settings: one click switches sessions and keeps the keyboard attached.