Include creating a new line in line splitting

This commit is contained in:
Matúš Púll 2025-04-15 16:52:44 +02:00
parent ee2e61ad4d
commit 079e7669af

View file

@ -89,11 +89,11 @@ void print_file(int start = 0) {
clear_line(i); clear_line(i);
} }
// Splitting lines // Splitting lines
string split_line(int r, int s) { void split_line(int r, int s) {
string line = get_line(r); string line = get_line(r);
string ret = line.substr(s, line.size()); string newline = line.substr(s, line.size());
remove(r, s, line.size()-s); remove(r, s, line.size()-s);
return ret; new_line(r+1, newline);
} }
@ -224,7 +224,7 @@ int main(int argc, char* argv[]) {
print_line(row); print_line(row);
break; break;
case ENTER: case ENTER:
new_line(row+1, split_line(row, col)); split_line(row, col);
print_file(row++); print_file(row++);
jump_line_end(); jump_line_end();
break; break;