From df1f7ff96c8bec312856dba7f5f6d0c2807fccab Mon Sep 17 00:00:00 2001 From: Henrik Giesel Date: Sat, 7 May 2022 01:16:57 +0200 Subject: [PATCH] Replace sequences of whitespace into single space in AddTags (#1840) --- qt/aqt/browser/browser.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/qt/aqt/browser/browser.py b/qt/aqt/browser/browser.py index a38b5bb95..40c400090 100644 --- a/qt/aqt/browser/browser.py +++ b/qt/aqt/browser/browser.py @@ -4,6 +4,7 @@ from __future__ import annotations import json +import re from typing import Callable, Sequence import aqt @@ -735,8 +736,12 @@ class Browser(QMainWindow): "Shows prompt if tags not provided." if not (tags := tags or self._prompt_for_tags(tr.browsing_enter_tags_to_add())): return + + space_separated_tags = re.sub(r"[ \n\t\v]+", " ", tags) add_tags_to_notes( - parent=self, note_ids=self.selected_notes(), space_separated_tags=tags + parent=self, + note_ids=self.selected_notes(), + space_separated_tags=space_separated_tags, ).run_in_background(initiator=self) @no_arg_trigger