From e04c843239dd3fe688d8e46c736940dac6d02f64 Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Sat, 8 Aug 2009 05:51:24 +0000 Subject: Fix cursor positioning at EOL The cursor should appear to stay at the end of the line until the next character typed would cause it to wrap to the next line. git-svn-id: https://connectbot.googlecode.com/svn/trunk/connectbot@383 df292f66-193f-0410-a5fc-6d59da041ff2 --- src/org/connectbot/TerminalView.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/org') diff --git a/src/org/connectbot/TerminalView.java b/src/org/connectbot/TerminalView.java index 5eb7e24..217e16e 100644 --- a/src/org/connectbot/TerminalView.java +++ b/src/org/connectbot/TerminalView.java @@ -148,13 +148,19 @@ public class TerminalView extends View implements FontSizeChangedListener { canvas.drawBitmap(bridge.bitmap, 0, 0, paint); // also draw cursor if visible - if(bridge.buffer.isCursorVisible()) { + if (bridge.buffer.isCursorVisible()) { + int cursorColumn = bridge.buffer.getCursorColumn(); + int columns = bridge.buffer.getColumns(); + + if (cursorColumn == columns) + cursorColumn = columns - 1; + int currentAttribute = bridge.buffer.getAttributes( - bridge.buffer.getCursorColumn(), + cursorColumn, bridge.buffer.getCursorRow()); boolean onWideCharacter = (currentAttribute & VDUBuffer.FULLWIDTH) != 0; - int x = bridge.buffer.getCursorColumn() * bridge.charWidth; + int x = cursorColumn * bridge.charWidth; int y = (bridge.buffer.getCursorRow() + bridge.buffer.screenBase - bridge.buffer.windowBase) * bridge.charHeight; -- cgit v1.2.3