added moveBackToLineStart() method on ZString.

This commit is contained in:
Brad Arant 2024-11-26 10:33:31 -08:00
parent ab4da04de6
commit 2de5693e87
2 changed files with 18 additions and 3 deletions

View File

@ -583,6 +583,14 @@ namespace coreutils {
++line;
return line;
}
void ZString::moveBackToLineStart() {
while(cursor != data) {
if(*cursor == '\n')
break;
cursor--;
}
return;
}
}

View File

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