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

Method UpdateMarkedText

src/textbuf.cpp:311–321  ·  view source on GitHub ↗

Update pixel positions of the marked text area. */

Source from the content-addressed store, hash-verified

309
310/** Update pixel positions of the marked text area. */
311void Textbuf::UpdateMarkedText()
312{
313 if (this->markend != 0) {
314 const auto pos = GetCharPosInString(this->buf, this->markpos, FS_NORMAL);
315 const auto end = GetCharPosInString(this->buf, this->markend, FS_NORMAL);
316 this->markxoffs = std::min(pos.left, end.left);
317 this->marklength = std::max(pos.right, end.right) - this->markxoffs;
318 } else {
319 this->markxoffs = this->marklength = 0;
320 }
321}
322
323/**
324 * Move to previous character position.

Callers 5

DeleteCharMethod · 0.95
InsertCharMethod · 0.95
InsertStringMethod · 0.95
DeleteTextMethod · 0.95
UpdateSizeMethod · 0.95

Calls 1

GetCharPosInStringFunction · 0.85

Tested by

no test coverage detected