From 8272662627fb7d933210d541ecbf7e280629ace8 Mon Sep 17 00:00:00 2001 From: ghidragon <106987263+ghidragon@users.noreply.github.com> Date: Mon, 8 Sep 2025 13:10:02 -0400 Subject: [PATCH] GP-5883 fixed Memory Search Options GUI not initializing all options to current model settings --- .../base/memsearch/gui/MemorySearchOptionsPanel.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Ghidra/Features/Base/src/main/java/ghidra/features/base/memsearch/gui/MemorySearchOptionsPanel.java b/Ghidra/Features/Base/src/main/java/ghidra/features/base/memsearch/gui/MemorySearchOptionsPanel.java index 64d90ff0a0..4b5585254b 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/features/base/memsearch/gui/MemorySearchOptionsPanel.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/features/base/memsearch/gui/MemorySearchOptionsPanel.java @@ -114,8 +114,9 @@ class MemorySearchOptionsPanel extends JPanel { innerPanel.add(label); Integer[] decimalSizes = new Integer[] { 1, 2, 3, 4, 5, 6, 7, 8, 16 }; + int decimalByteSize = model.getDecimalByteSize(); decimalByteSizeCombo = new GComboBox<>(decimalSizes); - decimalByteSizeCombo.setSelectedItem(4); + decimalByteSizeCombo.setSelectedItem(decimalByteSize); decimalByteSizeCombo.addItemListener(this::byteSizeComboChanged); decimalByteSizeCombo.setToolTipText("Size of decimal values in bytes"); innerPanel.add(decimalByteSizeCombo); @@ -126,6 +127,7 @@ class MemorySearchOptionsPanel extends JPanel { "Sets whether decimal values should be interpreted as unsigned values"); decimalUnsignedCheckbox.addActionListener( e -> model.setDecimalUnsigned(decimalUnsignedCheckbox.isSelected())); + decimalUnsignedCheckbox.setSelected(model.isDecimalUnsigned()); panel.add(decimalUnsignedCheckbox); return panel; @@ -205,9 +207,10 @@ class MemorySearchOptionsPanel extends JPanel { Charset[] supportedCharsets = { StandardCharsets.US_ASCII, StandardCharsets.UTF_8, StandardCharsets.UTF_16 }; + Charset charSet = model.getStringCharset(); charsetCombo = new GComboBox<>(supportedCharsets); charsetCombo.setName("Encoding Options"); - charsetCombo.setSelectedIndex(0); + charsetCombo.setSelectedItem(charSet); charsetCombo.addItemListener(this::encodingComboChanged); charsetCombo.setToolTipText("Character encoding for translating strings to bytes");