Skip to content

Commit

Permalink
Handle JS chatbox line break
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisFeline committed Dec 14, 2024
1 parent 2a3c28e commit e8d9ee8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
4 changes: 2 additions & 2 deletions Windows/SettingsWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ private void checkSendChatbox_CheckedChanged(object? sender, EventArgs e) {

private void linkEditChatbox_Click(object sender, LinkLabelLinkClickedEventArgs e) {
string template = Settings.Get.OSCMessageInfoTemplate.Template;
EditResult edit = EditWindow.Show(template, LANG.S("SETTINGS.OSCSENDCHATBOX.TITLE") ?? "Chatbox Message Template", this, handleNewLine: true, insertKeyTemplate: true);
EditResult edit = EditWindow.Show(template, LANG.S("SETTINGS.OSCSENDCHATBOX.TITLE") ?? "Chatbox Message Template", this, handleNewLine: false, insertKeyTemplate: true);
if (edit.Accept) {
Settings.Get.OSCMessageInfoTemplate.Template = string.IsNullOrEmpty(edit.Text) ? Settings.Default.OSCMessageInfoTemplate.Template : edit.Text;
Settings.Export();
Expand All @@ -631,7 +631,7 @@ private void linkEditChatbox_Click(object sender, LinkLabelLinkClickedEventArgs

private void linkAutoNoteEdit_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
string template = Settings.Get.RoundNoteTemplate.Template;
EditResult edit = EditWindow.Show(template, LANG.S("SETTINGS.SAVEROUNDNOTE.TITLE") ?? "Automatic Note Template", this, handleNewLine: true, insertKeyTemplate: true);
EditResult edit = EditWindow.Show(template, LANG.S("SETTINGS.SAVEROUNDNOTE.TITLE") ?? "Automatic Note Template", this, handleNewLine: false, insertKeyTemplate: true);
if (edit.Accept) {
Settings.Get.RoundNoteTemplate.Template = string.IsNullOrEmpty(edit.Text) ? Settings.Default.RoundNoteTemplate.Template : edit.Text;
Settings.Export();
Expand Down
19 changes: 1 addition & 18 deletions Windows/StatsWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,26 +220,9 @@ private void StatsWindow_ResizeEnd(object sender, EventArgs e) {
Refresh();
}

/*
public static string NormalizeLabelText(string text) {
for (int i = 0; i < text.Length; i++) {
if (i > 0 && char.IsUpper(text[i])) {
string a = text.Substring(0, i);
Console.WriteLine(a);
text = a + ' ' + text.Substring(i);
i++;
} else if (i == 0 && !char.IsUpper(text[i])) {
text = char.ToUpperInvariant(text[i]) + text.Substring(1);
}
}
return text;
}
*/

internal static void UpdateChatboxContent() {
if (IsRoundActive || !MainWindow.Started || !ToNLogContext.CanSendChatbox || string.IsNullOrEmpty(Settings.Get.OSCMessageInfoTemplate.Template)) return;
string template = TemplateManager.ReplaceTemplate(Settings.Get.OSCMessageInfoTemplate.Template);
string template = TemplateManager.ReplaceTemplate(Settings.Get.OSCMessageInfoTemplate.Template).Replace("\\n", "\n");
LilOSC.SetChatboxMessage(template);
}

Expand Down

0 comments on commit e8d9ee8

Please sign in to comment.