Browse Source

add char at cursor position

Kajetan Johannes Hammerle 3 years ago
parent
commit
3bb317a69f
1 changed files with 5 additions and 2 deletions
  1. 5 2
      RawReader.h

+ 5 - 2
RawReader.h

@@ -156,8 +156,11 @@ private:
 
     void addChar(char c) {
         if(index + 1 < N) {
-            buffer[bufferIndex][index++] = c;
-            buffer[bufferIndex][index] = '\0';
+            index++;
+            for(int i = 0; i < move + 1; i++) {
+                buffer[bufferIndex][index - i] = buffer[bufferIndex][index - i - 1];
+            }
+            buffer[bufferIndex][index - move - 1] = c;
         }
     }