diff options
| author | Johannes Altmanninger <aclopte@gmail.com> | 2020-05-17 13:55:54 +0200 |
|---|---|---|
| committer | Johannes Altmanninger <aclopte@gmail.com> | 2020-05-17 14:15:48 +0200 |
| commit | fc63eef69556637433b1351d0e8d2c4638883122 (patch) | |
| tree | 9f5e6ea97d0a995a615820be444631c2efd08ee2 /src/selectors.cc | |
| parent | 08509cb4087d7d79868fcff96080bb9947ce4e7b (diff) | |
Fix crash when selecting previous paragraph at buffer begin
Fixes #3489
When there are multiple empty lines between a paragraph and the cursor
(C in the example below), <a-[>p skips over one of them. Prevent the
check for the extra newline from going out of bounds.
```
a paragraph
C after <a-[>p, the first two lines will be selected
```
Diffstat (limited to 'src/selectors.cc')
| -rw-r--r-- | src/selectors.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/selectors.cc b/src/selectors.cc index baa2d9ac..c7e126b3 100644 --- a/src/selectors.cc +++ b/src/selectors.cc @@ -560,7 +560,7 @@ select_paragraph(const Context& context, const Selection& selection, BufferIterator first = buffer.iterator_at(selection.cursor()); if (not (flags & ObjectFlags::ToEnd) and first.coord() > BufferCoord{0,1} and - is_eol(*(first-1)) and is_eol(*(first-2))) + is_eol(*(first-1)) and first-1 != buffer.begin() and is_eol(*(first-2))) --first; else if ((flags & ObjectFlags::ToEnd) and first != buffer.begin() and (first+1) != buffer.end() and |
