Cleanup: minor tweaks to auto-close

Spelling and failure to reuse variable missed in review.
This commit is contained in:
Campbell Barton 2021-11-14 11:11:20 +11:00
parent 73047c69ea
commit 2549384baa
1 changed files with 5 additions and 6 deletions

View File

@ -87,7 +87,7 @@ static void test_line_start(char c, bool *r_last_state)
/**
* This function receives a character and returns its closing pair if it exists.
* \param character: Characater to find the closing pair.
* \param character: Character to find the closing pair.
* \return The closing pair of the character if it exists.
*/
static char text_closing_character_pair_get(const char character)
@ -2428,11 +2428,10 @@ static int text_delete_exec(bContext *C, wmOperator *op)
}
}
if (U.text_flag & USER_TEXT_EDIT_AUTO_CLOSE) {
const char *current = text->curl->line + text->curc;
if (*current != '\0') {
const char *prev = BLI_str_find_prev_char_utf8(text->curl->line + text->curc,
text->curl->line);
if (*current == text_closing_character_pair_get(*prev)) {
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)) {
txt_move_right(text, false);
txt_backspace_char(text);
}