package com.marvinelsen.willow.ui.formatters

import javafx.scene.control.TextFormatter
import javafx.util.converter.IntegerStringConverter
import java.util.function.UnaryOperator

private val digitRegex = """\d*""".toRegex()

class FontSizeTextFormatter : TextFormatter<Int>(
    IntegerStringConverter(),
    1,
    UnaryOperator { if (digitRegex.matches(it.text)) it else null }
)
