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 # aspell puts extra whitespace, ignore it
while not line.strip('\r\n'): while not line.strip('\r\n'):
line = pipeReadline(r) 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: except TimeoutError:
irc.error('The spell command timed out.') irc.error('The spell command timed out.')
return return
@ -162,6 +166,10 @@ class Unix(callbacks.Plugin):
w.close() w.close()
inst.wait() inst.wait()
# parse the output # 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 '*+': if line[0] in '*+':
resp = format('%q may be spelled correctly.', word) resp = format('%q may be spelled correctly.', word)
elif line[0] == '#': elif line[0] == '#':