Fix bug #1254 find.close.on.find=0 doesn't work on Gtk
You could see it.
bug #1254 https://sourceforge.net/p/scintilla/bugs/1254/
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.
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.
Modify FindStrip::FindNextCmd() and FindStrip::MarkAllCmd() :
Initialize FindStrip::m_pCloseFind in class SciTEGTK :
Now it works really well.
Using "SciTEGTK::replacing" may be better than "bool isFindDialog = !dlgFindReplace.wComboReplace;" .
You could replace
with
closeFind is available from Searcher which can be accessed through pSearcher. See the Windows implementation of the find strip in win32/Strips.cxx.
(SciTEGTK.findStrip.closeFind != SciTEGTK.closeFind) == true
I don't understand what you are saying here. There is no FindStrip::closeFind field. FindStrip may access the closeFind field on SciTEGTK through pSearcher which points back to the SciTEGTK instance. That is,
SciTEGTK::findStrip.pSearcher->closeFind is SciTEGTK::closeFind
It is crazy to remove DestroyFindReplace() from class SciTEBase,SciTEGTK and SciTEWin.
Modify these files :
scite/src/SciTEBase.h
scite/src/SciTEBase.cxx
scite/gtk/SciTEGTK.cxx
scite/gtk/SciTEGTK.cxx
scite/win32/SciTEWin.h
and
scite/win32/SciTEWinDlg.cxx
Everything is OK.
I do not think everything is OK as that does not appear to close the dialog or strip in all the cases where it currently does and should continue to do so. A patch targetted at just the minimum set of points and just for GTK+ is better than modifying code that is shared between platforms.
The minimum patch appears to be
You set find.use.strip=1 or replace.use.strip=1. What will happen when you click menu Find or Replace after you have already open FindIncrementPanel?
The findStrip or replaceStrip and FindIncrementPanel will display at the bottom of window at the same time.
You can change it. Make it mutually exclusive between in FindIncrementPanel, findStrip, replaceStrip. Make it mutually exclusive between in dlgFindReplace, findStrip, replaceStrip. You can switch between dlgFindReplace, findStrip, replaceStrip and FindIncrementPanel whenever you want it.
scite/gtk/SciTEGTK.cxx
Replace the old SciTEGTK::Find():
With the new one:
Replace the old SciTEGTK::Replace():
With the new one:
Replace the old SciTEGTK::FindIncrement():
With the new one:
You can press Esc to close dlgFindReplace, findStrip, replaceStrip or FindIncrementPanel whenever you do it.
All the code is tested to run on fedora.