1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-17 01:12:39 +01:00

Codechange: Store both left and right glyph positions in a run.

This also allows the end of a run to be known without using an extra position entry.
This commit is contained in:
Peter Nelson
2024-05-22 20:36:18 +01:00
committed by Peter Nelson
parent 80ddcb9d7d
commit 5cd81a980e
10 changed files with 68 additions and 61 deletions

View File

@@ -309,15 +309,15 @@ void Textbuf::UpdateWidth()
/** Update pixel position of the caret. */
void Textbuf::UpdateCaretPosition()
{
this->caretxoffs = this->chars > 1 ? GetCharPosInString(this->buf, this->buf + this->caretpos, FS_NORMAL).x : 0;
this->caretxoffs = this->chars > 1 ? GetCharPosInString(this->buf, this->buf + this->caretpos, FS_NORMAL).left : 0;
}
/** Update pixel positions of the marked text area. */
void Textbuf::UpdateMarkedText()
{
if (this->markend != 0) {
this->markxoffs = GetCharPosInString(this->buf, this->buf + this->markpos, FS_NORMAL).x;
this->marklength = GetCharPosInString(this->buf, this->buf + this->markend, FS_NORMAL).x - this->markxoffs;
this->markxoffs = GetCharPosInString(this->buf, this->buf + this->markpos, FS_NORMAL).left;
this->marklength = GetCharPosInString(this->buf, this->buf + this->markend, FS_NORMAL).left - this->markxoffs;
} else {
this->markxoffs = this->marklength = 0;
}