aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG10
-rw-r--r--balloons/ascii.say30
-rw-r--r--balloons/ascii.think30
-rw-r--r--balloons/cowsay.say25
-rw-r--r--balloons/cowsay.think25
-rw-r--r--balloons/linux-vt.say35
-rw-r--r--balloons/round.say35
-rw-r--r--balloons/unicode.say35
-rw-r--r--balloons/unicode.think25
-rw-r--r--manuals/ponysay.texinfo14
-rwxr-xr-xponysay69
11 files changed, 323 insertions, 10 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 1c473c9..3a747ec 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,13 @@
+Version 2.2
+
+ Full support for arbitrary positioning of balloon in pony files.
+
+ ANSI colour sequences in pony files are applied only to the pony image,
+ not the balloon link or the balloon itself.
+
+ Support for colours in the message.
+
+
Version 2.1.1
Nothing worth mentioning.
diff --git a/balloons/ascii.say b/balloons/ascii.say
new file mode 100644
index 0000000..1a9d014
--- /dev/null
+++ b/balloons/ascii.say
@@ -0,0 +1,30 @@
+/:/
+\:\
+
+n:_
+:
+s:_
+w:|
+e: |
+
+ww:|
+ee: |
+
+nw:
+:/
+ne:
+:\
+sw:\
+se:/
+
+nnw:_
+:
+nne:_
+:
+ssw:_
+sse:_
+
+nww:|
+nee: |
+sww:|
+see: |
diff --git a/balloons/ascii.think b/balloons/ascii.think
new file mode 100644
index 0000000..56591d2
--- /dev/null
+++ b/balloons/ascii.think
@@ -0,0 +1,30 @@
+/:o
+\:o
+
+n:_
+:
+s:_
+w:(
+e: )
+
+ww:(
+ee: )
+
+nw:
+:(
+ne:
+:)
+sw:(
+se:)
+
+nnw:_
+:
+nne:_
+:
+ssw:_
+sse:_
+
+nww:(
+nee: )
+sww:(
+see: )
diff --git a/balloons/cowsay.say b/balloons/cowsay.say
new file mode 100644
index 0000000..827183e
--- /dev/null
+++ b/balloons/cowsay.say
@@ -0,0 +1,25 @@
+/:/
+\:\
+
+n:_
+s:-
+w:|
+e: |
+
+ww:<
+ee:>
+
+nw: _
+ne:_
+sw: -
+se:-
+
+nnw:_
+nne:_
+ssw:-
+sse:-
+
+nww:/
+nee:\
+sww:\
+see:/
diff --git a/balloons/cowsay.think b/balloons/cowsay.think
new file mode 100644
index 0000000..1450bc7
--- /dev/null
+++ b/balloons/cowsay.think
@@ -0,0 +1,25 @@
+/:o
+\:o
+
+n:_
+s:-
+w:(
+e: )
+
+ww:(
+ee: )
+
+nw: _
+ne:_
+sw: -
+se:-
+
+nnw:_
+nne:_
+ssw:-
+sse:-
+
+nww:(
+nee: )
+sww:(
+see: )
diff --git a/balloons/linux-vt.say b/balloons/linux-vt.say
new file mode 100644
index 0000000..69a14ae
--- /dev/null
+++ b/balloons/linux-vt.say
@@ -0,0 +1,35 @@
+/:/
+\:\
+
+n:─
+:
+s:
+:─
+w:│
+e: │
+
+ww:│
+ee: │
+
+nw:┌
+:│
+ne:┐
+:│
+sw:│
+:└
+se:│
+:┘
+
+nnw:─
+:
+nne:─
+:
+ssw:
+:─
+sse:
+:─
+
+nww:│
+nee: │
+sww:│
+see: │
diff --git a/balloons/round.say b/balloons/round.say
new file mode 100644
index 0000000..01ef456
--- /dev/null
+++ b/balloons/round.say
@@ -0,0 +1,35 @@
+/:╱
+\:╲
+
+n:─
+:
+s:
+:─
+w:│
+e: │
+
+ww:│
+ee: │
+
+nw:╭
+:│
+ne:╮
+:│
+sw:│
+:╰
+se:│
+:╯
+
+nnw:─
+:
+nne:─
+:
+ssw:
+:─
+sse:
+:─
+
+nww:│
+nee: │
+sww:│
+see: │
diff --git a/balloons/unicode.say b/balloons/unicode.say
new file mode 100644
index 0000000..a67a7f8
--- /dev/null
+++ b/balloons/unicode.say
@@ -0,0 +1,35 @@
+/:╱
+\:╲
+
+n:─
+:
+s:
+:─
+w:│
+e: │
+
+ww:│
+ee: │
+
+nw:┌
+:│
+ne:┐
+:│
+sw:│
+:└
+se:│
+:┘
+
+nnw:─
+:
+nne:─
+:
+ssw:
+:─
+sse:
+:─
+
+nww:│
+nee: │
+sww:│
+see: │
diff --git a/balloons/unicode.think b/balloons/unicode.think
new file mode 100644
index 0000000..fba4c51
--- /dev/null
+++ b/balloons/unicode.think
@@ -0,0 +1,25 @@
+/:o
+\:o
+
+n:⁀
+s:‿
+w:(
+e: )
+
+ww:(
+ee: )
+
+nw:)
+ne:(
+sw:)
+se:(
+
+nnw:⁀
+nne:⁀
+ssw:‿
+sse:‿
+
+nww:(
+nee: )
+sww:(
+see: )
diff --git a/manuals/ponysay.texinfo b/manuals/ponysay.texinfo
index bc2989b..17ba615 100644
--- a/manuals/ponysay.texinfo
+++ b/manuals/ponysay.texinfo
@@ -8,7 +8,7 @@
@documentlanguage en
@finalout
@c %**end of header
-@set VERSION 2.1.1
+@set VERSION 2.2
@copying
This manual is for ponysay
@@ -1033,6 +1033,18 @@ first pony file in common.
@cindex versions
@cindex previous releases
+@heading Version 2.2
+
+@itemize @bullet
+@item
+Full support for arbitrary positioning of balloon in pony files.
+@item
+ANSI colour sequences in pony files are applied only to the pony image,
+not the balloon link or the balloon itself.
+@item
+Support for colours in the message.
+@end itemize
+
@heading Version 2.1.1
Nothing worth mention.
diff --git a/ponysay b/ponysay
index 3a4efa3..1f99579 100755
--- a/ponysay
+++ b/ponysay
@@ -958,6 +958,8 @@ class Backend():
wrap = None
if self.wrapcolumn is not None:
wrap = self.wrapcolumn - left
+ if wrap < 8:
+ wrap = 8
msg = self.message
if wrap is not None:
@@ -1092,27 +1094,76 @@ class ColourStack():
self.bufproto = ' ' * (self.lenpush if self.lenpush > self.lenpop else self.lenpop)
self.stack = []
self.push()
+ self.seq = None
def push(self):
- self.stack = [[self.bufproto]] + self.stack
+ self.stack = [[self.bufproto, None, None, [False] * 9]] + self.stack
if len(self.stack) == 1:
- return ''
- return ''
+ return None
+ old = self.stack[1]
+ rc = '\033['
+ if old[1] is not None: rc += '39;'
+ if old[2] is not None: rc += '49;'
+ for i in range(0, 9):
+ if old[3][i]:
+ rc += '2%i;' % (i + 1)
+ return '' if len(rc) == 2 else (rc[:-1] + 'm')
def pop(self):
- return ''
+ old = self.stack[0]
+ self.stack = self.stack[1:]
+ rc = '\033['
+ if old[1] is not None: rc += '39;'
+ if old[2] is not None: rc += '49;'
+ for i in range(0, 9):
+ if old[3][i]:
+ rc += str(i + 21) + ';'
+ new = self.stack[0]
+ if new[1] is not None: rc += new[1] + ';'
+ if new[2] is not None: rc += new[2] + ';'
+ for i in range(0, 9):
+ if new[3][i]:
+ rc += str(i + 1) + ';'
+ return '' if len(rc) == 2 else (rc[:-1] + 'm')
def feed(self, char):
+ if self.seq is not None:
+ self.seq += char
+ if (char == '~') or (('a' <= char) and (char <= 'z')) or (('A' <= char) and (char <= 'Z')):
+ if (self.seq[0] == '[') and (self.seq[-1] == 'm'):
+ self.seq = self.seq[1:-1].split(';')
+ (i, n) = (0, len(self.seq))
+ while i < n:
+ part = self.seq[i]
+ p = 0 if part == '' else int(part)
+ i += 1
+ if p == '': self.stack[0][1:] = [None, None, [False] * 9]
+ elif (1 <= p) and (p <= 9): self.stack[0][3][p - 1] = True
+ elif (21 <= p) and (p <= 29): self.stack[0][3][p - 21] = False
+ elif p == 39: self.stack[0][1] = None
+ elif p == 40: self.stack[0][2] = None
+ elif (30 <= p) and (p <= 37): self.stack[0][1] = part
+ elif (90 <= p) and (p <= 97): self.stack[0][1] = part
+ elif (40 <= p) and (p <= 47): self.stack[0][2] = part
+ elif (100 <= p) and (p <= 107): self.stack[0][2] = part
+ elif p == 38:
+ self.stack[0][1] = '%s;%s;%s' % (part, self.seq[i], self.seq[i + 1])
+ i += 2
+ elif p == 48:
+ self.stack[0][2] = '%s;%s;%s' % (part, self.seq[i], self.seq[i + 1])
+ i += 2
+ self.seq = None
+ elif char == '\033':
+ self.seq = ''
buf = self.stack[0][0]
+ buf = buf[1:] + char
rc = ''
- if buf[:-self.lenpush] == self.autopush:
- rc = self.push()
- elif buf[:-self.lenpop] == self.autopop:
- rc = self.pop()
- self.stack[0][0] = buf[1:] + char
+ if buf[-self.lenpush:] == self.autopush: rc = self.push()
+ elif buf[-self.lenpop:] == self.autopop: rc = self.pop()
+ self.stack[0][0] = buf
return rc