diff --git a/gensettings.py b/gensettings.py index d97ca42f..e65cf0e6 100644 --- a/gensettings.py +++ b/gensettings.py @@ -481,6 +481,22 @@ gensettingstf = [ "name": "singleline" }, { + "UI_V2_Only": True, + "uitype": "toggle", + "unit": "bool", + "label": "No Double Spaces", + "id": "remove_double_space", + "min": 0, + "max": 1, + "step": 1, + "default": 0, + "tooltip": "Remove any double spaces in the game text.", + "menu_path": "Interface", + "sub_path": "Formatting", + "classname": "user", + "name": "remove_double_space" + }, + { "UI_V2_Only": True, "uitype": "slider", "unit": "int", diff --git a/koboldai_settings.py b/koboldai_settings.py index 65741093..0ff7008a 100644 --- a/koboldai_settings.py +++ b/koboldai_settings.py @@ -956,6 +956,7 @@ class user_settings(settings): self.frmtrmspch = False self.frmtadsnsp = False self.singleline = False + self.remove_double_space = True self.importnum = -1 # Selection on import popup list self.importjs = {} # Temporary storage for import data self.loadselect = "" # Temporary storage for story filename to load @@ -1221,6 +1222,9 @@ class KoboldStoryRegister(object): return self.actions[i]["Selected Text"] def __setitem__(self, i, text): + if self.koboldai_vars.remove_double_space: + while " " in text: + text = text.replace(" ", " ") if i in self.actions: old = self.actions[i] old_text = self.actions[i]["Selected Text"] @@ -1289,6 +1293,9 @@ class KoboldStoryRegister(object): self.set_game_saved() def append(self, text, action_id_offset=0, recalc=True): + if self.koboldai_vars.remove_double_space: + while " " in text: + text = text.replace(" ", " ") self.clear_unused_options() self.action_count+=1 action_id = self.action_count + action_id_offset