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

Method MovePrev

src/textbuf.cpp:328–338  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

326 * @return true iff able to move.
327 */
328bool Textbuf::MovePrev(StringIterator::IterType what)
329{
330 if (this->caretpos == 0) return false;
331
332 size_t pos = this->char_iter->Prev(what);
333 if (pos == StringIterator::END) return true;
334
335 this->caretpos = static_cast<uint16_t>(pos);
336 this->UpdateCaretPosition();
337 return true;
338}
339
340/**
341 * Move to next character position.

Callers 1

MovePosMethod · 0.95

Calls 2

UpdateCaretPositionMethod · 0.95
PrevMethod · 0.45

Tested by

no test coverage detected