Menu

#1254 find.close.on.find=0 doesn't work

Bug
closed-fixed
SciTE (662)
2
2017-08-16
2011-11-27
Sworddragon
No

I'm using SciTE 3.0.1 and have set find.close.on.find to 0 in ~/.SciTEUser.properties. I'm opening the "Find" dialog with Ctrl + F, typing a word in the input field and pressing the "Find" button. Independent if I find something or not the dialog closes every time. The documentation says that the dialog shouldn't close in this case.

Discussion

  • Neil Hodgson

    Neil Hodgson - 2011-11-27
    • assigned_to: nobody --> nyamatongwe
    • priority: 5 --> 2
     
  • Neil Hodgson

    Neil Hodgson - 2011-11-27

    find.close.on.find is only implemented on Windows.

     
  • jacky yang

    jacky yang - 2015-09-13

    When I run SciTE 3.6.0 on Fedora, that happens again.

    The code in scite/src/SciTEBase.cxx :

    int SciTEBase::FindNext(bool reverseDirection, bool showWarnings, bool allowRegExp) {*
    
    ...
    
            if (!replacing && closeFind) {
                DestroyFindReplace();
            }
        }
        return posFind;
    }
    

    seems that there is no problem.

    But You could find that in scite/gtk/SciTEGTK.cxx :

    void SciTEGTK::DestroyFindReplace() {
        dlgFindReplace.Destroy();
    }
    

    void SciTEGTK::FRFindCmd() {
    FindReplaceGrabFields();
    bool isFindDialog = !dlgFindReplace.wComboReplace;
    if (isFindDialog)
    dlgFindReplace.Destroy();
    if (findWhat[0]) {
    FindNext(isFindDialog && reverseFind);
    }
    }

    So You can repalce it with :

    void SciTEGTK::FRFindCmd() {
    FindReplaceGrabFields();
    bool isFindDialog = !dlgFindReplace.wComboReplace;
    if (isFindDialog && closeFind)
    dlgFindReplace.Destroy();
    if (findWhat[0]) {
    FindNext(isFindDialog && reverseFind);
    }
    }

    Now it works well.

     
    • luxio

      luxio - 2017-08-15

      Does not compile:

      SciTEGTK.cxx: In member function 'void SciTEGTK::FRFindCmd()':
      SciTEGTK.cxx:2047:19: error: no match for 'operator&&' (operand types are 'bool' and 'Searcher::CloseFind')
        if (isFindDialog && closeFind)
            \~~~~~~~~~~~~~^~~~~~~~~~~~
      SciTEGTK.cxx:2047:19: note: candidate: operator&&(bool, bool) <built-in>
      SciTEGTK.cxx:2047:19: note:   no known conversion for argument 2 from 'Searcher::CloseFind' to 'bool'
      
       
  • jacky yang

    jacky yang - 2015-09-13

    When You set find.use.strip=1 or use default option, You must add more code in scite/gtk/SciTEGTK.cxx :

    Add a member variable and function in class FindStrip.

    class FindStrip : public FindReplaceStrip {
    public:
    WStatic wStaticFind;
    WButton wButton;
    WButton wButtonMarkAll;
    enum { checks = 6 };
    WCheckDraw wCheck[checks];
    bool * m_pCloseFind;

    FindStrip() : m_pCloseFind(NULL) {
    }
    void SetCloseFind( bool * pCloseFind ) {
    m_pCloseFind = pCloseFind;
    }

    virtual void Creation(GtkWidget *boxMain);

    ...
    }

    Modify FindStrip::FindNextCmd() and FindStrip::MarkAllCmd() :

    void FindStrip::FindNextCmd() {
    GrabFields();
    if (pSearcher->FindHasText()) {
    pSearcher->FindNext(pSearcher->reverseFind);
    }
    if( (NULL != m_pCloseFind) && (false == (m_pCloseFind)) ) {
    return;
    }**
    Close();
    }***

    void FindStrip::MarkAllCmd() {
    GrabFields();
    pSearcher->MarkAll();
    pSearcher->FindNext(pSearcher->reverseFind);
    if( (NULL != m_pCloseFind) && (false == (m_pCloseFind)) ) {
    return;
    }**
    Close();
    }***

    Initialize FindStrip::m_pCloseFind in class SciTEGTK :

    SciTEGTK::SciTEGTK(Extension ext) : SciTEBase(ext) {*

    ...

    // Fullscreen handling
    fullScreen = false;

    findStrip.SetCloseFind( &closeFind );

    instance = this;
    }

    Now it works really well.

     
  • jacky yang

    jacky yang - 2015-09-14

    Using "SciTEGTK::replacing" may be better than "bool isFindDialog = !dlgFindReplace.wComboReplace;" .

    You could replace

    void SciTEGTK::FRFindCmd() {
    FindReplaceGrabFields();
    bool isFindDialog = !dlgFindReplace.wComboReplace;
    if (isFindDialog && closeFind)
    dlgFindReplace.Destroy();
    if (findWhat[0]) {
    FindNext(isFindDialog && reverseFind);
    }
    }

    with

    void SciTEGTK::FRFindCmd() {
    FindReplaceGrabFields();
    bool isFindDialog = !replacing;
    if (isFindDialog && closeFind)
    dlgFindReplace.Destroy();
    if (findWhat[0]) {
    FindNext(isFindDialog && reverseFind);
    }
    }

     
  • luxio

    luxio - 2017-08-15

    Has anyone been able to get this working on Linux?

     
  • Neil Hodgson

    Neil Hodgson - 2017-08-16
    • status: open --> open-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2017-08-16

    See the current release 4.0.0.

     
  • Neil Hodgson

    Neil Hodgson - 2017-08-16
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.