diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-04-06 12:13:01 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2016-04-06 13:41:14 +0200 |
| commit | 700ec992a2ed6fc16362052fb27933390fe2d7ee (patch) | |
| tree | 8d5c2ea034cd7bcdee1dad6bcf3ac669c5ae6bbc /vis-motions.c | |
| parent | 7df8140a9ba4f0fbc2c55fa2de5eb789d878d4a0 (diff) | |
| download | vis-700ec992a2ed6fc16362052fb27933390fe2d7ee.tar.gz vis-700ec992a2ed6fc16362052fb27933390fe2d7ee.tar.xz | |
text-motion: restore old text_{line_,}find_prev behavior
This partially reversts the "Fix to/till movements" commit
0d4093c3371079c5f75055338f0341f684542465
The pos += len hunk was interfering with other code which does
not want this behavior. The original issue should be fixed directly
within the to/till movements.
Diffstat (limited to 'vis-motions.c')
| -rw-r--r-- | vis-motions.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/vis-motions.c b/vis-motions.c index 3bb0b88..df8c1fe 100644 --- a/vis-motions.c +++ b/vis-motions.c @@ -89,20 +89,14 @@ static size_t till(Vis *vis, Text *txt, size_t pos) { } static size_t to_left(Vis *vis, Text *txt, size_t pos) { - char c; - if (pos == text_line_begin(txt, pos)) - return pos; - size_t hit = text_line_find_prev(txt, pos-1, vis->search_char); - if (!text_byte_get(txt, hit, &c) || c != vis->search_char[0]) - return pos; - return hit; + return text_line_find_prev(txt, pos, vis->search_char); } static size_t till_left(Vis *vis, Text *txt, size_t pos) { if (pos == text_line_begin(txt, pos)) return pos; size_t hit = to_left(vis, txt, pos-1); - if (hit != pos) + if (hit != pos-1) return text_char_next(txt, hit); return pos; } |
