summaryrefslogtreecommitdiff
path: root/README.rst
diff options
context:
space:
mode:
authorErik Rose <erik@mozilla.com>2012-02-01 14:03:20 -0800
committerErik Rose <erik@mozilla.com>2012-02-01 14:03:20 -0800
commit103f089a2081a83a1d0fc471c2aa484ce30da407 (patch)
treeb5f1d8443cf8fec85095acf4d65c75bec2838953 /README.rst
parent4ab628f086ad697243159d4700a5e661297d748d (diff)
downloadblessings-103f089a2081a83a1d0fc471c2aa484ce30da407.tar.gz
Document an idiom for restoring the cursor location after a series of manual moves. Closes #17.
Diffstat (limited to 'README.rst')
-rw-r--r--README.rst17
1 files changed, 13 insertions, 4 deletions
diff --git a/README.rst b/README.rst
index 07dd4f6..7eb6c30 100644
--- a/README.rst
+++ b/README.rst
@@ -70,8 +70,8 @@ of the screen::
normal=normal)
print rc # Restore cursor position.
-Phew! That was long and full of incomprehensible trash! Let's try it again,
-this time with Blessings::
+That was long and full of incomprehensible trash! Let's try it again, this time
+with Blessings::
from blessings import Terminal
@@ -238,7 +238,9 @@ Here are some of interest:
``move``
Position the cursor elsewhere. Parameters are y coordinate, then x
- coordinate.
+ coordinate::
+
+ print term.move(10, 1) + 'Hi, mom!'
``move_x``
Move the cursor to the given column.
``move_y``
@@ -283,7 +285,14 @@ just one of them, leaving the other alone. For example... ::
with term.location(y=10):
print 'We changed just the row.'
-If you want to reposition permanently, see ``move``, in an example above.
+If you want to reposition permanently, see ``move``, in an example above. If
+you're doing a series of ``move`` calls and want to return the cursor to its
+original position afterward, call ``location()`` with no arguments, and it will
+do only the position restoring::
+
+ with term.location():
+ print term.move(1, 1) + 'Hi'
+ print term.move(9, 9) + 'Mom'
Pipe Savvy
----------