<commit_before>package imgui.imgui.widgets

import glm_.glm
import glm_.i
import glm_.vec2.Vec2
import imgui.*
import imgui.Col
import imgui.ImGui.buttonBehavior
import imgui.ImGui.currentWindow
import imgui.ImGui.io
import imgui.ImGui.itemAdd
import imgui.ImGui.itemSize
import imgui.ImGui.logRenderedText
import imgui.ImGui.logText
import imgui.ImGui.markItemEdited
import imgui.ImGui.mouseCursor
import imgui.ImGui.popClipRect
import imgui.ImGui.pushColumnClipRect
import imgui.ImGui.setItemAllowOverlap
import imgui.ImGui.style
import imgui.internal.*
import kotlin.math.max
import kotlin.reflect.KMutableProperty0
import glm_.pow as _
import imgui.ColorEditFlag as Cef
import imgui.DragDropFlag as Ddf
import imgui.HoveredFlag as Hf
import imgui.InputTextFlag as Itf
import imgui.ItemFlag as If
import imgui.TreeNodeFlag as Tnf
import imgui.WindowFlag as Wf
import imgui.internal.ButtonFlag as Bf
import imgui.internal.ColumnsFlag as Cf
import imgui.internal.DrawCornerFlag as Dcf
import imgui.internal.LayoutType as Lt
import imgui.internal.SeparatorFlag as Sf

interface lowLevelLayoutHelpers {

    /** add vertical spacing    */
    fun spacing() {
        if (currentWindow.skipItems) return
        itemSize(Vec2())
    }

    /** add a dummy item of given size  */
    fun dummy(size: Vec2) {

        val window = currentWindow
        if (window.skipItems) return

        val bb = Rect(window.dc.cursorPos, window.dc.cursorPos + size)
        itemSize(bb)
        itemAdd(bb, 0)
    }

    /** undo a sameLine()   */
    fun newLine() {
        val window = currentWindow
        if (window.skipItems) return

        val backupLayoutType = window.dc.layoutType
        window.dc.layoutType = Lt.Vertical
        // In the event that we are on a line with items that is smaller that FontSize high, we will preserve its height.
        itemSize(Vec2(0f, if (window.dc.currentLineSize.y > 0f) 0f else g.fontSize))
        window.dc.layoutType = backupLayoutType
    }

    /** Vertically align/lower upcoming text to framePadding.y so that it will aligns to upcoming widgets
     *  (call if you have text on a line before regular widgets)    */
    fun alignTextToFramePadding() {
        val window = currentWindow
        if (window.skipItems) return
        window.dc.currentLineSize.y = glm.max(window.dc.currentLineSize.y, g.fontSize + style.framePadding.y * 2)
        window.dc.currentLineTextBaseOffset = glm.max(window.dc.currentLineTextBaseOffset, style.framePadding.y)
    }

    /** Horizontal/vertical separating line
     *  Separator, generally horizontal. inside a menu bar or in horizontal layout mode, this becomes a vertical separator. */
    fun separator() {

        val window = currentWindow
        if (window.skipItems) return

        // Those flags should eventually be overridable by the user
        val flag: Sf = if(window.dc.layoutType == Lt.Horizontal) Sf.Vertical else Sf.Horizontal
        // useless on JVM with enums
        // assert((flags and (Sf.Horizontal or Sf.Vertical)).isPowerOfTwo)

        if (flag == Sf.Vertical) {
            verticalSeparator()
            return
        }
        // Horizontal Separator
        window.dc.columnsSet?.let { popClipRect() }

        var x1 = window.pos.x
        val x2 = window.pos.x + window.size.x
        if (window.dc.groupStack.isNotEmpty())
            x1 += window.dc.indent.i

        val bb = Rect(Vec2(x1, window.dc.cursorPos.y), Vec2(x2, window.dc.cursorPos.y + 1f))
        // NB: we don't provide our width so that it doesn't get feed back into AutoFit, we don't provide height to not alter layout.
        itemSize(Vec2())
        if (!itemAdd(bb, 0)) {
            window.dc.columnsSet?.let { pushColumnClipRect() }
            return
        }

        window.drawList.addLine(bb.min, Vec2(bb.max.x, bb.min.y), Col.Separator.u32)

        if (g.logEnabled)
            logRenderedText(null, "\n--------------------------------")

        window.dc.columnsSet?.let {
            pushColumnClipRect()<commit_msg>:construction: up to 30 Nov.   Separator: Fixed Separator() outputting an extraneous empty line when captured into clipboard/text/file.<commit_after>package imgui.imgui.widgets

import glm_.glm
import glm_.i
import glm_.vec2.Vec2
import imgui.*
import imgui.Col
import imgui.ImGui.buttonBehavior
import imgui.ImGui.currentWindow
import imgui.ImGui.io
import imgui.ImGui.itemAdd
import imgui.ImGui.itemSize
import imgui.ImGui.logRenderedText
import imgui.ImGui.logText
import imgui.ImGui.markItemEdited
import imgui.ImGui.mouseCursor
import imgui.ImGui.popClipRect
import imgui.ImGui.pushColumnClipRect
import imgui.ImGui.setItemAllowOverlap
import imgui.ImGui.style
import imgui.internal.*
import kotlin.math.max
import kotlin.reflect.KMutableProperty0
import glm_.pow as _
import imgui.ColorEditFlag as Cef
import imgui.DragDropFlag as Ddf
import imgui.HoveredFlag as Hf
import imgui.InputTextFlag as Itf
import imgui.ItemFlag as If
import imgui.TreeNodeFlag as Tnf
import imgui.WindowFlag as Wf
import imgui.internal.ButtonFlag as Bf
import imgui.internal.ColumnsFlag as Cf
import imgui.internal.DrawCornerFlag as Dcf
import imgui.internal.LayoutType as Lt
import imgui.internal.SeparatorFlag as Sf

interface lowLevelLayoutHelpers {

    /** add vertical spacing    */
    fun spacing() {
        if (currentWindow.skipItems) return
        itemSize(Vec2())
    }

    /** add a dummy item of given size  */
    fun dummy(size: Vec2) {

        val window = currentWindow
        if (window.skipItems) return

        val bb = Rect(window.dc.cursorPos, window.dc.cursorPos + size)
        itemSize(bb)
        itemAdd(bb, 0)
    }

    /** undo a sameLine()   */
    fun newLine() {
        val window = currentWindow
        if (window.skipItems) return

        val backupLayoutType = window.dc.layoutType
        window.dc.layoutType = Lt.Vertical
        // In the event that we are on a line with items that is smaller that FontSize high, we will preserve its height.
        itemSize(Vec2(0f, if (window.dc.currentLineSize.y > 0f) 0f else g.fontSize))
        window.dc.layoutType = backupLayoutType
    }

    /** Vertically align/lower upcoming text to framePadding.y so that it will aligns to upcoming widgets
     *  (call if you have text on a line before regular widgets)    */
    fun alignTextToFramePadding() {
        val window = currentWindow
        if (window.skipItems) return
        window.dc.currentLineSize.y = glm.max(window.dc.currentLineSize.y, g.fontSize + style.framePadding.y * 2)
        window.dc.currentLineTextBaseOffset = glm.max(window.dc.currentLineTextBaseOffset, style.framePadding.y)
    }

    /** Horizontal/vertical separating line
     *  Separator, generally horizontal. inside a menu bar or in horizontal layout mode, this becomes a vertical separator. */
    fun separator() {

        val window = currentWindow
        if (window.skipItems) return

        // Those flags should eventually be overridable by the user
        val flag: Sf = if(window.dc.layoutType == Lt.Horizontal) Sf.Vertical else Sf.Horizontal
        // useless on JVM with enums
        // assert((flags and (Sf.Horizontal or Sf.Vertical)).isPowerOfTwo)

        if (flag == Sf.Vertical) {
            verticalSeparator()
            return
        }
        // Horizontal Separator
        window.dc.columnsSet?.let { popClipRect() }

        var x1 = window.pos.x
        val x2 = window.pos.x + window.size.x
        if (window.dc.groupStack.isNotEmpty())
            x1 += window.dc.indent.i

        val bb = Rect(Vec2(x1, window.dc.cursorPos.y), Vec2(x2, window.dc.cursorPos.y + 1f))
        // NB: we don't provide our width so that it doesn't get feed back into AutoFit, we don't provide height to not alter layout.
        itemSize(Vec2())
        if (!itemAdd(bb, 0)) {
            window.dc.columnsSet?.let { pushColumnClipRect() }
            return
        }

        window.drawList.addLine(bb.min, Vec2(bb.max.x, bb.min.y), Col.Separator.u32)

        if (g.logEnabled)
            logRenderedText(bb.min, "--------------------------------")

        window.dc.columnsSet?.let {
            pushColumnClipRect()
{'fraction_non_alphanumeric': 0.09574468085106383, 'fraction_numerical': 0.006113964294448521, 'mean_word_length': 2.699231117141565, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '7319316', 'n_tokens_mistral': 2522, 'n_tokens_neox': 2437, 'n_words': 694}