-- Include this at the appropriate place in the editor. if curX < scrollX then scrollX = curX end if curY < scrollY then scrollY = curY end scrollX = math.max(scrollX, curX-displayCols+1) scrollY = math.max(scrollY, curY-displayRows+1)