Skip to content

Conversation

@aweis89
Copy link
Contributor

@aweis89 aweis89 commented Jan 10, 2026

Summary

When using position = 'current' configuration, opencode modifies window options (wrap, number, relativenumber, signcolumn, etc.) on the current window. This PR ensures those settings are saved before modification and restored when opencode is closed.

Problem

Previously, when closing opencode with position = 'current', the window would retain opencode's settings (e.g., wrap=true, number=false) instead of reverting to the user's original settings.

Solution

  • Save original window option values before modifying them (only when position = 'current')
  • Restore saved values when closing opencode
  • Store saved options in state.saved_window_options

Files Changed

  • lua/opencode/state.lua - Added saved_window_options field to state
  • lua/opencode/ui/output_window.lua - Helper function set_win_option() that saves original values before setting
  • lua/opencode/ui/ui.lua - Restore saved options in close_windows()

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.

1 participant