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
OpenMSX for music can be found at:
- https://www.openttd.org/downloads/opengfx-releases/latest for OpenGFX
- https://www.openttd.org/downloads/opensfx-releases/latest for OpenSFX
- https://www.openttd.org/downloads/openmsx-releases/latest for OpenMSX
- [OpenGFX](https://www.openttd.org/downloads/opengfx-releases/latest)
- [OpenSFX](https://www.openttd.org/downloads/opensfx-releases/latest)
- [OpenMSX](https://www.openttd.org/downloads/openmsx-releases/latest)
Please follow the readme of these packages about the installation procedure.
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->chars -= c;
/* Fixup caret if needed. */
if (this->caretpos > from) {
if (this->caretpos <= to) {
this->caretpos = from;
auto fixup = [&](uint16_t &pos) {
if (pos <= from) return;
if (pos <= to) {
pos = from;
} 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) {
this->UpdateStringIter();