mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Nibbler::backN
- Added a method to support multi-byte backstep through a string. - Added unit tests.
This commit is contained in:
parent
2281c5a6bf
commit
663c82837c
3 changed files with 28 additions and 4 deletions
|
@ -1077,6 +1077,18 @@ bool Nibbler::skipRx (const std::string& regex)
|
|||
}
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Nibbler::backN (const int quantity /*= 1*/)
|
||||
{
|
||||
if (_cursor >= quantity)
|
||||
{
|
||||
_cursor -= quantity;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void Nibbler::getRemainder (std::string& result)
|
||||
{
|
||||
|
|
|
@ -93,6 +93,8 @@ public:
|
|||
bool skipRx (const std::string&);
|
||||
#endif
|
||||
|
||||
bool backN (const int quantity = 1);
|
||||
|
||||
void getRemainder (std::string&);
|
||||
|
||||
char next ();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue