Fix assertion from setCursor() in outline-down/up

The function outline() itself can change the cursor position in some
cases so we need to store the old position before calling outline().

Spotted by Kornel. For an example file that triggered the assertion,
see:

  https://www.mail-archive.com/search?l=mid&q=20200326183314.09ad4c7c%40admin1-desktop

This commit amends adb7283b.
This commit is contained in:
Scott Kostyshak 2020-03-26 18:57:25 -04:00
parent 5db8b65e46
commit a1169188c7

View File

@ -2759,19 +2759,23 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
}
break;
case LFUN_OUTLINE_UP:
case LFUN_OUTLINE_UP: {
pos_type const opos = cur.pos();
outline(OutlineUp, cur, this);
setCursor(cur, cur.pit(), cur.pos());
setCursor(cur, cur.pit(), opos);
cur.forceBufferUpdate();
needsUpdate = true;
break;
}
case LFUN_OUTLINE_DOWN:
case LFUN_OUTLINE_DOWN: {
pos_type const opos = cur.pos();
outline(OutlineDown, cur, this);
setCursor(cur, cur.pit(), cur.pos());
setCursor(cur, cur.pit(), opos);
cur.forceBufferUpdate();
needsUpdate = true;
break;
}
case LFUN_OUTLINE_IN:
outline(OutlineIn, cur, this);