Yanfly MessageCore WordWrap Spacing Issues

Discussion in 'Javascript/Plugin Support' started by dragoonkain, Oct 27, 2015.

  1. dragoonkain

    dragoonkain Villager Member

    Messages:
    20
    Likes Received:
    16
    First Language:
    English
    I've been encountering a lot of places where turning on WordWrap in YanFly MessageCore is resulting in words being glued together.

    http://imgur.com/eid4iBS

    I have been able to correct this issue with the following code.

    Window_Base.prototype.setWordWrap = function(text) { this._wordWrap = false; if (text.match(/<(?:WordWrap)>/i)) { this._wordWrap = true; text = text.replace(/<(?:WordWrap)>/gi, '\n'); } if (this._wordWrap) { text = text.replace(/^[\n\r]/, ''); text = text.replace(/(?!^) [\n\r]/g, ''); text = text.replace(/(?!^)[\n\r]+/g, ' '); // text = text.replace(/[\n\r]+/g, ''); text = text.replace(/<(?:BR|line break)>/gi, '\n'); } return text;};I was hoping someone out there might know what the issue is (if I can prevent it from happening) and/or if the fix could be consolidated to not needing 3 regexes. 
     
    #1

Share This Page