mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-26 03:59:55 +00:00
Removed debugs, added keymap contexts to terminal
This commit is contained in:
parent
1de68a724c
commit
399de91f55
4 changed files with 77 additions and 5 deletions
|
@ -505,7 +505,6 @@ impl TerminalEl {
|
|||
//This cannot be done conditionally for unknown reasons. Pending drag and drop rework.
|
||||
//This also does not fire on right-mouse-down-move events wild.
|
||||
.on_move(move |event, cx| {
|
||||
dbg!(event);
|
||||
if cx.is_parent_view_focused() {
|
||||
if let Some(conn_handle) = connection.upgrade(cx.app) {
|
||||
conn_handle.update(cx.app, |terminal, cx| {
|
||||
|
|
|
@ -39,7 +39,7 @@ actions!(
|
|||
Clear,
|
||||
Copy,
|
||||
Paste,
|
||||
ShowCharacterPalette
|
||||
ShowCharacterPalette,
|
||||
]
|
||||
);
|
||||
impl_internal_actions!(project_panel, [DeployContextMenu]);
|
||||
|
@ -364,11 +364,86 @@ impl View for ConnectedView {
|
|||
});
|
||||
}
|
||||
|
||||
fn keymap_context(&self, _: &gpui::AppContext) -> gpui::keymap::Context {
|
||||
fn keymap_context(&self, cx: &gpui::AppContext) -> gpui::keymap::Context {
|
||||
let mut context = Self::default_keymap_context();
|
||||
if self.modal {
|
||||
context.set.insert("ModalTerminal".into());
|
||||
}
|
||||
let mode = self.terminal.read(cx).last_mode;
|
||||
context.map.insert(
|
||||
"screen".to_string(),
|
||||
(if mode.contains(TermMode::ALT_SCREEN) {
|
||||
"alt"
|
||||
} else {
|
||||
"normal"
|
||||
})
|
||||
.to_string(),
|
||||
);
|
||||
|
||||
if mode.contains(TermMode::APP_CURSOR) {
|
||||
context.set.insert("DECCKM".to_string());
|
||||
}
|
||||
if mode.contains(TermMode::APP_KEYPAD) {
|
||||
context.set.insert("DECPAM".to_string());
|
||||
}
|
||||
//Note the ! here
|
||||
if !mode.contains(TermMode::APP_KEYPAD) {
|
||||
context.set.insert("DECPNM".to_string());
|
||||
}
|
||||
if mode.contains(TermMode::SHOW_CURSOR) {
|
||||
context.set.insert("DECTCEM".to_string());
|
||||
}
|
||||
if mode.contains(TermMode::LINE_WRAP) {
|
||||
context.set.insert("DECAWM".to_string());
|
||||
}
|
||||
if mode.contains(TermMode::ORIGIN) {
|
||||
context.set.insert("DECOM".to_string());
|
||||
}
|
||||
if mode.contains(TermMode::INSERT) {
|
||||
context.set.insert("IRM".to_string());
|
||||
}
|
||||
//LNM is apparently the name for this. https://vt100.net/docs/vt510-rm/LNM.html
|
||||
if mode.contains(TermMode::LINE_FEED_NEW_LINE) {
|
||||
context.set.insert("LNM".to_string());
|
||||
}
|
||||
if mode.contains(TermMode::FOCUS_IN_OUT) {
|
||||
context.set.insert("report_focus".to_string());
|
||||
}
|
||||
if mode.contains(TermMode::ALTERNATE_SCROLL) {
|
||||
context.set.insert("alternate_scroll".to_string());
|
||||
}
|
||||
if mode.contains(TermMode::BRACKETED_PASTE) {
|
||||
context.set.insert("bracketed_paste".to_string());
|
||||
}
|
||||
if mode.intersects(TermMode::MOUSE_MODE) {
|
||||
context.set.insert("any_mouse_reporting".to_string());
|
||||
}
|
||||
{
|
||||
let mouse_reporting = if mode.contains(TermMode::MOUSE_REPORT_CLICK) {
|
||||
"click"
|
||||
} else if mode.contains(TermMode::MOUSE_DRAG) {
|
||||
"drag"
|
||||
} else if mode.contains(TermMode::MOUSE_MOTION) {
|
||||
"motion"
|
||||
} else {
|
||||
"off"
|
||||
};
|
||||
context
|
||||
.map
|
||||
.insert("mouse_reporting".to_string(), mouse_reporting.to_string());
|
||||
}
|
||||
{
|
||||
let format = if mode.contains(TermMode::SGR_MOUSE) {
|
||||
"sgr"
|
||||
} else if mode.contains(TermMode::UTF8_MOUSE) {
|
||||
"utf8"
|
||||
} else {
|
||||
"normal"
|
||||
};
|
||||
context
|
||||
.map
|
||||
.insert("mouse_format".to_string(), format.to_string());
|
||||
}
|
||||
context
|
||||
}
|
||||
}
|
||||
|
|
|
@ -166,7 +166,6 @@ pub fn mouse_button_report(
|
|||
|
||||
pub fn mouse_moved_report(point: Point, e: &MouseMovedEvent, mode: TermMode) -> Option<Vec<u8>> {
|
||||
let button = MouseButton::from_move(e);
|
||||
dbg!(&button);
|
||||
|
||||
if !button.is_other() && mode.intersects(TermMode::MOUSE_MOTION | TermMode::MOUSE_DRAG) {
|
||||
//Only drags are reported in drag mode, so block NoneMove.
|
||||
|
|
|
@ -627,7 +627,6 @@ impl Terminal {
|
|||
}
|
||||
|
||||
pub fn mouse_move(&mut self, e: &MouseMovedEvent, origin: Vector2F) {
|
||||
dbg!("term mouse_move");
|
||||
let position = e.position.sub(origin);
|
||||
|
||||
let point = mouse_point(position, self.cur_size, self.last_offset);
|
||||
|
|
Loading…
Reference in a new issue