diff --git a/main.cpp b/main.cpp index 0345c6d..85079c8 100644 --- a/main.cpp +++ b/main.cpp @@ -61,7 +61,6 @@ void print_line(int pos) { clear_line(pos); move(pos, 0); adds(get_line(pos)); - move(row, col); } // Print file content void print_file(int start = 0) { @@ -83,10 +82,8 @@ void print_file(int start = 0) { // Jump to end of line void jump_line_end() { int line_size = get_line(row).size(); - if(col > line_size) { + if(col > line_size) col = line_size; - move(row, col); - } } // Cursor movement void move_cursor(char ch) { @@ -149,6 +146,7 @@ int main(int argc, char* argv[]) { // Main loop bool run = true; while(run) { + move(row, col); char ch = getch(); switch(mode) { case normal: