commit 21755d9ef882a3d8a9e10a717eaa56d8a28b5e3e parent da92096a6428e5e69a03945237ead35d062529fc Author: Pavel Renev <an2qzavok@gmail.com> Date: Tue, 24 Aug 2021 11:37:37 +0000 fix crash when pressing backspace too many times Diffstat:
M | richterm.c | | | 7 | ++++--- |
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/richterm.c b/richterm.c @@ -195,9 +195,10 @@ threadmain(int argc, char **argv) break; } if (kv == 0x08) { /* backspace */ - /*TODO: should stop at last offset, not 0 */ - if (rich.text->count > 0) rich.text->count--; - nbsend(redrawc, &olast); + if (rich.text->count > olast->offset) { + rich.text->count--; + nbsend(redrawc, &olast); + } break; } if (rich.objects->count > 0) {