Clean unnecessary jumping
This commit is contained in:
parent
aa2f6e2260
commit
b81f74c0b2
1 changed files with 2 additions and 4 deletions
6
main.cpp
6
main.cpp
|
@ -61,7 +61,6 @@ void print_line(int pos) {
|
||||||
clear_line(pos);
|
clear_line(pos);
|
||||||
move(pos, 0);
|
move(pos, 0);
|
||||||
adds(get_line(pos));
|
adds(get_line(pos));
|
||||||
move(row, col);
|
|
||||||
}
|
}
|
||||||
// Print file content
|
// Print file content
|
||||||
void print_file(int start = 0) {
|
void print_file(int start = 0) {
|
||||||
|
@ -83,10 +82,8 @@ void print_file(int start = 0) {
|
||||||
// Jump to end of line
|
// Jump to end of line
|
||||||
void jump_line_end() {
|
void jump_line_end() {
|
||||||
int line_size = get_line(row).size();
|
int line_size = get_line(row).size();
|
||||||
if(col > line_size) {
|
if(col > line_size)
|
||||||
col = line_size;
|
col = line_size;
|
||||||
move(row, col);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Cursor movement
|
// Cursor movement
|
||||||
void move_cursor(char ch) {
|
void move_cursor(char ch) {
|
||||||
|
@ -149,6 +146,7 @@ int main(int argc, char* argv[]) {
|
||||||
// Main loop
|
// Main loop
|
||||||
bool run = true;
|
bool run = true;
|
||||||
while(run) {
|
while(run) {
|
||||||
|
move(row, col);
|
||||||
char ch = getch();
|
char ch = getch();
|
||||||
switch(mode) {
|
switch(mode) {
|
||||||
case normal:
|
case normal:
|
||||||
|
|
Loading…
Reference in a new issue