diff --git a/ZString.cpp b/ZString.cpp index e802d0a..b183547 100644 --- a/ZString.cpp +++ b/ZString.cpp @@ -583,6 +583,14 @@ namespace coreutils { ++line; return line; } - - + + void ZString::moveBackToLineStart() { + while(cursor != data) { + if(*cursor == '\n') + break; + cursor--; + } + return; + } + } diff --git a/ZString.h b/ZString.h index d870b95..029e0f4 100644 --- a/ZString.h +++ b/ZString.h @@ -445,7 +445,14 @@ namespace coreutils { /// int getLineNumberAtCursor(); - + + /// + /// Move the cursor to the beginning of a line or to the beginning of + /// the ZString. + /// + + void moveBackToLineStart(); + protected: char *data; char *cursor;