Skip to content

Commit 778cc83

Browse files
iamazygoogyouhua
andauthored
fix: select out of terminal (#30)
* fix: select out-of-terminal * fix: select out of terminal * fix: select out of terminal --------- Co-authored-by: gongyh <[email protected]>
1 parent b164f96 commit 778cc83

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

crates/egui-term/src/display/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ impl TerminalView<'_> {
182182

183183
fn paste_btn(&mut self, ui: &mut egui::Ui, btn_width: f32) {
184184
#[cfg(not(target_os = "macos"))]
185-
let paste_shortcut = KeyboardShortcut::new(Modifiers::CTRL, Key::V);
185+
let paste_shortcut = KeyboardShortcut::new(Modifiers::CTRL | Modifiers::SHIFT, Key::V);
186186
#[cfg(target_os = "macos")]
187187
let paste_shortcut = KeyboardShortcut::new(Modifiers::MAC_CMD, Key::V);
188188
let paste_shortcut = ui.ctx().format_shortcut(&paste_shortcut);

crates/egui-term/src/ssh/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl EventedReadWrite for Pty {
9797

9898
poller.add_with_mode(
9999
&self.signals,
100-
Event::writable(PTY_CHILD_EVENT_TOKEN),
100+
Event::readable(PTY_CHILD_EVENT_TOKEN),
101101
PollMode::Level,
102102
)?;
103103
}
@@ -132,7 +132,7 @@ impl EventedReadWrite for Pty {
132132

133133
poller.modify_with_mode(
134134
&self.signals,
135-
Event::writable(PTY_CHILD_EVENT_TOKEN),
135+
Event::readable(PTY_CHILD_EVENT_TOKEN),
136136
PollMode::Level,
137137
)?;
138138
}

crates/egui-term/src/view.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,14 @@ impl<'a> TerminalView<'a> {
240240
modifiers,
241241
pos,
242242
} => {
243-
if out_of_terminal(pos, layout) {
244-
continue;
245-
}
243+
let new_pos = if out_of_terminal(pos, layout) {
244+
pos.clamp(layout.rect.min, layout.rect.max)
245+
} else {
246+
pos
247+
};
248+
246249
if let Some(action) =
247-
self.button_click(state, layout, button, pos, &modifiers, pressed)
250+
self.button_click(state, layout, button, new_pos, &modifiers, pressed)
248251
{
249252
input_actions.push(action);
250253
}

0 commit comments

Comments
 (0)