|
|
@@ -6,6 +6,7 @@ import (
|
|
|
"io"
|
|
|
"log/slog"
|
|
|
"slices"
|
|
|
+ "strconv"
|
|
|
"time"
|
|
|
|
|
|
"github.com/atotto/clipboard"
|
|
|
@@ -55,6 +56,8 @@ func newMessagesText() *MessagesText {
|
|
|
renderer.WithOption("linkColor", cfg.Theme.MessagesText.LinkColor),
|
|
|
)
|
|
|
|
|
|
+ mt.SetHighlightedFunc(mt.onHighlighted)
|
|
|
+
|
|
|
return mt
|
|
|
}
|
|
|
|
|
|
@@ -280,6 +283,17 @@ func (mt *MessagesText) _select(name string) {
|
|
|
mt.ScrollToHighlight()
|
|
|
}
|
|
|
|
|
|
+func (mt *MessagesText) onHighlighted(added, removed, remaining []string) {
|
|
|
+ if (len(added) > 0) {
|
|
|
+ mID, err := strconv.ParseInt(added[0], 10, 64)
|
|
|
+ if err != nil {
|
|
|
+ slog.Error("Failed to parse region id as int to use as message id.","err",err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ mt.selectedMessageID = discord.MessageID(mID)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
func (mt *MessagesText) yank() {
|
|
|
msg, err := mt.getSelectedMessage()
|
|
|
if err != nil {
|