Fix text editor auto-close with quotes

Back-spacing a quote from the beginning of a line
would delete the quote in-front instead of doing nothing.
This commit is contained in:
Campbell Barton 2021-11-14 11:26:06 +11:00
parent 2549384baa
commit 7e82c840b7
Notes: blender-bot 2023-07-10 10:12:37 +02:00
Referenced by issue #96267, N-Panel font size in 3.1 too big
Referenced by issue #93294, vertex paint sample color not working as intended.
Referenced by issue #93155, Rendering window is displaying wrongly result during rendering.
Referenced by issue #93129, Vertex Paint Viewport Overlays stencil mask not working
Referenced by issue #93130, View/Frame Selected (Vertex Paint mode) not working
1 changed files with 2 additions and 1 deletions

View File

@ -2431,7 +2431,8 @@ static int text_delete_exec(bContext *C, wmOperator *op)
const char *curr = text->curl->line + text->curc;
if (*curr != '\0') {
const char *prev = BLI_str_find_prev_char_utf8(curr, text->curl->line);
if (*curr == text_closing_character_pair_get(*prev)) {
if ((curr != prev) && /* When back-spacing from the start of the line. */
(*curr == text_closing_character_pair_get(*prev))) {
txt_move_right(text, false);
txt_backspace_char(text);
}