diff --git a/src/sdk/editormanager.cpp b/src/sdk/editormanager.cpp
index 73e1956..28f6fec 100644
--- a/src/sdk/editormanager.cpp
+++ b/src/sdk/editormanager.cpp
@@ -1479,8 +1479,13 @@ void EditorManager::CalculateFindReplaceStartEnd(cbStyledTextCtrl* control, cbFi
// there can be a selection, the last found match)
if ((data->scope == 0) && data->NewSearch && (ssta != cpos || send != cpos))
{
- ssta = cpos;
- send = cpos;
+ // Don't do this in replace mode, because we want to start the replacement
+ // with the current selection, not the first match after the selection.
+ if (!replace)
+ {
+ ssta = cpos;
+ send = cpos;
+ }
}
@@ -1587,7 +1592,7 @@ int EditorManager::Replace(cbStyledTextCtrl* control, cbFindReplaceData* data)
}
control->BeginUndoAction(); // The undo is set at this point in case we need to convert the EOLs.
- CalculateFindReplaceStartEnd(control, data);
+ CalculateFindReplaceStartEnd(control, data, true);
if (data->matchWord)
flags |= wxSCI_FIND_WHOLEWORD;
gtk_clipboard_set_text(
gtk_clipboard_get(GDK_SELECTION_PRIMARY),
selectedText.mb_str(wxConvUTF8),
selectedText.Length() );
If I select something and then search/replace, it only ever replaces occurrences inside the selection, as I would expect.The idea is that you don't search inside the selection, but you select something (single word), fire up the replace dialog and don't change the search term.
Are you sure this is not some broken plugin that adds "extra smartness" and doesn't work?Reproduces with just the core built from inside C::B.
diff --git a/src/sdk/findreplacedlg.cpp b/src/sdk/findreplacedlg.cpp
index 50da448..3dd4e38 100644
--- a/src/sdk/findreplacedlg.cpp
+++ b/src/sdk/findreplacedlg.cpp
@@ -229,6 +229,7 @@ FindReplaceDlg::FindReplaceDlg(wxWindow* parent, const wxString& initial, bool h
XRCCTRL(*this, "chkDelOldSearchRes2", wxCheckBox)->Show();
}
+ wxComboBox *findCombo = nullptr;
m_findPage = 0;
if (findReplaceInFilesOnly)
{
@@ -236,16 +237,22 @@ FindReplaceDlg::FindReplaceDlg(wxWindow* parent, const wxString& initial, bool h
XRCCTRL(*this, "nbReplace", wxNotebook)->SetSelection(1);
m_findPage = (XRCCTRL(*this, "nbReplace", wxNotebook)->GetPage(0)); // no active editor, so only replace-in-files
(XRCCTRL(*this, "nbReplace", wxNotebook)->RemovePage(0)); // no active editor, so only replace-in-files
- XRCCTRL(*this, "cmbFind2", wxComboBox)->SetFocus();
+ findCombo = XRCCTRL(*this, "cmbFind2", wxComboBox);
m_findReplaceInFilesActive = true;
}
else if (m_findReplaceInFilesActive)
{
XRCCTRL(*this, "nbReplace", wxNotebook)->SetSelection(1); // Search->Replace in Files was selected
- XRCCTRL(*this, "cmbFind2", wxComboBox)->SetFocus();
+ findCombo = XRCCTRL(*this, "cmbFind2", wxComboBox);
}
else
- XRCCTRL(*this, "cmbFind1", wxComboBox)->SetFocus();
+ findCombo = XRCCTRL(*this, "cmbFind1", wxComboBox);
+
+ if (findCombo)
+ {
+ findCombo->SetFocus();
+// findCombo->SetSelection(0, findCombo->GetValue().length());
+ }
GetSizer()->SetSizeHints(this);
Have anyone tried the patch?I'm tired of trying GIT patches you know.. ::)
Index: src/sdk/findreplacedlg.cpp
===================================================================
--- src/sdk/findreplacedlg.cpp
+++ src/sdk/findreplacedlg.cpp
@@ -229,6 +229,7 @@ FindReplaceDlg::FindReplaceDlg(wxWindow* parent, const wxString& initial, bool h
XRCCTRL(*this, "chkDelOldSearchRes2", wxCheckBox)->Show();
}
+ wxComboBox *findCombo = nullptr;
m_findPage = 0;
if (findReplaceInFilesOnly)
{
@@ -236,16 +237,22 @@ FindReplaceDlg::FindReplaceDlg(wxWindow* parent, const wxString& initial, bool h
XRCCTRL(*this, "nbReplace", wxNotebook)->SetSelection(1);
m_findPage = (XRCCTRL(*this, "nbReplace", wxNotebook)->GetPage(0)); // no active editor, so only replace-in-files
(XRCCTRL(*this, "nbReplace", wxNotebook)->RemovePage(0)); // no active editor, so only replace-in-files
- XRCCTRL(*this, "cmbFind2", wxComboBox)->SetFocus();
+ findCombo = XRCCTRL(*this, "cmbFind2", wxComboBox);
m_findReplaceInFilesActive = true;
}
else if (m_findReplaceInFilesActive)
{
XRCCTRL(*this, "nbReplace", wxNotebook)->SetSelection(1); // Search->Replace in Files was selected
- XRCCTRL(*this, "cmbFind2", wxComboBox)->SetFocus();
+ findCombo = XRCCTRL(*this, "cmbFind2", wxComboBox);
}
else
- XRCCTRL(*this, "cmbFind1", wxComboBox)->SetFocus();
+ findCombo = XRCCTRL(*this, "cmbFind1", wxComboBox);
+
+ if (findCombo)
+ {
+ findCombo->SetFocus();
+// findCombo->SetSelection(0, findCombo->GetValue().length());
+ }
GetSizer()->SetSizeHints(this);
p.s. now you know how I feel, when I see commits full of style-changes and you start to advertise your tool and workflow ::) :PI don't know exactly what you mean, but I still believe you'll definitely reach more devs and potentially interested people with a SVN patch. So its up to you in the end what you want to achieve... I don't mind if you post GIT patches at all, I just won't invest much time to hack a patch so it works for me (and only me). Would you hack SVN patches so they work on GIT? I doubt. ;D
OK - this one applied.The idea is not to apply it, but to play with the options and then tell me which are working and which doesn't.
I don't know exactly what you mean ...I mean that every time I mention that it is a bad practice to combine real changes with white-space/style changes you mention that I have to use your super-dupper-paid SmartXXX software. So you apply double standard here :P ;D