From: Jean-Marc Lasgouttes Date: Mon, 13 Apr 2020 10:58:43 +0000 (+0200) Subject: Do not try to put cursor after space if no space was kept X-Git-Tag: 2.3.5~61 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=cc5d3bd9f445e99018dc94e6dceb9c1140c09d09;p=features.git Do not try to put cursor after space if no space was kept The logic was wrong and could cause crashes Fixes bug #11777. --- diff --git a/src/Text2.cpp b/src/Text2.cpp index ce5259805e..71569dba46 100644 --- a/src/Text2.cpp +++ b/src/Text2.cpp @@ -797,8 +797,9 @@ void fixCursorAfterDelete(CursorSlice & cur, CursorSlice const & where, return; // If cursor position is after the deletion place update it + // but if we are not at start of line keep it after the space that was kept. if (cur.pos() > from) - cur.pos() = max(from + 1, cur.pos() - num_chars); + cur.pos() = max(from + (from > 0), cur.pos() - num_chars); // Check also if we don't want to set the cursor on a spot behind the // pagragraph because we erased the last character. diff --git a/status.23x b/status.23x index acd7e1233b..d184ac55d0 100644 --- a/status.23x +++ b/status.23x @@ -105,6 +105,8 @@ What's new - Avoid crash in some cases where a dialog is shown during operation (bug 11763). +- Fix crash with nested insets when spaces are removed automatically (bug 11777). + * INTERNALS