Rename add_line into insert_line
This commit is contained in:
parent
9d860991f3
commit
d0104af6aa
1 changed files with 5 additions and 3 deletions
8
main.cpp
8
main.cpp
|
@ -25,7 +25,7 @@ int file_offset = 0;
|
|||
string get_line(int r) { return file.find(file_offset+r)->text; }
|
||||
char get(int r, int s) { return get_line(file_offset+r)[s]; }
|
||||
void set(int r, int s, char ch) { file.find(file_offset+r)->text[s] = ch; }
|
||||
void add_line(int r, string text = "") { file.insert(file_offset+r, text); }
|
||||
void insert_line(int r, string text = "") { file.insert(file_offset+r, text); }
|
||||
void insert_char(int r, int s, char ch) { file.find(file_offset+r)->text.insert(s, string{ch}); }
|
||||
void remove_char(int r, int s, int len=1) { file.find(file_offset+r)->text.erase(s,len); }
|
||||
void remove_line(int r) { file.remove(file_offset+r); }
|
||||
|
@ -172,7 +172,7 @@ int main(int argc, char* argv[]) {
|
|||
print_line(row);
|
||||
break;
|
||||
case 'o':
|
||||
add_line(row);
|
||||
insert_line(row);
|
||||
print_file(row);
|
||||
break;
|
||||
case 'q':
|
||||
|
@ -189,6 +189,8 @@ int main(int argc, char* argv[]) {
|
|||
}
|
||||
break;
|
||||
case insert:
|
||||
if(ch == '\t')
|
||||
ch = ' ';
|
||||
switch(ch) {
|
||||
case ESC:
|
||||
mode = normal;
|
||||
|
@ -200,7 +202,7 @@ int main(int argc, char* argv[]) {
|
|||
print_line(row);
|
||||
break;
|
||||
case ENTER:
|
||||
add_line(row+1, split_line(row, col));
|
||||
insert_line(row+1, split_line(row, col));
|
||||
print_file(row++);
|
||||
jump_line_end();
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue