From e26bba7b283174d217e0ec85ce8d3d1e25ba4cd1 Mon Sep 17 00:00:00 2001 From: Matt Atlas Date: Wed, 19 Jun 2019 20:01:15 +0200 Subject: [PATCH] Fix autopunctuation issues. (#6578) Autopunctuation will no longer autopunctuate if markup (* or /) is present at the end of the sentence. It will also no longer input an empty period if you put nothing in the chat box. Fixes #6536 --- code/modules/mob/living/say.dm | 9 +++++---- html/changelogs/mattatlas-6578.yml | 7 +++++++ 2 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 html/changelogs/mattatlas-6578.yml diff --git a/code/modules/mob/living/say.dm b/code/modules/mob/living/say.dm index bdf4e074dea..1f0714bdc81 100644 --- a/code/modules/mob/living/say.dm +++ b/code/modules/mob/living/say.dm @@ -161,6 +161,11 @@ proc/get_radio_key_from_channel(var/channel) var/message_mode = parse_message_mode(message, "headset") + var/static/list/correct_punctuation = list("!" = TRUE, "." = TRUE, "?" = TRUE, "-" = TRUE, "~" = TRUE, "*" = TRUE, "/" = TRUE) + var/ending = copytext(message, length(message), (length(message) + 1)) + if(ending && !correct_punctuation[ending]) + message += "." + message = process_chat_markup(message, list("~", "_")) switch(copytext(message,1,2)) @@ -176,10 +181,6 @@ proc/get_radio_key_from_channel(var/channel) message = trim_left(message) - var/ending = copytext(message, length(message), (length(message) + 1)) - if(ending != "!" && ending != "." && ending != "?" && ending != "-") - message += "." - //parse the language code and consume it if(!speaking) speaking = parse_language(message) diff --git a/html/changelogs/mattatlas-6578.yml b/html/changelogs/mattatlas-6578.yml new file mode 100644 index 00000000000..7dd15254194 --- /dev/null +++ b/html/changelogs/mattatlas-6578.yml @@ -0,0 +1,7 @@ +author: MattAtlas + +delete-after: True + +changes: + - bugfix: "Autopunctuation will no longer autopunctuate if markup (* or /) is present at the end of the sentence." + - bugfix: "Autopunctuation will no longer send a period if you input an empty chat box."