src/main/java/dev/lambdaurora/spruceui/widget/text/SpruceTextAreaWidget.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.row == 0 && start.column == 0 && end.row == lines.size() - 1 && end.column >= lines.get(lines.size() - 1).length()) {
                lines.clear();
                lines.add("");
                this.cancel();
                return true;
            }

            if (start.row == end.row) {
                String line = lines.get(start.row);

                if (start.column == 0 && end.column >= line.length())
                    lines.remove(start.row);
                else
                    lines.replaceRow(start.row, line.substring(0, start.column) + line.substring(end.column));

                cursor.copy(start);
                this.cancel();
                return true;
            }

            String text = getText();
            var newText = text.substring(0, start.getPosition()) + text.substring(end.getPosition());

            lines.clear();
            lines.add(newText);

            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.row == 0 && start.column == 0 && end.row == lines.size() - 1 && end.column >= lines.get(lines.size() - 1).length()) {
                lines.clear();
                lines.add("");
                this.cancel();
                return true;
            }
            if (start.row == end.row) {
                String line = lines.get(start.row);
                if (start.column == 0 && end.column >= line.length())
                    lines.remove(start.row);
                else
                    lines.replaceRow(start.row, line.substring(0, start.column) + line.substring(end.column));
                cursor.copy(start);
                this.cancel();
                return true;
            }
            String text = getText();
            var newText = text.substring(0, start.getPosition()) + text.substring(end.getPosition());
            lines.clear();
            lines.add(newText);
            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 . row == 0 && start . column == 0 && end . row == lines . size ( ) - 1 && end . column >= lines . get ( lines . size ( ) - 1 ) . length ( ) ) { lines . clear ( ) ; lines . add ( "" ) ; this . cancel ( ) ; return true ; } if ( start . row == end . row ) { String line = lines . get ( start . row ) ; if ( start . column == 0 && end . column >= line . length ( ) ) lines . remove ( start . row ) ; else lines . replaceRow ( start . row , line . substring ( 0 , start . column ) + line . substring ( end . column ) ) ; cursor . copy ( start ) ; this . cancel ( ) ; return true ; } String text = getText ( ) ; var newText = text . substring ( 0 , start . getPosition ( ) ) + text . substring ( end . getPosition ( ) ) ; lines . clear ( ) ; lines . add ( newText ) ; cursor . copy ( start ) ; this . cancel ( ) ; return true ; }
Erases the selected text.
Erases the selected text .