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

Bug
open
SciTE (626)
2
2015-09-14
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.

     
  • 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);
    }
    }

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks