Replace sequences of whitespace into single space in AddTags (#1840)

This commit is contained in:
Henrik Giesel 2022-05-07 01:16:57 +02:00 committed by GitHub
parent 1ec227d926
commit df1f7ff96c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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