diff --git a/ZString.cpp b/ZString.cpp index 172c31d..e802d0a 100644 --- a/ZString.cpp +++ b/ZString.cpp @@ -576,9 +576,10 @@ namespace coreutils { } int ZString::getLineNumberAtCursor() { + char *temp = cursor; int line = 1; - while(cursor != data) - if(*cursor-- == '\n') + while(temp != data) + if(*temp-- == '\n') ++line; return line; }