Skip to content

Commit

Permalink
.append does stuff in place
Browse files Browse the repository at this point in the history
  • Loading branch information
gptlang committed Feb 5, 2024
1 parent feb221a commit a70533a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions rplugin/python3/handlers/chat_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,10 @@ def _add_chat_messages(
if last_newline == -1:
continue
# If there is a newline, take everything in front of it and set that as the token
token = buffer[: last_newline]
token = buffer[: last_newline + 1]

# Remove the token and newline from the buffer
buffer = buffer.replace(token + "\n", "")
buffer = buffer.replace(token, "")
self.nvim.exec_lua(
'require("CopilotChat.utils").log_info(...)', f"Token: {token}"
)
Expand All @@ -241,7 +241,7 @@ def _add_chat_messages(
last_line_col,
last_line_row,
last_line_col,
[tok.encode('utf-8') for tok in token.split("\n").append("")],
[tok.encode('utf-8') for tok in token.split("\n")],
)

buffer_lines = cast(list[str], self.buffer.lines())
Expand Down

0 comments on commit a70533a

Please sign in to comment.