From 86dad4440574421f2b46305a8f28cbb1efbd778b Mon Sep 17 00:00:00 2001 From: Matuush Date: Tue, 8 Apr 2025 15:02:07 +0200 Subject: [PATCH] Read tabulator as a space --- main.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/main.cpp b/main.cpp index 92c2de2..9e010d5 100644 --- a/main.cpp +++ b/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;