From 457fe1498d5fe88e0447ddecd617281f7afd3304 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Tue, 4 Dec 2012 03:15:24 +0100 Subject: search and replace command (FS) * makes use of Scintilla selections, so their usage has been improved * search commands preserve selection on termination (escape) * selections are restored on rubout * search-replace command makes use of the Insert command's state (may serve as a base class now) but does not pop additional values from stack (like "I" does) --- search.h | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'search.h') diff --git a/search.h b/search.h index 670e860..46e37e2 100644 --- a/search.h +++ b/search.h @@ -7,7 +7,13 @@ #include "parser.h" #include "qbuffers.h" +/* + * "S" command state and base class for all other search/replace commands + */ class StateSearch : public StateExpectString { +public: + StateSearch(bool last = true) : StateExpectString(true, last) {} + protected: struct Parameters { gint dot; @@ -42,9 +48,24 @@ private: State *done(const gchar *str) throw (Error); }; +class StateReplace : public StateSearch { +public: + StateReplace() : StateSearch(false) {} + +private: + State *done(const gchar *str) throw (Error); +}; + +class StateReplace_insert : public StateInsert { +private: + void initial(void) throw (Error) {} +}; + namespace States { - extern StateSearch search; - extern StateSearchAll searchall; + extern StateSearch search; + extern StateSearchAll searchall; + extern StateReplace replace; + extern StateReplace_insert replace_insert; } #endif -- cgit v1.2.3