Skip to content

Commit

Permalink
Highlight quote when jumping to message
Browse files Browse the repository at this point in the history
  • Loading branch information
BlindingDark committed Nov 17, 2023
1 parent 03d1b9d commit d07a66b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
11 changes: 10 additions & 1 deletion telega-chat.el
Original file line number Diff line number Diff line change
Expand Up @@ -5667,7 +5667,16 @@ Return non-nil on success."
(cl-assert (eq (button-type msg-button) 'telega-msg))
(with-no-warnings
(pulse-momentary-highlight-region
(button-start msg-button) (button-end msg-button))))
(button-start msg-button) (button-end msg-button))
(when (stringp highlight)
(save-excursion
(goto-char (button-start msg-button))
(if (search-forward highlight (button-end msg-button) t)
(let ((start-point (match-beginning 0))
(end-point (match-end 0)))
(sit-for 0.5)
(pulse-momentary-highlight-region start-point end-point))
(message "The exact quote is not found"))))))

(when callback
(funcall callback msg-button)))
Expand Down
6 changes: 4 additions & 2 deletions telega-msg.el
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,11 @@ Return nil for deleted messages."
"Goto message denoted by `:reply_to' field of the message MSG."
(let* ((reply-to (plist-get msg :reply_to))
(chat-id (plist-get reply-to :chat_id))
(msg-id (plist-get reply-to :message_id)))
(msg-id (plist-get reply-to :message_id))
(quote (plist-get reply-to :quote))
(quote-text (plist-get quote :text)))
(unless (or (telega-zerop chat-id) (telega-zerop msg-id))
(telega-chat--goto-msg (telega-chat-get chat-id) msg-id 'highlight))))
(telega-chat--goto-msg (telega-chat-get chat-id) msg-id quote-text))))

(defun telega-msg-open-sticker (msg &optional sticker)
"Open content for sticker message MSG."
Expand Down

0 comments on commit d07a66b

Please sign in to comment.