<commit_before>require "wow/Frame";
require "rainback/AnchoredBound";
require "rainback/wow-conversion";

local Widget = OOP.Class(WoW.Frame);
WoW.Widget = Widget;
WoW.RegisterFrameType("Widget", Widget);

Widget:AddDestructor(function(self)
    if self:GetWidget() then
        self:GetWidget():hide();
    end;
end);

function Widget:GetWidget()
    return self.widget;
end;

function Widget:SetWidget(widget)
    self.widget = widget;
end;

local Delegate = OOP.Class();

function Delegate:Constructor(frame)
    self.frame = frame;
end;

function Delegate:Draw(painter)
    local frame = self.frame;
    local bound = frame:GetDelegate("layout"):GetBounds();
    if type(bound) ~= "table" or not bound:HasBounds() then
        return;
    end;
    local widget = frame:GetWidget();
    if not widget then
        return;
    end;
    local x, y, width, height = bound:GetBounds();
    width = math.min(width, 10000);
    height = math.min(height, 10000);
    if x ~= nil then
        widget:show();
        widget:setGeometry(x, y, width, height);
    else
        widget:hide();
    end;
end;
<commit_msg>oops minimum width<commit_after>require "wow/Frame";
require "rainback/AnchoredBound";
require "rainback/wow-conversion";

local Widget = OOP.Class(WoW.Frame);
WoW.Widget = Widget;
WoW.RegisterFrameType("Widget", Widget);

Widget:AddDestructor(function(self)
    if self:GetWidget() then
        self:GetWidget():hide();
    end;
end);

function Widget:GetWidget()
    return self.widget;
end;

function Widget:SetWidget(widget)
    self.widget = widget;
end;

local Delegate = OOP.Class();

function Delegate:Constructor(frame)
    self.frame = frame;
end;

function Delegate:Draw(painter)
    local frame = self.frame;
    local bound = frame:GetDelegate("layout"):GetBounds();
    if type(bound) ~= "table" or not bound:HasBounds() then
        return;
    end;
    local widget = frame:GetWidget();
    if not widget then
        return;
    end;
    local x, y, width, height = bound:GetBounds();
    if x ~= nil then
        width = math.min(width, 10000);
        height = math.min(height, 10000);
        widget:show();
        widget:setGeometry(x, y, width, height);
    else
        widget:hide();
    end;
end;

{'fraction_non_alphanumeric': 0.13166144200626959, 'fraction_numerical': 0.008956560680698611, 'mean_word_length': 3.476953907815631, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '720463', 'n_tokens_mistral': 748, 'n_tokens_neox': 729, 'n_words': 180}