Fix jump + add jump to position
This commit is contained in:
parent
ea7db7ef4e
commit
178bcc2cd5
1 changed files with 12 additions and 4 deletions
16
main.cpp
16
main.cpp
|
@ -208,16 +208,24 @@ void jump(count_type r) {
|
|||
count_type last_start = file.size()-LINES;
|
||||
if(last_start < 0)
|
||||
last_start = 0;
|
||||
file_offset = r;
|
||||
if(file_offset > last_start)
|
||||
file_offset = last_start;
|
||||
cur.r = 0;
|
||||
file_offset = r;
|
||||
if(file_offset > last_start) {
|
||||
file_offset = last_start;
|
||||
cur.r = r - file_offset;
|
||||
if(cur.r >= LINES)
|
||||
cur.r = LINES-1;
|
||||
}
|
||||
jump_line_end();
|
||||
}
|
||||
// Jump to position
|
||||
void jump(position p) {
|
||||
jump(p.r);
|
||||
cur.c = p.c;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
|
||||
// Check valid filename and load
|
||||
if(argc <= 1)
|
||||
return 1;
|
||||
|
|
Loading…
Reference in a new issue