[0.17.2] word_wrap in LuaGuiElements wrapping aggressively and inconsistently

This subforum contains all the issues which we already resolved.
Post Reply
project6
Inserter
Inserter
Posts: 22
Joined: Sat Aug 15, 2015 10:31 pm
Contact:

[0.17.2] word_wrap in LuaGuiElements wrapping aggressively and inconsistently

Post by project6 »

word_wrap seems to be acting in an inconsistent and unexpected manner. It is wrapping things far too short, but the wrapping behaviour changes when the string is being changed in vivo. Further, the wrapping behaviour reverts to being aggressive when you change away from it.

Initial wrapping is aggressive:
Image

While editing it wraps as expected:
Image

When changing tabs back and forth the aggressive wrapping returns:
Image

Code: Select all

{
    tab_button = function(parent)
        local button = parent.add {type = 'button', name = tab_button_name, caption = "What's New"}
        return button
    end,
    content = function(parent, player)
        local read_only = not player.admin

        header_label(parent, 'New Features')

        local new_info_flow = parent.add {name = 'whatsNew_new_info_flow',type = 'flow'}
        new_info_flow.style.horizontal_align = 'center'

        local new_info_textbox =
            new_info_flow.add {
            type = 'text-box',
            name = editable_textbox_name,
            text = editable_info[new_info_key]
        }
        new_info_textbox.read_only = read_only

        new_info_textbox.word_wrap = true

        local new_info_textbox_style = new_info_textbox.style
        new_info_textbox_style.width = 590
        new_info_textbox_style.height = 300

        Gui.set_data(new_info_textbox, new_info_key)
    end
}

Rseding91
Factorio Staff
Factorio Staff
Posts: 13175
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.17.2] word_wrap in LuaGuiElements wrapping aggressively and inconsistently

Post by Rseding91 »

Thanks for the report. Can you please give a save file and mod(s) you're using that reproduces this issue.
If you want to get ahold of me I'm almost always on Discord.

project6
Inserter
Inserter
Posts: 22
Joined: Sat Aug 15, 2015 10:31 pm
Contact:

Re: [0.17.2] word_wrap in LuaGuiElements wrapping aggressively and inconsistently

Post by project6 »

The pic was taken with the redmew scenario which is quite large, and has a lot of framework which would make pinpointing the issue a chore. I'll upload a save with the barest code to clearly demonstrate the majority of the issue, and a save with the full redmew scenario for completion.

In the redmew scenario you can open the info screen by clicking the question mark top left, then "Map info" and "What's new" will both contain elements which have word_wrap enabled.

In both cases no mods are used.
Attachments
redmew_save.zip
(14.53 MiB) Downloaded 47 times
barest_save.zip
(603.29 KiB) Downloaded 50 times

User avatar
SimonFlapse
Burner Inserter
Burner Inserter
Posts: 17
Joined: Thu Feb 28, 2019 1:20 pm
Contact:

Re: [0.17.2] word_wrap in LuaGuiElements wrapping aggressively and inconsistently

Post by SimonFlapse »

Adding to this.
It seems that the wrapping happens as if the textbox's width was 250px:

The top textbox is 230px wide and the bottom one is 312px wide. It's clear that the wrapping happens around 250px
Image


The 250px seems to be inherited from the textbox style
Image

Rseding91
Factorio Staff
Factorio Staff
Posts: 13175
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.17.2] word_wrap in LuaGuiElements wrapping aggressively and inconsistently

Post by Rseding91 »

This should be fixed for the next version of 0.17.
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Resolved Problems and Bugs”