From 01b4e7e2a05b24126825458489b4fdce08054fd8 Mon Sep 17 00:00:00 2001 From: Michael Shirt Date: Sat, 29 Oct 2016 18:47:54 -0600 Subject: [PATCH] Fixing textbox width issue --- scripts/Window_Message.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/Window_Message.rb b/scripts/Window_Message.rb index 02266db..793b2d7 100644 --- a/scripts/Window_Message.rb +++ b/scripts/Window_Message.rb @@ -119,12 +119,13 @@ class Window_Message < Window_Selectable spacewidth = self.contents.text_size(' ').width text.split("\n").each do |line| line.split(' ').each do |word| - if word.start_with?('\003') - #ignore new facepics - next - end + # Get width of this word and insert a newline if it goes out of bounds width = self.contents.text_size(word.gsub(/(\000\[[0-9]+\]|\001|\002)/, '')).width + if word.include?("\003") + #ignore new facepics + width = 0 + end if x + width > maxwidth @text << "\n" x = 0