diff --git a/build/index.html b/build/index.html index a4b28ccea..70c71c5cd 100644 --- a/build/index.html +++ b/build/index.html @@ -2290,6 +2290,10 @@ } if (ret == null) return true; + if (typeof ret !== 'string') + ret = ret.toString(); + if (ret.length === 0 && !client.options.returnNewlineOnEmptyValue) + return true; if (item.send) { if (!ret.endsWith('\n')) ret += '\n'; @@ -2353,6 +2357,15 @@ }, 0); return true; } + if (typeof ret !== 'string') + ret = ret.toString(); + if (ret.length === 0 && !client.options.returnNewlineOnEmptyValue) { + setTimeout(() => { + if (client.options.CommandonClick) + client.commandInput[0].focus(); + }, 0); + return true; + } if (button.send) { if (!ret.endsWith('\n')) ret += '\n'; diff --git a/build/prefs.html b/build/prefs.html index 1bc395f1d..7f9c869e5 100644 --- a/build/prefs.html +++ b/build/prefs.html @@ -2665,6 +2665,11 @@ WARNING: Enabling profile group saving could cause sync issues and loss of data when saving preferences or profiles +
+ +
diff --git a/changelog.md b/changelog.md index bffc0f497..2d5dc6586 100644 --- a/changelog.md +++ b/changelog.md @@ -18,6 +18,7 @@ - Add [Save Trigger State Changes](docs/preferences.md#advanced--profiles) Add option to control if state changes are saved every time they change - New Advanced sub page for all profile related preferences. - Add [Group profile saves](docs/preferences.md#advanced--profiles) and [Group profile save delay](docs/preferences.md#advanced--profiles) to allow grouping of profile saves + - Add [Return newline on empty value](docs/preferences.md#advanced--profiles) Return new line if processed item value is empty - [Triggers](docs/profiles.md#triggers) - Add `Loop Expression` trigger type - Add `ReParse` and `ReParse Pattern` sub type triggers diff --git a/docs/preferences.md b/docs/preferences.md index f7d61fd10..18d7bca8a 100644 --- a/docs/preferences.md +++ b/docs/preferences.md @@ -249,7 +249,7 @@ Controls what is captured into the chat window - `Group profile saves` Group profile saves - **WARNING:** Enabling profile group saving could cause sync issues and loss of data when preferences saved or profile manager saves, as when saved it will flush all in memory changes and reload - `Group profile save delay` How often between save profiles when group saves are enabled - +- `Return newline on empty value` Return new line if processed item value is empty ## Advanced > Profile manager diff --git a/src/common/input.ts b/src/common/input.ts index 757e7d06e..af5fbd7d2 100644 --- a/src/common/input.ts +++ b/src/common/input.ts @@ -7493,7 +7493,8 @@ export class Input extends EventEmitter { //Convert to string if (typeof ret !== 'string') ret = ret.toString(); - + if (ret.length === 0 && !this.client.options.returnNewlineOnEmptyValue) + return null; if (ret.endsWith('\n')) return ret; return ret + '\n'; @@ -7564,6 +7565,8 @@ export class Input extends EventEmitter { //Convert to string if (typeof ret !== 'string') ret = ret.toString(); + if (ret.length === 0 && !this.client.options.returnNewlineOnEmptyValue) + return null; if (macro.send) { if (!ret.endsWith('\n')) ret += '\n'; @@ -7774,7 +7777,7 @@ export class Input extends EventEmitter { //last check to be 100% sure enabled if (!trigger.enabled) continue; } - tType = this.getTriggerType(trigger.type); + tType = this.getTriggerType(trigger.type); if (trigger.type !== undefined && (type & tType) !== tType) { if (!subtypes || (subtypes && !this.isSubTriggerType(trigger.type))) continue; @@ -8130,6 +8133,8 @@ export class Input extends EventEmitter { //Convert to string if (typeof ret !== 'string') ret = ret.toString(); + if (ret.length === 0 && !this.client.options.returnNewlineOnEmptyValue) + return null; if (!ret.endsWith('\n')) ret += '\n'; if (this.client.connected) diff --git a/src/common/settings.ts b/src/common/settings.ts index e432fd331..530754c91 100644 --- a/src/common/settings.ts +++ b/src/common/settings.ts @@ -478,6 +478,7 @@ export class Settings { public saveTriggerStateChanges: boolean = true; public groupProfileSaves: boolean = false; public groupProfileSaveDelay: number = 20000; + public returnNewlineOnEmptyValue: boolean = false; public windows = {}; public buttons = {