Commit 1f2ffee 1 parent f4e39a5 commit 1f2ffee Copy full SHA for 1f2ffee
File tree 3 files changed +9
-2
lines changed
3 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 1
- use crate :: frame_history:: FrameHistory ;
2
1
use eframe:: { Frame , NativeOptions } ;
3
2
use egui:: Context ;
3
+
4
4
use egui_memory_editor:: MemoryEditor ;
5
5
6
+ use crate :: frame_history:: FrameHistory ;
7
+
6
8
mod frame_history;
7
9
8
10
pub fn main ( ) {
@@ -34,6 +36,7 @@ impl Default for App {
34
36
35
37
// You can set the column count in the UI, but also here. There are a variety of options available in mem_editor.options
36
38
mem_editor. options . column_count = 16 ;
39
+
37
40
App {
38
41
mem_editor,
39
42
memory : Default :: default ( ) ,
@@ -72,6 +75,7 @@ impl Default for Memory {
72
75
}
73
76
}
74
77
}
78
+
75
79
impl Memory {
76
80
pub fn read_value ( & mut self , address : usize ) -> u8 {
77
81
self . memory [ address]
Original file line number Diff line number Diff line change @@ -301,7 +301,7 @@ impl MemoryEditor {
301
301
// For Editing
302
302
let response = ui. add (
303
303
TextEdit :: singleline ( & mut frame_data. selected_edit_address_string )
304
- . desired_width ( 6.0 )
304
+ . desired_width ( frame_data . previous_frame_text_edit_size )
305
305
. font ( options. memory_editor_text_style . clone ( ) )
306
306
. hint_text ( label_text)
307
307
. id_source ( frame_data. selected_edit_address ) ,
@@ -355,6 +355,8 @@ impl MemoryEditor {
355
355
}
356
356
357
357
let response = Label :: new ( text) . sense ( Sense :: click ( ) ) . ui ( ui) ;
358
+ // For use with the `Edit` widget, keep track of the size of ordinary display to keep column jitter at bay
359
+ frame_data. previous_frame_text_edit_size = response. rect . width ( ) ;
358
360
359
361
// Right click always selects.
360
362
if response. secondary_clicked ( ) {
Original file line number Diff line number Diff line change @@ -132,6 +132,7 @@ impl Default for MemoryEditorOptions {
132
132
pub ( crate ) struct BetweenFrameData {
133
133
/// Used to ensure we can resize the window in height, but not in width.
134
134
pub previous_frame_editor_width : f32 ,
135
+ pub previous_frame_text_edit_size : f32 ,
135
136
/// The address a user clicked on in the UI in the previous frame, used for DataPreview
136
137
pub selected_edit_address : Option < Address > ,
137
138
pub selected_edit_address_string : String ,
You can’t perform that action at this time.
0 commit comments