1
0
Fork 0

Compare commits

...

2 Commits

2 changed files with 16 additions and 9 deletions

View File

@ -78,9 +78,9 @@ For some platforms, you will need to refer to [the installation guide](https://w
The free data files, split into OpenGFX for graphics, OpenSFX for sounds and The free data files, split into OpenGFX for graphics, OpenSFX for sounds and
OpenMSX for music can be found at: OpenMSX for music can be found at:
- https://www.openttd.org/downloads/opengfx-releases/latest for OpenGFX - [OpenGFX](https://www.openttd.org/downloads/opengfx-releases/latest)
- https://www.openttd.org/downloads/opensfx-releases/latest for OpenSFX - [OpenSFX](https://www.openttd.org/downloads/opensfx-releases/latest)
- https://www.openttd.org/downloads/openmsx-releases/latest for OpenMSX - [OpenMSX](https://www.openttd.org/downloads/openmsx-releases/latest)
Please follow the readme of these packages about the installation procedure. Please follow the readme of these packages about the installation procedure.
The Windows installer can optionally download and install these packages. The Windows installer can optionally download and install these packages.

View File

@ -247,14 +247,21 @@ void Textbuf::DeleteText(uint16_t from, uint16_t to, bool update)
this->bytes -= to - from; this->bytes -= to - from;
this->chars -= c; this->chars -= c;
/* Fixup caret if needed. */ auto fixup = [&](uint16_t &pos) {
if (this->caretpos > from) { if (pos <= from) return;
if (this->caretpos <= to) { if (pos <= to) {
this->caretpos = from; pos = from;
} else { } else {
this->caretpos -= to - from; pos -= to - from;
} }
} };
/* Fixup caret if needed. */
fixup(this->caretpos);
/* Fixup marked text if needed. */
fixup(this->markpos);
fixup(this->markend);
if (update) { if (update) {
this->UpdateStringIter(); this->UpdateStringIter();