Read tabulator as a space
This commit is contained in:
parent
d0104af6aa
commit
86dad44405
1 changed files with 7 additions and 3 deletions
10
main.cpp
10
main.cpp
|
@ -22,7 +22,13 @@ int row = 0, col = 0;
|
|||
int file_offset = 0;
|
||||
|
||||
// Accessing the file
|
||||
string get_line(int r) { return file.find(file_offset+r)->text; }
|
||||
string get_line(int r) {
|
||||
string line = (*file.find(file_offset+r)).text;
|
||||
for(int i = 0; i < line.size(); ++i)
|
||||
if(line[i] == '\t')
|
||||
line[i] = ' ';
|
||||
return line;
|
||||
}
|
||||
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 insert_line(int r, string text = "") { file.insert(file_offset+r, text); }
|
||||
|
@ -189,8 +195,6 @@ int main(int argc, char* argv[]) {
|
|||
}
|
||||
break;
|
||||
case insert:
|
||||
if(ch == '\t')
|
||||
ch = ' ';
|
||||
switch(ch) {
|
||||
case ESC:
|
||||
mode = normal;
|
||||
|
|
Loading…
Reference in a new issue