@@ -11,8 +11,8 @@ use alacritty_terminal::vte::ansi::{Color, NamedColor};
1111use copypasta:: ClipboardProvider ;
1212use egui:: epaint:: RectShape ;
1313use egui:: {
14- Align2 , Area , Button , Color32 , CornerRadius , CursorIcon , Id , Key , KeyboardShortcut , Modifiers ,
15- Painter , Pos2 , Rect , Response , Vec2 , WidgetText ,
14+ Align2 , Button , CornerRadius , CursorIcon , Key , KeyboardShortcut , Modifiers , Painter , Pos2 ,
15+ Rect , Response , Vec2 , WidgetText ,
1616} ;
1717use egui:: { Shape , Stroke } ;
1818
@@ -148,24 +148,19 @@ impl TerminalView<'_> {
148148}
149149
150150impl TerminalView < ' _ > {
151- pub fn context_menu ( & mut self , pos : Pos2 , layout : & Response , ui : & mut egui:: Ui ) {
152- Area :: new ( Id :: new ( format ! ( "context_menu_{:?}" , self . id( ) ) ) )
153- . fixed_pos ( pos)
154- . order ( egui:: Order :: Foreground )
155- . show ( ui. ctx ( ) , |ui| {
156- egui:: Frame :: popup ( ui. style ( ) ) . show ( ui, |ui| {
157- let width = 200. ;
158- ui. set_width ( width) ;
159- // copy btn
160- self . copy_btn ( ui, layout, width) ;
161- // paste btn
162- self . paste_btn ( ui, width) ;
163-
164- ui. separator ( ) ;
165- // select all btn
166- self . select_all_btn ( ui, width) ;
167- } ) ;
168- } ) ;
151+ pub fn context_menu ( & mut self , layout : & Response ) {
152+ layout. context_menu ( |ui| {
153+ let width = 200. ;
154+ ui. set_width ( width) ;
155+ // copy btn
156+ self . copy_btn ( ui, layout, width) ;
157+ // paste btn
158+ self . paste_btn ( ui, width) ;
159+
160+ ui. separator ( ) ;
161+ // select all btn
162+ self . select_all_btn ( ui, width) ;
163+ } ) ;
169164 }
170165
171166 fn copy_btn ( & mut self , ui : & mut egui:: Ui , layout : & Response , btn_width : f32 ) {
@@ -217,9 +212,7 @@ fn context_btn<'a>(
217212 width : f32 ,
218213 shortcut : Option < String > ,
219214) -> Button < ' a > {
220- let mut btn = Button :: new ( text)
221- . fill ( Color32 :: TRANSPARENT )
222- . min_size ( ( width, 0. ) . into ( ) ) ;
215+ let mut btn = Button :: new ( text) . min_size ( ( width, 0. ) . into ( ) ) ;
223216 if let Some ( shortcut) = shortcut {
224217 btn = btn. shortcut_text ( shortcut) ;
225218 }
0 commit comments