diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2013-12-14 14:08:26 +0000 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2013-12-14 14:38:17 +0000 |
| commit | 77590fe2e864fbde37067f341b6767c4f043dbed (patch) | |
| tree | f0a95aae43195b7150d4a4eb8f8ddddfb7c11c33 /src/selection.hh | |
| parent | dad27fe1a0d3cf7382675e9fb2c64a0a4f874a59 (diff) | |
Move (keep|flip|remove|clear)_selections from editor method to free selectors
Diffstat (limited to 'src/selection.hh')
| -rw-r--r-- | src/selection.hh | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/selection.hh b/src/selection.hh index 6dae9e95..cd60f87d 100644 --- a/src/selection.hh +++ b/src/selection.hh @@ -51,6 +51,21 @@ inline BufferIterator erase(Buffer& buffer, const Range& range) utf8::next(buffer.iterator_at(range.max()))); } +inline void avoid_eol(const Buffer& buffer, BufferCoord& coord) +{ + const auto column = coord.column; + const auto& line = buffer[coord.line]; + if (column != 0 and column == line.length() - 1) + coord.column = line.byte_count_to(line.char_length() - 2); +} + +inline void avoid_eol(const Buffer& buffer, Range& sel) +{ + avoid_eol(buffer, sel.first()); + avoid_eol(buffer, sel.last()); +} + + using CaptureList = std::vector<String>; // A selection is a Range, associated with a CaptureList |
