mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-03 06:50:26 +00:00
fix: tui attachment bound (#2361)
This commit is contained in:
parent
8ba8d3c7e3
commit
26f75d4e68
1 changed files with 3 additions and 0 deletions
|
|
@ -43,6 +43,9 @@ func (p Prompt) ToMessage(
|
||||||
}
|
}
|
||||||
for _, att := range textAttachments {
|
for _, att := range textAttachments {
|
||||||
if source, ok := att.GetTextSource(); ok {
|
if source, ok := att.GetTextSource(); ok {
|
||||||
|
if att.StartIndex > att.EndIndex || att.EndIndex > len(text) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
text = text[:att.StartIndex] + source.Value + text[att.EndIndex:]
|
text = text[:att.StartIndex] + source.Value + text[att.EndIndex:]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue