Index: src/orca/braille.py
===================================================================
--- src/orca/braille.py	(revision 4026)
+++ src/orca/braille.py	(working copy)
@@ -816,7 +816,7 @@
 
     _lines = []
     _regionWithFocus = None
-    viewport = [0, 0]
+    viewport = [viewport[0], 0]
 
 def setLines(lines):
     global _lines
@@ -855,7 +855,7 @@
 
     if not panToFocus or (not _regionWithFocus):
         return
-
+    
     # Adjust the viewport according to the new region with focus.
     # The goal is to have the first cell of the region be in the
     # home position, but we will give priority to make sure the
@@ -880,12 +880,14 @@
     [string, offset, attributeMask] = line.getLineInfo()
 
     # If the cursor is too far right, we scroll the viewport
-    # so the cursor will be on the last cell of the display.
-    #
-    if _regionWithFocus.cursorOffset >= _displaySize[0]:
-        offset += _regionWithFocus.cursorOffset - _displaySize[0] + 1
+    totalOffset = offset + _regionWithFocus.cursorOffset
+    if totalOffset > (viewport[0] + _displaySize[0]):
+        viewport[0] = totalOffset
+    elif totalOffset < viewport[0]:
+        viewport[0] = max(0, totalOffset)
 
-    viewport[0] = max(0, offset)
+    # the cursor is within the current display
+    # so we dont need to do anything else.
 
 def refresh(panToCursor=True, targetCursorCell=0):
     """Repaints the Braille on the physical display.  This clips the entire
