Expand terminal menu actions (#14828)
<img width="422" alt="image" src="https://github.com/user-attachments/assets/73195894-81a7-4b8e-b5cf-ae60bf5b1fb9"> Release Notes: - Added `Copy`, `Paste`, `Select All`, & `New Terminal` into terminal's context menu
This commit is contained in:
parent
46b7fa9bcb
commit
48c253feb8
3 changed files with 13 additions and 5 deletions
|
@ -606,6 +606,7 @@
|
||||||
"ctrl-alt-space": "terminal::ShowCharacterPalette",
|
"ctrl-alt-space": "terminal::ShowCharacterPalette",
|
||||||
"shift-ctrl-c": "terminal::Copy",
|
"shift-ctrl-c": "terminal::Copy",
|
||||||
"ctrl-insert": "terminal::Copy",
|
"ctrl-insert": "terminal::Copy",
|
||||||
|
"ctrl-a": "editor::SelectAll",
|
||||||
"shift-ctrl-v": "terminal::Paste",
|
"shift-ctrl-v": "terminal::Paste",
|
||||||
"shift-insert": "terminal::Paste",
|
"shift-insert": "terminal::Paste",
|
||||||
"ctrl-enter": "assistant::InlineAssist",
|
"ctrl-enter": "assistant::InlineAssist",
|
||||||
|
|
|
@ -628,6 +628,7 @@
|
||||||
"ctrl-cmd-space": "terminal::ShowCharacterPalette",
|
"ctrl-cmd-space": "terminal::ShowCharacterPalette",
|
||||||
"cmd-c": "terminal::Copy",
|
"cmd-c": "terminal::Copy",
|
||||||
"cmd-v": "terminal::Paste",
|
"cmd-v": "terminal::Paste",
|
||||||
|
"cmd-a": "editor::SelectAll",
|
||||||
"cmd-k": "terminal::Clear",
|
"cmd-k": "terminal::Clear",
|
||||||
"ctrl-enter": "assistant::InlineAssist",
|
"ctrl-enter": "assistant::InlineAssist",
|
||||||
// Some nice conveniences
|
// Some nice conveniences
|
||||||
|
|
|
@ -3,7 +3,7 @@ pub mod terminal_element;
|
||||||
pub mod terminal_panel;
|
pub mod terminal_panel;
|
||||||
|
|
||||||
use collections::HashSet;
|
use collections::HashSet;
|
||||||
use editor::{scroll::Autoscroll, Editor};
|
use editor::{actions::SelectAll, scroll::Autoscroll, Editor};
|
||||||
use futures::{stream::FuturesUnordered, StreamExt};
|
use futures::{stream::FuturesUnordered, StreamExt};
|
||||||
use gpui::{
|
use gpui::{
|
||||||
anchored, deferred, div, impl_actions, AnyElement, AppContext, DismissEvent, EventEmitter,
|
anchored, deferred, div, impl_actions, AnyElement, AppContext, DismissEvent, EventEmitter,
|
||||||
|
@ -33,8 +33,8 @@ use workspace::{
|
||||||
notifications::NotifyResultExt,
|
notifications::NotifyResultExt,
|
||||||
register_serializable_item,
|
register_serializable_item,
|
||||||
searchable::{SearchEvent, SearchOptions, SearchableItem, SearchableItemHandle},
|
searchable::{SearchEvent, SearchOptions, SearchableItem, SearchableItemHandle},
|
||||||
CloseActiveItem, NewCenterTerminal, OpenVisible, Pane, ToolbarItemLocation, Workspace,
|
CloseActiveItem, NewCenterTerminal, NewTerminal, OpenVisible, Pane, ToolbarItemLocation,
|
||||||
WorkspaceId,
|
Workspace, WorkspaceId,
|
||||||
};
|
};
|
||||||
|
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
|
@ -214,7 +214,13 @@ impl TerminalView {
|
||||||
cx: &mut ViewContext<Self>,
|
cx: &mut ViewContext<Self>,
|
||||||
) {
|
) {
|
||||||
let context_menu = ContextMenu::build(cx, |menu, _| {
|
let context_menu = ContextMenu::build(cx, |menu, _| {
|
||||||
menu.action("Clear", Box::new(Clear))
|
menu.action("New Terminal", Box::new(NewTerminal))
|
||||||
|
.separator()
|
||||||
|
.action("Copy", Box::new(Copy))
|
||||||
|
.action("Paste", Box::new(Paste))
|
||||||
|
.action("Select All", Box::new(SelectAll))
|
||||||
|
.action("Clear", Box::new(Clear))
|
||||||
|
.separator()
|
||||||
.action("Close", Box::new(CloseActiveItem { save_intent: None }))
|
.action("Close", Box::new(CloseActiveItem { save_intent: None }))
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -258,7 +264,7 @@ impl TerminalView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn select_all(&mut self, _: &editor::actions::SelectAll, cx: &mut ViewContext<Self>) {
|
fn select_all(&mut self, _: &SelectAll, cx: &mut ViewContext<Self>) {
|
||||||
self.terminal.update(cx, |term, _| term.select_all());
|
self.terminal.update(cx, |term, _| term.select_all());
|
||||||
cx.notify();
|
cx.notify();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue