Add window size commands and tab navigation hotkeys - #44
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eb744dc2c9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| elseif c == s:codeList['tabl'] && has_key(l:commands, 'tabl') "J | ||
| exe l:commands['tabl'] | ||
| elseif c == s:codeList['tabr'] && has_key(l:commands, 'tabr') "K | ||
| exe l:commands['tabr'] |
There was a problem hiding this comment.
Refresh mode commands after tab navigation
In s:startResize, the new tabl/tabr handlers execute tabprevious/tabnext but leave l:commands unchanged, so the loop continues using command state captured on the previous tab. In resize mode this state includes edge-dependent left/right/up/down behavior and a winrestcmd() cancel snapshot, which can become incorrect immediately after J/K when tabs have different window layouts (for example, h can resize in the opposite direction and q can restore the wrong geometry). Rebuild l:commands for the current mode after each tab switch to keep behavior consistent.
Useful? React with 👍 / 👎.
After J/K switches tabs, edge detection and winrestcmd() snapshots in l:commands reflect the previous tab's layout. Introduce s:commandsForMode() and call it after each tab switch so resize direction and cancel behavior are always consistent with the current tab.
|
Addressed in 9b0fa03 (re: Codex review): introduced |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9b0fa03a01
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| else | ||
| return s:tuiResizeCommands() |
There was a problem hiding this comment.
Preserve GUI resize mode when rebuilding commands
When WinResizerStartResizeGUI is active, pressing J/K triggers command refresh via s:commandsForMode(l:commands['mode']), but this helper maps 'resize' to s:tuiResizeCommands() unconditionally. That means a GUI session silently flips to the TUI command set after the first tab navigation, so subsequent h/j/k/l and q operate on split/window layout state instead of GUI &columns/&lines, which is a functional regression for GUI users.
Useful? React with 👍 / 👎.
Rename guiResizeCommands mode from 'resize' to 'gui_resize' so that s:commandsForMode() can distinguish TUI and GUI resize sessions and return the correct command set after J/K tab navigation.
|
Addressed in 36c5140 (re: Codex review): renamed the GUI resize mode identifier from |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 36c5140217
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| exe l:commands['sizeeq'] | ||
| elseif c == s:codeList['tabl'] && has_key(l:commands, 'tabl') "J | ||
| exe l:commands['tabl'] | ||
| let l:commands = s:commandsForMode(l:commands['mode']) |
There was a problem hiding this comment.
Preserve GUI cancel snapshot after tab navigation
Rebuilding l:commands immediately after J/K recreates gui_resize commands, including a new cancel value based on the current &columns/&lines. In GUI resize mode this means q stops undoing earlier frame-size changes once a tab switch occurs (e.g., resize with h/l, press J, then q leaves the resized dimensions in place). Keep the original GUI cancel snapshot when handling tab navigation so cancel still restores the pre-session size.
Useful? React with 👍 / 👎.
|
Re: Codex review on GUI cancel snapshot: skipping this one intentionally. For TUI mode, rebuilding |
Summary
Implements a subset of the features proposed in #30, adapted to match the existing codebase conventions:
_(hfull, ASCII 95) — maximize current window height (wincmd _) — resize mode only|(vfull, ASCII 124) — maximize current window width (wincmd |) — resize mode only=(sizeeq, ASCII 61) — equalize all window sizes (wincmd =) — resize mode onlyJ(tabl, ASCII 74) — switch to previous tab — all modesK(tabr, ASCII 75) — switch to next tab — all modesAll new keycodes are configurable via
g:winresizer_keycode_*variables and documented in README.md.Changes from #30
x)sleep 1pattern not used — dispatch executes commands directly, consistent with all other hotkeysTest plan
vim -Es -u test/vimrc '+Vader! test/winresizer.vader')