Skip to content

handle split resize safely + use store subscribe#328

Merged
sudo-tee merged 2 commits intosudo-tee:refactor/state-managementfrom
jensenojs:fix/vimresized-output-window
Mar 18, 2026
Merged

handle split resize safely + use store subscribe#328
sudo-tee merged 2 commits intosudo-tee:refactor/state-managementfrom
jensenojs:fix/vimresized-output-window

Conversation

@jensenojs
Copy link
Contributor

@jensenojs jensenojs commented Mar 18, 2026

The window-splitting issue appears to be a legacy bug, but it was affecting my local development, so I fixed it. @sudo-tee

oujinsai added 2 commits March 18, 2026 16:44
Use window-type-aware resize logic in output_window.update_dimensions.
- guard missing or invalid output_win before resizing
- use nvim_win_set_width for split windows (relative == '')
- keep nvim_win_set_config for floating windows
- add regression tests for float-focus resize and invalid window

This prevents "Cannot split a floating window" on VimResized while
preserving existing zoom width behavior.

Verified with:
- ./run_tests.sh -t tests/unit/zoom_spec.lua
Follow the state observable API migration by switching reference picker setup from state.subscribe(...) to state.store.subscribe(...).

This matches the refactor that centralized observable helpers under state.store and fixes startup error: attempt to call field 'subscribe' (a nil value).

Verified with: ./run_tests.sh -t tests/unit/reference_picker_spec.lua
@sudo-tee sudo-tee merged commit 21ae533 into sudo-tee:refactor/state-management Mar 18, 2026
5 checks passed
@jensenojs jensenojs deleted the fix/vimresized-output-window branch March 18, 2026 11:31
sudo-tee added a commit that referenced this pull request Mar 18, 2026
* wip: state-management refactor

* feat(state): split state in smaller slices

* refactor(state): move UI/window APIs into state.ui

Move window state, cursor, visibility, and hidden-buffer helpers into a dedicated
state.ui table. Update callers across modules and tests to reference state.ui.*,
improving separation between core store logic and UI utilities.

* refactor(state): centralize protected state mutations into domain setters

* refactor(state): add mutation type annotations for state modules

* refactor(state): rename notify to emit

* fix: unsubscribe in tests

* fix: context setting immutability

* refactor(state): use std.RawGet and keyof OpencodeState in annotations

* refactor(state): simplify store API and session/jobs mutations

* refactor(state): centralize observable API under state.store

Replace top-level observable helpers (state.subscribe, state.unsubscribe, state.append, state.emit)

* fix: reference_picker

* handle split resize safely + use store subscribe (#328)

* fix(ui): handle split resize safely

Use window-type-aware resize logic in output_window.update_dimensions.
- guard missing or invalid output_win before resizing
- use nvim_win_set_width for split windows (relative == '')
- keep nvim_win_set_config for floating windows
- add regression tests for float-focus resize and invalid window

This prevents "Cannot split a floating window" on VimResized while
preserving existing zoom width behavior.

Verified with:
- ./run_tests.sh -t tests/unit/zoom_spec.lua

* fix(reference-picker): use store subscribe

Follow the state observable API migration by switching reference picker setup from state.subscribe(...) to state.store.subscribe(...).

This matches the refactor that centralized observable helpers under state.store and fixes startup error: attempt to call field 'subscribe' (a nil value).

Verified with: ./run_tests.sh -t tests/unit/reference_picker_spec.lua
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.

2 participants