src/main/java/dev/lambdaurora/spruceui/widget/text/SpruceTextFieldWidget.java
public void write(String text) {
        if (text.isEmpty())
            return;

        if (this.getText().isEmpty()) {
            this.setText(text);
            this.setCursorToEnd();
            return;
        }
        this.selection.erase();

        var oldText = this.getText();
        int position = this.cursor.getPosition();

        String newText;
        if (position >= oldText.length()) {
            newText = oldText + text;
        } else {
            newText = oldText.substring(0, position) + text + oldText.substring(position);
        }

        if (this.textPredicate.test(newText)) {
            this.text = newText;
            this.onChanged();
            this.cursor.move(text.length());
        }
        this.sanitize();
    }
/**
     * Writes text where the cursor is.
     *
     * @param text the text to write
     */
Writes text where the cursor is.
@param text the text to write
Writes text where the cursor is . @param text the text to write
public void write(String text) {
        if (text.isEmpty())
            return;
        if (this.getText().isEmpty()) {
            this.setText(text);
            this.setCursorToEnd();
            return;
        }
        this.selection.erase();
        var oldText = this.getText();
        int position = this.cursor.getPosition();
        String newText;
        if (position >= oldText.length()) {
            newText = oldText + text;
        } else {
            newText = oldText.substring(0, position) + text + oldText.substring(position);
        }
        if (this.textPredicate.test(newText)) {
            this.text = newText;
            this.onChanged();
            this.cursor.move(text.length());
        }
        this.sanitize();
    }
public void write ( String text ) { if ( text . isEmpty ( ) ) return ; if ( this . getText ( ) . isEmpty ( ) ) { this . setText ( text ) ; this . setCursorToEnd ( ) ; return ; } this . selection . erase ( ) ; var oldText = this . getText ( ) ; int position = this . cursor . getPosition ( ) ; String newText ; if ( position >= oldText . length ( ) ) { newText = oldText + text ; } else { newText = oldText . substring ( 0 , position ) + text + oldText . substring ( position ) ; } if ( this . textPredicate . test ( newText ) ) { this . text = newText ; this . onChanged ( ) ; this . cursor . move ( text . length ( ) ) ; } this . sanitize ( ) ; }
Writes text where the cursor is.
Writes text where the cursor is .