Read tabulator as a space

This commit is contained in:
Matúš Púll 2025-04-08 15:02:07 +02:00
parent d0104af6aa
commit 86dad44405

View file

@ -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;