← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] Select all previously searched text when opening Find / FindAndReplace dialogs

 

Sorry about the braces, here is a correct version.

I don't think this is platform specific, but it might. Or it could depend
on wxWidgets's version.
The behaviour I am addressing is not related to selecting an item in the
list.
When you open the "Search" dialog, SetSelection( 0 ) fills the combobox
with the last item from the list. I want this item to be highlighted ("text
selection") at that point. This is what SelectAll() does.

On the two Ubuntu machines where I tested the product branch (14.04 and
15.04, PPA and self compiled) this text highlighting is not done. The text
cursor is placed at position 0, nothing is selected.

As far I could test, the correct behaviour is exhibited by Window's and
Ubuntu's stable KiCad (circa 2013).
I could not find when the regression happened by looking at the code, that
is why I have a slight suspicion that wxWidgets changed its behaviour.

Note that once the window is open, there is no problem when choosing
another item in the list. All text is highlighted in this case.

2015-06-15 15:23 GMT+02:00 Wayne Stambaugh <stambaughw@xxxxxxxxx>:

> Your patch doesn't seem to make any difference on windows builds.  With
> or without your patch, the first item in the list is selected.  Does
> this fix a platform specific problem in your case.
>
> Also, please read the KiCad coding policy and fix your code formatting.
>
>
> http://ci.kicad-pcb.org/job/kicad-doxygen/ws/Documentation/doxygen/html/md_Documentation_development_coding-style-policy.html
>
> On 6/14/2015 10:06 AM, Martin d'Allens wrote:
> > Hi all,
> >
> > Here is a small patch to select the textbox when the Find dialog is
> > opened. This is more consistent with most text editors as far as I can
> > tell, and allows typing the needle right after Ctrl+F.
> > It used to bother me and I figured it would be an easy introduction to
> > contributing :)
> >
> > Martin
> >
> > PS: The following page
> http://www.kicad-pcb.org/display/DEV/Getting+Started
> > reads "git bzr clone lp:inkscape inkscape" where "inkscape should
> > obviously be "kicad"
> >
> >
> >
> > _______________________________________________
> > Mailing list: https://launchpad.net/~kicad-developers
> > Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> > Unsubscribe : https://launchpad.net/~kicad-developers
> > More help   : https://help.launchpad.net/ListHelp
> >
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
>
From 348989b3f16ec3554f5074f426f1bec621b4006a Mon Sep 17 00:00:00 2001
From: Martin d'Allens <martin.dallens@xxxxxxxxxxxxx>
Date: Mon, 15 Jun 2015 16:02:12 +0200
Subject: [PATCH] [PATCH] Select all previously searched text when opening Find
 / FindAndReplace dialogs

---
 eeschema/dialogs/dialog_schematic_find.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/eeschema/dialogs/dialog_schematic_find.cpp b/eeschema/dialogs/dialog_schematic_find.cpp
index 63800ef..52996a5 100644
--- a/eeschema/dialogs/dialog_schematic_find.cpp
+++ b/eeschema/dialogs/dialog_schematic_find.cpp
@@ -265,7 +265,10 @@ void DIALOG_SCH_FIND::SetFindEntries( const wxArrayString& aEntries )
     m_comboFind->Append( aEntries );
 
     if( m_comboFind->GetCount() )
+    {
         m_comboFind->SetSelection( 0 );
+        m_comboFind->SelectAll();
+    }
 }
 
 
@@ -274,5 +277,8 @@ void DIALOG_SCH_FIND::SetReplaceEntries( const wxArrayString& aEntries )
     m_comboReplace->Append( aEntries );
 
     if( m_comboReplace->GetCount() )
+    {
         m_comboReplace->SetSelection( 0 );
+        m_comboFind->SelectAll();
+    }
 }
-- 
1.9.1


Follow ups

References