diff --git a/haiku_rag_slim/haiku/rag/chat/widgets/prompt.py b/haiku_rag_slim/haiku/rag/chat/widgets/prompt.py index 8aa3e7b6..7d742a91 100644 --- a/haiku_rag_slim/haiku/rag/chat/widgets/prompt.py +++ b/haiku_rag_slim/haiku/rag/chat/widgets/prompt.py @@ -172,7 +172,7 @@ class FlexibleInput(Widget): DEFAULT_CSS = """ FlexibleInput { height: auto; - padding: 0 1; + padding: 0 1 1 1; border-top: solid $primary-darken-1; } @@ -180,6 +180,10 @@ class FlexibleInput(Widget): border-top: solid $primary; } + FlexibleInput > Horizontal { + height: auto; + } + FlexibleInput #promptMarker { width: 2; height: 1; diff --git a/tests/chat/test_image_input.py b/tests/chat/test_image_input.py index 73a5e6f4..4a3f6255 100644 --- a/tests/chat/test_image_input.py +++ b/tests/chat/test_image_input.py @@ -138,3 +138,25 @@ class TestChatAppImageAttach: await pilot.pause() assert app._images == [data] assert "[Image #1]" in app.query_one(PostableTextArea).text + + +class TestChatAppLayout: + @pytest.mark.asyncio + async def test_prompt_stays_compact_and_history_visible(self, temp_db_path): + from haiku.rag.chat.app import ChatApp + from haiku.rag.chat.widgets.chat_history import ChatHistory + from haiku.rag.client import HaikuRAG + + async with HaikuRAG(temp_db_path, create=True): + pass + + app = ChatApp(db_path=temp_db_path, capabilities=[]) + async with app.run_test() as pilot: + await pilot.pause() + prompt = app.query_one(FlexibleInput) + history = app.query_one(ChatHistory) + assert prompt.region.height <= 4 + assert history.region.height > prompt.region.height + assert history.region.y < prompt.region.y + area = app.query_one(PostableTextArea) + assert prompt.region.contains_region(area.region)