diff --git a/main.cpp b/main.cpp index 05d874c..8dbfe58 100644 --- a/main.cpp +++ b/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;