Hi,
the following patch by Jürgen (with a minor fix by myself) prevents the
replacement of deleted text.
I tested the fix and it works.
Even with this patch there are still a few minor problems with the
search&replace dialog:
- Replace/ReplaceAll is always activated when the dialog opens
- Replace should be enabled depending on the status of LFUN_WORD_REPLACE
Michael
Index: BufferView.cpp
===================================================================
--- BufferView.cpp (Revision 18815)
+++ BufferView.cpp (Arbeitskopie)
@@ -704,9 +704,21 @@
flag.enabled(true);
break;
- case LFUN_WORD_REPLACE:
- flag.enabled(!cur.paragraph().isDeleted(cur.pos()));
+ case LFUN_WORD_REPLACE: {
+ if (!cur.selection()) {
+ flag.enabled(!cur.paragraph().isDeleted(cur.pos()));
+ break;
+ }
+ DocIterator beg = cur.selectionBegin();
+ DocIterator end = cur.selectionEnd();
+ bool enabled = true;
+ for (pos_type p = beg.pos() ; p < end.pos() ; ++p) {
+ if (cur.paragraph().isDeleted(p))
+ enabled = false;
+ }
+ flag.enabled(enabled);
break;
+ }
case LFUN_LABEL_GOTO: {
flag.enabled(!cmd.argument().empty()