Skip to content

Commit

Permalink
Improve selection
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenburns committed Sep 13, 2024
1 parent f8f1c38 commit 33c0f91
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
4 changes: 4 additions & 0 deletions elia_chat/elia.scss
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ Chatbox {
}

&.assistant-message {
width: 1fr;
border: round $accent 60%;
&:focus-within {
border: round $accent;
Expand Down Expand Up @@ -296,6 +297,9 @@ Chatbox {
background: $main-lighten-2;
}
}
& TextArea {
width: 1fr;
}
}

}
Expand Down
11 changes: 1 addition & 10 deletions elia_chat/widgets/chatbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def action_copy_to_clipboard(self) -> None:
text_to_copy = self.selected_text

if text_to_copy:
message = f"Copied {len(text_to_copy)} selected characters to clipboard."
message = f"Copied {len(text_to_copy)} characters to clipboard."
title = "Selection copied"
else:
text_to_copy = self.text
Expand Down Expand Up @@ -381,15 +381,6 @@ def render(self) -> RenderableType:
return ""
return self.markdown

def get_content_width(self, container: Size, viewport: Size) -> int:
# Naive approach. Can sometimes look strange, but works well enough.
content = self.message.message.get("content")
if isinstance(content, str):
content_width = min(cell_len(content), container.width)
else:
content_width = 10 # Arbitrary
return content_width

def append_chunk(self, chunk: str) -> None:
"""Append a chunk of text to the end of the message."""
content = self.message.message.get("content")
Expand Down

0 comments on commit 33c0f91

Please sign in to comment.