[KoCo-CVS] [Commit] KoreanCodecs/korean qwerty2bul.py
Brought to you by:
perky
From: Hye-Shik C. <pe...@us...> - 2003-02-22 08:31:19
|
perky 03/02/22 00:31:18 Modified: korean qwerty2bul.py Log: Fix a bug that duplicates after non-hangul character following non-completed character. Spotted by: Kwon Soon-Kook <ne...@ne...> Revision Changes Path 1.8 +11 -7 KoreanCodecs/korean/qwerty2bul.py Index: qwerty2bul.py =================================================================== RCS file: /cvsroot/koco/KoreanCodecs/korean/qwerty2bul.py,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- qwerty2bul.py 13 Jan 2003 09:09:56 -0000 1.7 +++ qwerty2bul.py 22 Feb 2003 08:31:18 -0000 1.8 @@ -17,7 +17,7 @@ # along with KoreanCodecs; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -# $Id: qwerty2bul.py,v 1.7 2003/01/13 09:09:56 perky Exp $ +# $Id: qwerty2bul.py,v 1.8 2003/02/22 08:31:18 perky Exp $ # import codecs @@ -60,7 +60,7 @@ self.clear() def pushcomp(self): - if self.chosung and not self.jungsung: + if not (self.chosung and self.jungsung): self.word_valid = 0 self.word_comp.append(join([ self.chosung, self.jungsung, self.jongsung @@ -92,12 +92,16 @@ self.pushcomp() if self.word_raw or self.word_comp: if self.word_valid: - self.buff.append(u''.join(self.word_comp)) + rjoi = u''.join(self.word_comp) else: self.word_valid = 1 - self.buff.append(u''.join(self.word_raw)) - + rjoi = u''.join(self.word_raw) + self.word_raw, self.word_comp = [], [] + if rjoi: + self.buff.append(rjoi) + return 1 + return 0 def feed(self, c): self.word_raw.append(c) @@ -154,8 +158,8 @@ self.chosung = njong self.jungsung = code else: # non key code - self.finalize() - self.buff.append(c) + if not self.finalize(): + self.buff.append(c) class Codec(codecs.Codec): |