ratatui_toolkit/widgets/markdown_widget/widget/methods/last_double_click.rs
1//! Methods for retrieving the last double-click info and copied text.
2
3use crate::widgets::markdown_widget::widget::MarkdownWidget;
4
5impl<'a> MarkdownWidget<'a> {
6 /// Get the last double-click info and clear it.
7 ///
8 /// Call this after processing events to check if a double-click occurred.
9 ///
10 /// # Returns
11 ///
12 /// `Some((line_number, line_kind, content))` if a double-click occurred, `None` otherwise.
13 pub fn take_last_double_click(&mut self) -> Option<(usize, String, String)> {
14 self.last_double_click.take()
15 }
16
17 /// Get the last copied text and clear it.
18 ///
19 /// Call this after processing events to check if text was copied to clipboard.
20 /// Use this to show a toast notification when text is copied.
21 ///
22 /// # Returns
23 ///
24 /// `Some(text)` if text was copied, `None` otherwise.
25 pub fn take_last_copied(&mut self) -> Option<String> {
26 self.selection.last_copied_text.take()
27 }
28}