forked from kodie/ansiescapes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Solve issue kodie#2 jeffs@jeffs-desktop:/home/jeffs/python/ansiescapes/ansiescapes-master (development) * $ diff ansiescapes.py original_ansiescapes.py 8,17c8 < def _(s): < # A solution to issue 2, kodie#2 < # Because I don't know what the data type of s is going to be (it might < # be a type that has a decode function such as byte array ), simple test < # is s has a decode method. If it does, great, call it, otherwise, just < # return s. < if hasattr(s, "decode"): < return s.decode('unicode_escape') < else: < return s --- > def _(s): return s.decode('unicode_escape');
- Loading branch information
1 parent
25a4b90
commit 90bba93
Showing
2 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# The following 4 imports are to make the same code run on both python 2.6+ and | ||
# python 3.3+ | ||
import future | ||
import builtins | ||
import past | ||
import six | ||
import time | ||
|
||
import ansiescapes as ae | ||
for q in range(40): | ||
print(q*2*"{}") | ||
for q in range(5): | ||
print(q, end="", flush=True) | ||
time.sleep(1) | ||
print(ae.eraseLine, end="", flush=True) | ||
print(ae.ESC+"2J", end="", flush=True) | ||
print(ae.cursorTo(0,0) + "cursoTo(0,0) This should be in the upper left corner", end="", flush=True) | ||
print(ae.cursorMove(0,10) + "cursoTo(0,10) This should be 10 lines down at the left margin", end="", flush=True) | ||
print(ae.cursorDown(count = 1) + "Down one", end="", flush=True) | ||
print(ae.cursorDown(count = 2) + "Down two", end="", flush=True) | ||
print(ae.cursorForward(count = 4) + "Forward 4", flush=True) | ||
print(ae.cursorTo(3,20) + "cursoTo(3,20) somewhere on the third line", end="", flush=True) | ||
for w in range (50): | ||
print(ae.cursorBackward(count = 4)+"w", end="", flush=True) | ||
time.sleep(0.5) | ||
print(ae.cursorTo(0,0) + "cursoTo(0,0) This should be in the upper left corner", end="", flush=True) | ||
print(ae.eraseLines(count = 1), end="", flush=True) | ||
# print(image(buf, opts = {}): | ||
# def setCwd(cwd = os.getcwd()): |