@ -78,21 +78,20 @@ where
}
}
#[ inline ]
#[ inline ]
fn supports_keyboard_enhancement_protocol ( & self ) -> io ::Result < bool > {
fn supports_keyboard_enhancement_protocol ( & self ) -> bool {
self . supports_keyboard_enhancement_protocol
* self . supports_keyboard_enhancement_protocol
. get_or_ try_ init( | | {
. get_or_ init( | | {
use std ::time ::Instant ;
use std ::time ::Instant ;
let now = Instant ::now ( ) ;
let now = Instant ::now ( ) ;
let support = terminal ::supports_keyboard_enhancement ( ) ;
let support ed = matches! ( terminal ::supports_keyboard_enhancement ( ) , Ok ( true ) ) ;
log ::debug ! (
log ::debug ! (
"The keyboard enhancement protocol is {}supported in this terminal (checked in {:?})" ,
"The keyboard enhancement protocol is {}supported in this terminal (checked in {:?})" ,
if matches! ( support , Ok ( true ) ) { "" } else { "not " } ,
if supported { "" } else { "not " } ,
Instant ::now ( ) . duration_since ( now )
Instant ::now ( ) . duration_since ( now )
) ;
) ;
support
support ed
} )
} )
. copied ( )
}
}
}
}
@ -125,7 +124,7 @@ where
if config . enable_mouse_capture {
if config . enable_mouse_capture {
execute ! ( self . buffer , EnableMouseCapture ) ? ;
execute ! ( self . buffer , EnableMouseCapture ) ? ;
}
}
if self . supports_keyboard_enhancement_protocol ( ) ? {
if self . supports_keyboard_enhancement_protocol ( ) {
execute ! (
execute ! (
self . buffer ,
self . buffer ,
PushKeyboardEnhancementFlags (
PushKeyboardEnhancementFlags (
@ -143,7 +142,7 @@ where
if config . enable_mouse_capture {
if config . enable_mouse_capture {
execute ! ( self . buffer , DisableMouseCapture ) ? ;
execute ! ( self . buffer , DisableMouseCapture ) ? ;
}
}
if self . supports_keyboard_enhancement_protocol ( ) ? {
if self . supports_keyboard_enhancement_protocol ( ) {
execute ! ( self . buffer , PopKeyboardEnhancementFlags ) ? ;
execute ! ( self . buffer , PopKeyboardEnhancementFlags ) ? ;
}
}
execute ! (
execute ! (