]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView.cpp
Simplify and polish
[lyx.git] / src / BufferView.cpp
index afd9ada647d399a43200a9e6ba6b6de749da034c..d0ce7e1624db8153202f50e4df7bdf09f79902a1 100644 (file)
@@ -1251,6 +1251,10 @@ bool BufferView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
                break;
        }
 
+       case LFUN_COPY:
+               flag.setEnabled(cur.selection());
+               break;
+
        default:
                return false;
        }
@@ -1649,20 +1653,7 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
        }
 
        case LFUN_WORD_REPLACE: {
-               bool has_deleted = false;
-               if (cur.selection()) {
-                       DocIterator beg = cur.selectionBegin();
-                       DocIterator end = cur.selectionEnd();
-                       if (beg.pit() == end.pit()) {
-                               for (pos_type p = beg.pos() ; p < end.pos() ; ++p) {
-                                       if (!cur.inMathed() && cur.paragraph().isDeleted(p)) {
-                                               has_deleted = true;
-                                               break;
-                                       }
-                               }
-                       }
-               }
-               if (lyxreplace(this, cmd, has_deleted)) {
+               if (lyxreplace(this, cmd)) {
                        dr.forceBufferUpdate();
                        dr.screenUpdate(Update::Force | Update::FitCursor);
                }
@@ -2187,6 +2178,11 @@ void BufferView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
                break;
        }
 
+       case LFUN_COPY:
+               cap::copySelection(cur);
+               cur.message(_("Copy"));
+               break;
+
        default:
                // OK, so try the Buffer itself...
                buffer_.dispatch(cmd, dr);