Author Topic: Debugger: Put the most recent entered command in the position 0 of the wxComboBo  (Read 3606 times)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5906
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
When debugging, I see that it is annoying to select the recent command I just sent. For example, I send some commands to GDB from the panel, such as:

first, I enter "p a", then, I enter "p b", and finally I enter "p c", now if I use the UP and DOWN key, I see that the wxCombo list are:

Code
p a  -> this is selected firstly
p b
p c

This means the oldest command is selected, you have to press UP or DOWN several times to select the recent sent command.

But what I think is that the user maybe need only repeat the command he just entered.

This patch fix this issue. (If you look at the ThreadSearch's wxComboBox, you see the last search item is put in the position 0 of the wxComboBox list.

Code
 src/sdk/debuggermanager.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/sdk/debuggermanager.cpp b/src/sdk/debuggermanager.cpp
index eb4be390..65da9bc4 100644
--- a/src/sdk/debuggermanager.cpp
+++ b/src/sdk/debuggermanager.cpp
@@ -621,7 +621,7 @@ public:
             int index = m_command_entry->FindString(cmd);
             if (index != wxNOT_FOUND)
                 m_command_entry->Delete(index);
-            m_command_entry->Append(cmd);
+            m_command_entry->Insert(cmd, 0);
 
             m_command_entry->SetValue(wxEmptyString);
         }

OK to commit?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
I'm not sure the combo behaves the same on different OSes. :(
I'll do some testing with this patch, but I'm not too optimistic.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Works for both wx2.8 and 3.1 on my gentoo, so go on and commit this change.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5906
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Works for both wx2.8 and 3.1 on my gentoo, so go on and commit this change.
Thanks for the test, it is in trunk now.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.