File indexing completed on 2024-05-05 12:23:16

0001 /*
0002     SPDX-FileCopyrightText: 2008 Erlend Hamberg <ehamberg@gmail.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef KATEVI_MOTION_H
0008 #define KATEVI_MOTION_H
0009 
0010 #include <ktexteditor_export.h>
0011 #include <vimode/command.h>
0012 #include <vimode/range.h>
0013 
0014 namespace KateVi
0015 {
0016 class NormalViMode;
0017 /**
0018  * combined class for motions and text objects. execute() returns a KateViRange.
0019  * For motions the returned range is only a position (start pos is (-1, -1) to
0020  * indicate this) for text objects a range (startx, starty), (endx, endy) is
0021  * returned
0022  */
0023 class KTEXTEDITOR_EXPORT Motion : public Command
0024 {
0025 public:
0026     Motion(const QString &pattern, Range (NormalViMode::*commandMethod)(), unsigned int flags = 0);
0027     Range execute(NormalViMode *mode) const;
0028 
0029 protected:
0030     Range (NormalViMode::*m_ptr2commandMethod)();
0031 };
0032 
0033 }
0034 
0035 #endif /* KATEVI_MOTION_H */