From 4e3def39e096aaf53089e90efd56a45bc226ce3b Mon Sep 17 00:00:00 2001 From: Lignum Date: Thu, 4 May 2017 23:53:43 +0200 Subject: [PATCH] Render terminal cursor in a less awkward way The previous way seemed weird enough to seem to have had a purpose, but I can't tell. Revert this if it turns out that there was. --- .../client/gui/widgets/WidgetTerminal.java | 33 +++++++++---------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/src/main/java/dan200/computercraft/client/gui/widgets/WidgetTerminal.java b/src/main/java/dan200/computercraft/client/gui/widgets/WidgetTerminal.java index 9eb6ddbb4..0d7add8e9 100644 --- a/src/main/java/dan200/computercraft/client/gui/widgets/WidgetTerminal.java +++ b/src/main/java/dan200/computercraft/client/gui/widgets/WidgetTerminal.java @@ -407,23 +407,22 @@ public void draw( Minecraft mc, int xOrigin, int yOrigin, int mouseX, int mouseY TextBuffer colour = terminal.getTextColourLine( line ); TextBuffer backgroundColour = terminal.getBackgroundColourLine( line ); fontRenderer.drawString( text, x, y, colour, backgroundColour, m_leftMargin, m_rightMargin, greyscale ); - if( tblink && ty == line ) - { - if( tx >= 0 && tx < tw ) - { - TextBuffer cursor = new TextBuffer( '_', 1 ); - TextBuffer cursorColour = new TextBuffer( "0123456789abcdef".charAt( terminal.getTextColour() ), 1 ); - fontRenderer.drawString( - cursor, - x + FixedWidthFontRenderer.FONT_WIDTH * tx, - y, - cursorColour, null, - 0, 0, - greyscale - ); - } - } - y = y + FixedWidthFontRenderer.FONT_HEIGHT; + y += FixedWidthFontRenderer.FONT_HEIGHT; + } + + if( tblink ) + { + TextBuffer cursor = new TextBuffer( '_', 1 ); + TextBuffer cursorColour = new TextBuffer( "0123456789abcdef".charAt( terminal.getTextColour() ), 1 ); + + fontRenderer.drawString( + cursor, + x + FixedWidthFontRenderer.FONT_WIDTH * tx, + startY + m_topMargin + FixedWidthFontRenderer.FONT_HEIGHT * ty, + cursorColour, null, + 0, 0, + greyscale + ); } } }