From 266cdca115c7e9b14f734da478d04a8ce0c2cb69 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Tue, 4 Dec 2012 04:46:13 +0100 Subject: search-kill command (FK) * like the other search-related commands the operation (delete, kill, replace) is not performed until the search pattern string argument is terminated (simplifies implementation and has visual advantages) --- search.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'search.cpp') diff --git a/search.cpp b/search.cpp index ea0613a..f27e744 100644 --- a/search.cpp +++ b/search.cpp @@ -13,6 +13,7 @@ namespace States { StateSearch search; StateSearchAll searchall; + StateSearchKill searchkill; StateSearchDelete searchdelete; StateReplace replace; StateReplace_insert replace_insert; @@ -494,6 +495,30 @@ StateSearchAll::done(const gchar *str) throw (Error) return &States::start; } +State * +StateSearchKill::done(const gchar *str) throw (Error) +{ + gint anchor; + + BEGIN_EXEC(&States::start); + + StateSearch::done(str); + + undo.push_msg(SCI_GOTOPOS, interface.ssm(SCI_GETCURRENTPOS)); + anchor = interface.ssm(SCI_GETANCHOR); + interface.ssm(SCI_GOTOPOS, anchor); + + interface.ssm(SCI_BEGINUNDOACTION); + interface.ssm(SCI_DELETERANGE, + parameters.dot, anchor - parameters.dot); + interface.ssm(SCI_ENDUNDOACTION); + ring.dirtify(); + + undo.push_msg(SCI_UNDO); + + return &States::start; +} + State * StateSearchDelete::done(const gchar *str) throw (Error) { -- cgit v1.2.3