@@ -2,7 +2,7 @@ use crate::alacritty::{BackendCommand, TerminalContext};
22use crate :: bindings:: Binding ;
33use crate :: bindings:: { BindingAction , Bindings , InputKind } ;
44use crate :: font:: TerminalFont ;
5- use crate :: input:: InputAction ;
5+ use crate :: input:: { is_in_terminal , InputAction } ;
66use crate :: scroll_bar:: { InteractiveScrollbar , ScrollbarState } ;
77use crate :: theme:: TerminalTheme ;
88use crate :: types:: Size ;
@@ -82,7 +82,7 @@ impl Widget for TerminalView<'_> {
8282
8383 // context menu
8484 if let Some ( pos) = state. context_menu_position {
85- if ! out_of_terminal ( pos, layout. rect ) {
85+ if is_in_terminal ( pos, layout. rect ) {
8686 self . context_menu ( pos, & layout, ui) ;
8787 }
8888 }
@@ -100,7 +100,7 @@ impl Widget for TerminalView<'_> {
100100 . process_input ( & mut state, & layout) ;
101101
102102 if let Some ( pos) = state. mouse_position {
103- if ! out_of_terminal ( pos, layout. rect ) {
103+ if is_in_terminal ( pos, layout. rect ) {
104104 if let Some ( cur_pos) = state. cursor_position {
105105 ui. ctx ( ) . output_mut ( |output| {
106106 let vec = Vec2 :: new ( 15. , 15. ) ;
@@ -257,10 +257,10 @@ impl<'a> TerminalView<'a> {
257257 modifiers,
258258 pos,
259259 } => {
260- let new_pos = if out_of_terminal ( pos, layout. rect ) {
261- pos. clamp ( layout. rect . min , layout. rect . max )
262- } else {
260+ let new_pos = if is_in_terminal ( pos, layout. rect ) {
263261 pos
262+ } else {
263+ pos. clamp ( layout. rect . min , layout. rect . max )
264264 } ;
265265
266266 if let Some ( action) =
@@ -303,7 +303,3 @@ impl<'a> TerminalView<'a> {
303303 self
304304 }
305305}
306-
307- fn out_of_terminal ( pos : Pos2 , rect : Rect ) -> bool {
308- !( pos. x > rect. min . x && pos. x < rect. max . x && pos. y > rect. min . y && pos. y < rect. max . y )
309- }
0 commit comments