added getLineNumberAtCursor() method to ZString.
This commit is contained in:
parent
d6d16a1b7f
commit
52d3985ffa
@ -575,4 +575,13 @@ namespace coreutils {
|
|||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ZString::getLineNumberAtCursor() {
|
||||||
|
int line = 1;
|
||||||
|
while(cursor != data)
|
||||||
|
if(*cursor-- == '\n')
|
||||||
|
++line;
|
||||||
|
return line;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -438,6 +438,13 @@ namespace coreutils {
|
|||||||
///
|
///
|
||||||
|
|
||||||
ZString removeTrailingZeros();
|
ZString removeTrailingZeros();
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Returns the number of line termination characters + 1 based upon
|
||||||
|
/// the cursor position.
|
||||||
|
///
|
||||||
|
|
||||||
|
int getLineNumberAtCursor();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
char *data;
|
char *data;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user