MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / MoveNext

Method MoveNext

src/textbuf.cpp:345–355  ·  view source on GitHub ↗

* Move to next character position. * @param what Move ITER_CHARACTER or ITER_WORD. * @return true iff able to move. */

Source from the content-addressed store, hash-verified

343 * @return true iff able to move.
344 */
345bool Textbuf::MoveNext(StringIterator::IterType what)
346{
347 if (this->caretpos >= this->buf.size()) return false;
348
349 size_t pos = this->char_iter->Next(what);
350 if (pos == StringIterator::END) return true;
351
352 this->caretpos = static_cast<uint16_t>(pos);
353 this->UpdateCaretPosition();
354 return true;
355}
356
357/**
358 * Handle text navigation with arrow keys left/right.

Callers 1

MovePosMethod · 0.95

Calls 3

UpdateCaretPositionMethod · 0.95
sizeMethod · 0.45
NextMethod · 0.45

Tested by

no test coverage detected