src/main/java/dev/lambdaurora/spruceui/widget/text/SpruceTextFieldWidget.java
protected void drawCursor(MatrixStack matrices) {
        if (!this.isFocused())
            return;

        int cursorY = this.getY() + this.getHeight() / 2 - 4;

        if (this.text.isEmpty()) {
            drawTextWithShadow(matrices, this.client.textRenderer, new LiteralText("_"),
                    this.getX() + 4, cursorY, ColorUtil.TEXT_COLOR);
            return;
        }

        this.cursor.sanitize();

        var cursorLine = this.text.substring(this.firstCharacterIndex);
        int cursorX = this.getX() + 4 + this.client.textRenderer.getWidth(
                cursorLine.substring(0, this.cursor.column - this.firstCharacterIndex)
        );

        if (this.cursor.column - this.firstCharacterIndex < cursorLine.length())
            fill(matrices, cursorX - 1, cursorY - 1, cursorX, cursorY + 9, ColorUtil.TEXT_COLOR);
        else
            this.client.textRenderer.drawWithShadow(matrices, "_", cursorX, cursorY, ColorUtil.TEXT_COLOR);
    }
/**
     * Draws the cursor.
     *
     * @param matrices the matrices
     */
Draws the cursor.
@param matrices the matrices
Draws the cursor . @param matrices the matrices
protected void drawCursor(MatrixStack matrices) {
        if (!this.isFocused())
            return;
        int cursorY = this.getY() + this.getHeight() / 2 - 4;
        if (this.text.isEmpty()) {
            drawTextWithShadow(matrices, this.client.textRenderer, new LiteralText("_"),
                    this.getX() + 4, cursorY, ColorUtil.TEXT_COLOR);
            return;
        }
        this.cursor.sanitize();
        var cursorLine = this.text.substring(this.firstCharacterIndex);
        int cursorX = this.getX() + 4 + this.client.textRenderer.getWidth(
                cursorLine.substring(0, this.cursor.column - this.firstCharacterIndex)
        );
        if (this.cursor.column - this.firstCharacterIndex < cursorLine.length())
            fill(matrices, cursorX - 1, cursorY - 1, cursorX, cursorY + 9, ColorUtil.TEXT_COLOR);
        else
            this.client.textRenderer.drawWithShadow(matrices, "_", cursorX, cursorY, ColorUtil.TEXT_COLOR);
    }
protected void drawCursor ( MatrixStack matrices ) { if ( ! this . isFocused ( ) ) return ; int cursorY = this . getY ( ) + this . getHeight ( ) / 2 - 4 ; if ( this . text . isEmpty ( ) ) { drawTextWithShadow ( matrices , this . client . textRenderer , new LiteralText ( "_" ) , this . getX ( ) + 4 , cursorY , ColorUtil . TEXT_COLOR ) ; return ; } this . cursor . sanitize ( ) ; var cursorLine = this . text . substring ( this . firstCharacterIndex ) ; int cursorX = this . getX ( ) + 4 + this . client . textRenderer . getWidth ( cursorLine . substring ( 0 , this . cursor . column - this . firstCharacterIndex ) ) ; if ( this . cursor . column - this . firstCharacterIndex < cursorLine . length ( ) ) fill ( matrices , cursorX - 1 , cursorY - 1 , cursorX , cursorY + 9 , ColorUtil . TEXT_COLOR ) ; else this . client . textRenderer . drawWithShadow ( matrices , "_" , cursorX , cursorY , ColorUtil . TEXT_COLOR ) ; }
Draws the cursor.
Draws the cursor .