summaryrefslogtreecommitdiff
path: root/src/editor.hh
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2013-10-30 08:46:15 +0000
committerMaxime Coste <frrrwww@gmail.com>2013-11-04 22:02:43 +0000
commit3e1250763613a14ec2d4fbca915ee95dcba1981e (patch)
tree8d6e522ff6a3736aad4df36b127d3cbfbd3e6947 /src/editor.hh
parent3e1bb777ce9c8de3dbe55dee4e454241eddc98d1 (diff)
Remove IncrementalInserter and move it's code to InputModes::Insert
Diffstat (limited to 'src/editor.hh')
-rw-r--r--src/editor.hh31
1 files changed, 8 insertions, 23 deletions
diff --git a/src/editor.hh b/src/editor.hh
index 0104d43d..95ef2f52 100644
--- a/src/editor.hh
+++ b/src/editor.hh
@@ -9,6 +9,8 @@
namespace Kakoune
{
+namespace InputModes { class Insert; }
+
class Register;
enum class SelectMode
@@ -88,6 +90,7 @@ public:
bool is_editing() const { return m_edition_level!= 0; }
private:
friend struct scoped_edition;
+ friend class InputModes::Insert;
void begin_edition();
void end_edition();
@@ -98,8 +101,6 @@ private:
void check_invariant() const;
- friend class IncrementalInserter;
-
safe_ptr<Buffer> m_buffer;
DynamicSelectionList m_selections;
size_t m_main_sel;
@@ -114,32 +115,16 @@ struct scoped_edition
~scoped_edition()
{ m_editor.end_edition(); }
-private:
- Editor& m_editor;
-};
-// An IncrementalInserter manage insert mode
-class IncrementalInserter
-{
-public:
- IncrementalInserter(Editor& editor, InsertMode mode = InsertMode::Insert);
- ~IncrementalInserter();
-
- void insert(String content);
- void insert(memoryview<String> strings);
- void erase();
- void move_cursors(CharCount move);
- void move_cursors(LineCount move);
-
- Buffer& buffer() const { return m_editor.buffer(); }
Editor& editor() const { return m_editor; }
-
private:
- InsertMode m_mode;
- Editor& m_editor;
- scoped_edition m_edition;
+ Editor& m_editor;
};
+void avoid_eol(const Buffer& buffer, BufferCoord& coord);
+void avoid_eol(const Buffer& buffer, Range& sel);
+void sort_and_merge_overlapping(SelectionList& selections, size_t& main_selection);
+
}
#endif // editor_hh_INCLUDED