mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-14 08:18:36 +00:00
Merge branch 'main' of github.com:oraios/serena
This commit is contained in:
commit
a111f1099a
2 files changed
+11
-4
No files matched your search
+2
-2
@@ -40,7 +40,7 @@ SUCCESS_RESULT = "OK"
|
||||
|
||||
class LinesRead:
|
||||
def __init__(self) -> None:
|
||||
self.files = defaultdict(lambda: set())
|
||||
self.files: dict[str, set[tuple[int, int]]] = defaultdict(lambda: set())
|
||||
|
||||
def add_lines_read(self, relative_path: str, lines: tuple[int, int]) -> None:
|
||||
self.files[relative_path].add(lines)
|
||||
@@ -304,7 +304,7 @@ class ReadFileTool(Tool):
|
||||
result_lines = result_lines[start_line:]
|
||||
else:
|
||||
self.agent.lines_read.add_lines_read(relative_path, (start_line, end_line))
|
||||
result_lines = result_lines[start_line:end_line+1]
|
||||
result_lines = result_lines[start_line : end_line + 1]
|
||||
result = "\n".join(result_lines)
|
||||
|
||||
return self._limit_length(result, max_answer_chars)
|
||||
|
||||
@@ -117,6 +117,12 @@ class GuiLogViewer:
|
||||
self.root.quit()
|
||||
return
|
||||
|
||||
# Check if scrollbar is at the bottom before adding new text
|
||||
# Get current scroll position
|
||||
current_position = self.text_widget.yview()
|
||||
# If near the bottom (allowing for small floating point differences)
|
||||
was_at_bottom = current_position[1] > 0.99
|
||||
|
||||
log_level = self._determine_log_level(message)
|
||||
|
||||
# Insert the message at the end of the text
|
||||
@@ -124,8 +130,9 @@ class GuiLogViewer:
|
||||
self.text_widget.insert(tk.END, message + "\n", log_level.name)
|
||||
self.text_widget.configure(state=tk.DISABLED)
|
||||
|
||||
# Auto-scroll to the bottom
|
||||
self.text_widget.see(tk.END)
|
||||
# Auto-scroll to the bottom only if it was already at the bottom
|
||||
if was_at_bottom:
|
||||
self.text_widget.see(tk.END)
|
||||
|
||||
# Schedule to check the queue again
|
||||
if self.running:
|
||||
|
||||
Reference in new issue
Block a user