Introduction
Introduction Statistics Contact Development Disclaimer Help
tvi: clean up motion commands in empty buffers - neatvi - [fork] simple vi-type…
git clone git://src.adamsgaard.dk/neatvi
Log
Files
Refs
README
---
commit c7b521883bfdca0555a45ddf6e2dcb4b1ca3966a
parent ba8b939c9468cb119218cf20df963e1cd59fdd44
Author: Ali Gholami Rudi <[email protected]>
Date: Thu, 13 Oct 2016 10:18:33 +0330
vi: clean up motion commands in empty buffers
Diffstat:
M vi.c | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
---
diff --git a/vi.c b/vi.c
t@@ -338,26 +338,17 @@ static int vi_motionln(int *row, int cmd)
*row = (vi_arg1 || vi_arg2) ? cnt - 1 : lbuf_len(xb) - 1;
break;
case 'H':
- if (lbuf_len(xb))
- *row = MIN(xtop + cnt - 1, lbuf_len(xb) - 1);
- else
- *row = 0;
+ *row = MIN(xtop + cnt - 1, lbuf_len(xb) - 1);
break;
case 'L':
- if (lbuf_len(xb))
- *row = MIN(xtop + xrows - 1 - cnt + 1, lbuf_len(xb) - …
- else
- *row = 0;
+ *row = MIN(xtop + xrows - 1 - cnt + 1, lbuf_len(xb) - 1);
break;
case 'M':
- if (lbuf_len(xb))
- *row = MIN(xtop + xrows / 2, lbuf_len(xb) - 1);
- else
- *row = 0;
+ *row = MIN(xtop + xrows / 2, lbuf_len(xb) - 1);
break;
default:
if (c == cmd) {
- *row = MAX(0, MIN(*row + cnt - 1, lbuf_len(xb) - 1));
+ *row = MIN(*row + cnt - 1, lbuf_len(xb) - 1);
break;
}
if (c == '%' && (vi_arg1 || vi_arg2)) {
t@@ -369,6 +360,8 @@ static int vi_motionln(int *row, int cmd)
vi_back(c);
return 0;
}
+ if (*row < 0)
+ *row = 0;
return c;
}
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.