src/main/java/dev/lambdaurora/spruceui/widget/text/SpruceTextFieldWidget.java
public boolean erase() {
            if (!this.active)
                return false;

            var start = this.getStart();
            var end = this.getEnd();

            if (start.isSame(end)) {
                this.cancel();
                return false;
            }

            if (start.column == 0 && end.column >= text.length()) {
                text = "";
                this.cancel();
                return true;
            }

            var text = getText();
            var newText = text.substring(0, start.getPosition()) + text.substring(end.getPosition());
            if (SpruceTextFieldWidget.this.textPredicate.test(newText)) {
                SpruceTextFieldWidget.this.text = newText;
                SpruceTextFieldWidget.this.onChanged();
            }

            cursor.copy(start);

            this.cancel();
            return true;
        }
/**
         * Erases the selected text.
         *
         * @return {@code true} if the text has been erased, else {@code false}
         */
Erases the selected text.
@return  true if the text has been erased, else  false
Erases the selected text . @return true if the text has been erased else false
public boolean erase() {
            if (!this.active)
                return false;
            var start = this.getStart();
            var end = this.getEnd();
            if (start.isSame(end)) {
                this.cancel();
                return false;
            }
            if (start.column == 0 && end.column >= text.length()) {
                text = "";
                this.cancel();
                return true;
            }
            var text = getText();
            var newText = text.substring(0, start.getPosition()) + text.substring(end.getPosition());
            if (SpruceTextFieldWidget.this.textPredicate.test(newText)) {
                SpruceTextFieldWidget.this.text = newText;
                SpruceTextFieldWidget.this.onChanged();
            }
            cursor.copy(start);
            this.cancel();
            return true;
        }
public boolean erase ( ) { if ( ! this . active ) return false ; var start = this . getStart ( ) ; var end = this . getEnd ( ) ; if ( start . isSame ( end ) ) { this . cancel ( ) ; return false ; } if ( start . column == 0 && end . column >= text . length ( ) ) { text = "" ; this . cancel ( ) ; return true ; } var text = getText ( ) ; var newText = text . substring ( 0 , start . getPosition ( ) ) + text . substring ( end . getPosition ( ) ) ; if ( SpruceTextFieldWidget . this . textPredicate . test ( newText ) ) { SpruceTextFieldWidget . this . text = newText ; SpruceTextFieldWidget . this . onChanged ( ) ; } cursor . copy ( start ) ; this . cancel ( ) ; return true ; }
Erases the selected text.
Erases the selected text .