Skip to content

Commit f0b6b1d

Browse files
feat(ui): Add config to always scroll output window to bottom
1 parent cdbe088 commit f0b6b1d

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

lua/opencode/config.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ M.defaults = {
102102
tools = {
103103
show_output = true,
104104
},
105+
always_scroll_to_bottom = false,
105106
},
106107
input = {
107108
text = {

lua/opencode/types.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@
114114
---@class OpencodeUIOutputConfig
115115
---@field tools { show_output: boolean }
116116
---@field rendering OpencodeUIOutputRenderingConfig
117+
---@field always_scroll_to_bottom boolean
117118

118119
---@class OpencodeContextConfig
119120
---@field enabled boolean

lua/opencode/ui/output_window.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ end
3131
---@param win? integer Window ID, defaults to state.windows.output_win
3232
---@return boolean true if at bottom, false otherwise
3333
function M.is_at_bottom(win)
34+
-- If always_scroll_to_bottom is enabled, always return true
35+
if config.ui.output.always_scroll_to_bottom then
36+
return true
37+
end
38+
3439
win = win or (state.windows and state.windows.output_win)
3540

3641
if not win or not vim.api.nvim_win_is_valid(win) then

0 commit comments

Comments
 (0)