plugins/Unix: Keep track of two lines in Unix.spell since aspell sometimes list suggestions after a '*' or '+' line.

This commit is contained in:
James Vega 2005-07-22 13:08:40 +00:00
parent 1edb4e13bf
commit 0367ae5615

View File

@ -154,6 +154,10 @@ class Unix(callbacks.Plugin):
# aspell puts extra whitespace, ignore it
while not line.strip('\r\n'):
line = pipeReadline(r)
# cache an extra line in case aspell's first line says the word
# is spelled correctly, but subsequent lines offer spelling
# suggestions
line2 = pipeReadline(r)
except TimeoutError:
irc.error('The spell command timed out.')
return
@ -162,6 +166,10 @@ class Unix(callbacks.Plugin):
w.close()
inst.wait()
# parse the output
# aspell will sometimes list spelling suggestions after a '*' or '+'
# line for complex words.
if line[0] in '*+' and line2.strip('\r\n'):
line = line2
if line[0] in '*+':
resp = format('%q may be spelled correctly.', word)
elif line[0] == '#':