Skip to content

Commit 223db65

Browse files
committed
revert some unwanted changes
1 parent 61adc15 commit 223db65

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

lua/eca/sidebar.lua

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ local M = {}
3131
M.__index = M
3232

3333
-- Height calculation constants
34+
local MIN_CHAT_HEIGHT = 10 -- Minimum lines for chat container to remain usable
35+
local WINDOW_MARGIN = 3 -- Additional margin for window borders and spacing
3436
local UI_ELEMENTS_HEIGHT = 2 -- Reserve space for statusline and tabline
37+
local SAFETY_MARGIN = 2 -- Extra margin to prevent "Not enough room" errors
3538

3639
---@param id integer Tab ID
3740
---@param mediator eca.Mediator
@@ -230,6 +233,12 @@ function M:_create_containers()
230233

231234
-- Validate total height to prevent "Not enough room" error
232235
local total_height = chat_height
236+
+ selected_code_height
237+
+ todos_height
238+
+ status_height
239+
+ contexts_height
240+
+ input_height
241+
+ usage_height
233242
+ config_height
234243

235244
-- Always calculate from total screen minus UI elements (more accurate than current window)
@@ -567,6 +576,13 @@ function M:get_chat_height()
567576
return math.max(
568577
MIN_CHAT_HEIGHT,
569578
total_height
579+
- input_height
580+
- usage_height
581+
- status_height
582+
- contexts_height
583+
- selected_code_height
584+
- todos_height
585+
- WINDOW_MARGIN
570586
- config_height
571587
)
572588
end
@@ -1442,6 +1458,12 @@ function M:_add_message(role, content)
14421458

14431459
-- Check if content looks like code (starts with common programming patterns)
14441460
local is_code = content:match("^%s*function")
1461+
or content:match("^%s*class")
1462+
or content:match("^%s*def ")
1463+
or content:match("^%s*import")
1464+
or content:match("^%s*#include")
1465+
or content:match("^%s*<%?")
1466+
or content:match("^%s*<html")
14451467

14461468
if is_code then
14471469
-- Wrap in code block with auto-detection

0 commit comments

Comments
 (0)