Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: ollydbg on October 01, 2018, 02:35:14 pm

Title: Debugger: Put the most recent entered command in the position 0 of the wxComboBo
Post by: ollydbg on October 01, 2018, 02:35:14 pm
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?
Title: Re: Debugger: Put the most recent entered command in the position 0 of the wxComboBo
Post by: oBFusCATed on October 02, 2018, 10:03:49 am
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.
Title: Re: Debugger: Put the most recent entered command in the position 0 of the wxComboBo
Post by: oBFusCATed on October 03, 2018, 12:13:55 am
Works for both wx2.8 and 3.1 on my gentoo, so go on and commit this change.
Title: Re: Debugger: Put the most recent entered command in the position 0 of the wxComboBo
Post by: ollydbg on October 03, 2018, 11:08:21 am
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.