add SelectAll to TextEditor
This commit is contained in:
parent
23d9497e7f
commit
76f5bc2cce
3 changed files with 28 additions and 0 deletions
|
|
@ -385,6 +385,27 @@ impl editor::Editor for Editor {
|
|||
}));
|
||||
}
|
||||
}
|
||||
Action::SelectAll => {
|
||||
let buffer = editor.buffer();
|
||||
if buffer.lines.len() > 1
|
||||
|| buffer
|
||||
.lines
|
||||
.first()
|
||||
.is_some_and(|line| !line.text().is_empty())
|
||||
{
|
||||
let cursor = editor.cursor();
|
||||
editor.set_select_opt(Some(cosmic_text::Cursor {
|
||||
line: 0,
|
||||
index: 0,
|
||||
..cursor
|
||||
}));
|
||||
|
||||
editor.action(
|
||||
font_system.raw(),
|
||||
motion_to_action(Motion::DocumentEnd),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Editing events
|
||||
Action::Edit(edit) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue