Skip to content

Commit 4ad063f

Browse files
committed
Improve Telex 2 handling
1 parent d00bcf3 commit 4ad063f

File tree

17 files changed

+123
-121
lines changed

17 files changed

+123
-121
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
engine_name=bamboo
1919
ibus_e_name=ibus-engine-$(engine_name)
2020
pkg_name=ibus-$(engine_name)
21-
version=0.6.2
21+
version=0.6.3
2222

2323
engine_dir=/usr/share/$(pkg_name)
2424
ibus_dir=/usr/share/ibus

archlinux/PKGBUILD-git

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#
1818
# Maintainer: Luong Thanh Lam <ltlam93@gmail.com>
1919
pkgname=ibus-bamboo-git
20-
pkgver=0.6.2
20+
pkgver=0.6.3
2121
pkgrel=1
2222
pkgdesc='A Vietnamese IME for IBus'
2323
arch=(any)

archlinux/PKGBUILD-release

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#
1818
# Maintainer: Luong Thanh Lam <ltlam93@gmail.com>
1919
pkgname=ibus-bamboo
20-
pkgver=0.6.2
20+
pkgver=0.6.3
2121
pkgrel=1
2222
pkgdesc='A Vietnamese IME for IBus'
2323
arch=(any)

bamboo.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<name>org.freedesktop.IBus.bamboo</name>
2323
<description>Vietnamese input engine for IBus</description>
2424
<exec>/usr/lib/ibus-engine-bamboo --ibus</exec>
25-
<version>0.6.2</version>
25+
<version>0.6.3</version>
2626
<author>Luong Thanh Lam &lt;ltlam93@gmail.com&gt;</author>
2727
<license>GPLv3</license>
2828
<homepage>https://github.com/BambooEngine/ibus-bamboo/</homepage>

debian/changelog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
ibus-bamboo (0.6.3-1) stable; urgency=medium
2+
3+
* New upstream release
4+
5+
-- Luong Thanh Lam <ltlam93@gmail.com> Tue, 10 Dec 2019 21:54:11 +0700
6+
17
ibus-bamboo (0.6.2-1) stable; urgency=medium
28

39
* New upstream release

debian/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Section: utils
2020
Priority: extra
2121
Maintainer: Luong Thanh Lam <ltlam93@gmail.com>
2222
Build-Depends: debhelper, golang, libx11-dev, libxtst-dev
23-
Standards-Version: 0.6.2
23+
Standards-Version: 0.6.3
2424
Homepage: https://github.com/BambooEngine/ibus-bamboo
2525

2626
Package: ibus-bamboo

ibus-bamboo.dsc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ Format: 1.0
44
Source: ibus-bamboo
55
Binary: ibus-bamboo
66
Architecture: any
7-
Version: 0.6.2-0
7+
Version: 0.6.3-0
88
Maintainer: Luong Thanh Lam <ltlam93@gmail.com>
99
Homepage: https://github.com/BambooEngine/ibus-bamboo
1010
Build-Depends: debhelper, golang, libx11-dev, libxt-dev, libxtst-dev
1111
Files:
12-
0 0 ibus-bamboo-0.6.2.tar.gz
12+
0 0 ibus-bamboo-0.6.3.tar.gz
1313

1414
-----BEGIN PGP SIGNATURE-----
1515

ibus-bamboo.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
%define ibus_comp_dir /usr/share/ibus/component
55

66
Name: ibus-bamboo
7-
Version: 0.6.2
7+
Version: 0.6.3
88
Release: 1%{?dist}
99
Summary: A Vietnamese input method for IBus
1010

src/github.com/BambooEngine/bamboo-core/bamboo.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ const (
2121
ToneLess
2222
MarkLess
2323
LowerCase
24-
WithEffectKeys
25-
InReverseOrder
2624
FullText
25+
InReverseOrder
2726
)
2827

2928
const (
@@ -91,18 +90,16 @@ func (e *BambooEngine) isEffectiveKey(key rune) bool {
9190
}
9291

9392
func (e *BambooEngine) IsValid(inputIsFullComplete bool) bool {
94-
var _, last = extractLastWord(e.composition, e.inputMethod.Keys)
93+
var _, last = extractLastWord(e.composition, e.GetInputMethod().Keys)
9594
return isValid(last, inputIsFullComplete)
9695
}
9796

9897
func (e *BambooEngine) GetProcessedString(mode Mode) string {
9998
var tmp []*Transformation
10099
if mode&FullText != 0 {
101100
tmp = e.composition
102-
} else if mode&WithEffectKeys != 0 {
103-
_, tmp = extractLastWord(e.composition, e.inputMethod.Keys)
104101
} else {
105-
_, tmp = extractLastWord(e.composition, nil)
102+
_, tmp = extractLastWord(e.composition, e.inputMethod.Keys)
106103
}
107104
return Flatten(tmp, mode)
108105
}
@@ -202,7 +199,7 @@ func (e *BambooEngine) ProcessKey(key rune, mode Mode) {
202199
}
203200

204201
func (e *BambooEngine) RestoreLastWord() {
205-
var previous, lastComb = extractLastWord(e.composition, e.inputMethod.Keys)
202+
var previous, lastComb = extractLastWord(e.composition, e.GetInputMethod().Keys)
206203
if len(lastComb) == 0 {
207204
return
208205
}
@@ -224,7 +221,7 @@ func (e *BambooEngine) RemoveLastChar(refreshLastToneTarget bool) {
224221
e.composition = e.composition[:len(e.composition)-1]
225222
return
226223
}
227-
var previous, lastComb = extractLastWord(e.composition, e.inputMethod.Keys)
224+
var previous, lastComb = extractLastWord(e.composition, e.GetInputMethod().Keys)
228225
var newComb []*Transformation
229226
for _, t := range lastComb {
230227
if t.Target == lastAppending || t == lastAppending {

src/github.com/BambooEngine/bamboo-core/bamboo_test.go

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -164,24 +164,24 @@ func TestTelex23(t *testing.T) {
164164
ng = newStdEngine()
165165
ng.ProcessString("t ]", EnglishMode)
166166
ng.ProcessString("a", VietnameseMode)
167-
if ng.GetProcessedString(VietnameseMode) != "a" || !ng.IsValid(false) {
168-
t.Errorf("Process ]aa, got %s valid=%v expected true", ng.GetProcessedString(VietnameseMode), ng.IsValid(true))
169-
}
167+
if ng.GetProcessedString(VietnameseMode) != "]a" {
168+
t.Errorf("Process t ]a, got %s valid=%v expected true", ng.GetProcessedString(VietnameseMode), ng.IsValid(false))
169+
}
170170
ng.Reset()
171171
ng.ProcessString("]]a", VietnameseMode)
172-
if ng.GetProcessedString(VietnameseMode) != "a" || !ng.IsValid(false) {
173-
t.Errorf("Process ]aa, got %s valid=%v expected true", ng.GetProcessedString(VietnameseMode), ng.IsValid(true))
174-
}
175-
var im = ParseInputMethod(InputMethodDefinitions, "Telex 3")
172+
if ng.GetProcessedString(VietnameseMode) != "]a" {
173+
t.Errorf("Process ]aa, got %s valid=%v expected true", ng.GetProcessedString(VietnameseMode), ng.IsValid(true))
174+
}
175+
var im = ParseInputMethod(InputMethodDefinitions, "Telex 2")
176176
var ng = NewEngine(im, EstdFlags)
177177
ng.ProcessString("[", VietnameseMode)
178-
if ng.GetProcessedString(VietnameseMode) != "ươ" {
179-
t.Errorf("Process Telex 3 [[], got [%v] expected [ươ]", ng.GetProcessedString(VietnameseMode))
178+
if ng.GetProcessedString(VietnameseMode) != "ơ" {
179+
t.Errorf("Process Telex 2 [[], got [%v] expected [ươ]", ng.GetProcessedString(VietnameseMode))
180180
}
181181
ng.Reset()
182182
ng.ProcessString("{", VietnameseMode)
183-
if ng.GetProcessedString(VietnameseMode) != "ƯƠ" {
184-
t.Errorf("Process Telex 3 [{], got [%s] expected [ƯƠ]", ng.GetProcessedString(EnglishMode))
183+
if ng.GetProcessedString(VietnameseMode) != "Ơ" {
184+
t.Errorf("Process Telex 2 [{], got [%s] expected [Ơ]", ng.GetProcessedString(VietnameseMode))
185185
}
186186
}
187187

@@ -238,7 +238,7 @@ func TestSpellingCheckForGiw(t *testing.T) {
238238
func TestDoubleBrackets(t *testing.T) {
239239
ng := newStdEngine()
240240
ng.ProcessString("[[", VietnameseMode)
241-
if ng.GetProcessedString(EnglishMode|WithEffectKeys) != "[" {
241+
if ng.GetProcessedString(EnglishMode) != "[" {
242242
t.Errorf("TestDoubleBrackets, got [%v] expected [%v]", ng.GetProcessedString(EnglishMode), "[")
243243
}
244244
}
@@ -398,8 +398,8 @@ func TestProcessTo5(t *testing.T) {
398398
var im = ParseInputMethod(InputMethodDefinitions, "VNI")
399399
ng := NewEngine(im, EstdFlags)
400400
ng.ProcessString("o55", VietnameseMode)
401-
if ng.GetProcessedString(VietnameseMode|WithEffectKeys) != "o5" {
402-
t.Errorf("Process [o55-VNI], got [%v] expected [o5]", ng.GetProcessedString(VietnameseMode|WithEffectKeys))
401+
if ng.GetProcessedString(VietnameseMode) != "o5" {
402+
t.Errorf("Process [o55-VNI], got [%v] expected [o5]", ng.GetProcessedString(VietnameseMode))
403403
}
404404
}
405405

@@ -445,18 +445,18 @@ func TestBambooEngine_RestoreLastWord_TCVN(t *testing.T) {
445445
var im = ParseInputMethod(InputMethodDefinitions, "Microsoft layout")
446446
ng := NewEngine(im, EstdFlags)
447447
ng.ProcessString("112", VietnameseMode)
448-
if ng.GetProcessedString(VietnameseMode|WithEffectKeys) != "1â" {
449-
t.Errorf("Process-VIE 112 (Microsoft layout), got [%v] expected [1â]", ng.GetProcessedString(VietnameseMode|WithEffectKeys))
448+
if ng.GetProcessedString(VietnameseMode) != "1â" {
449+
t.Errorf("Process-VIE 112 (Microsoft layout), got [%v] expected [1â]", ng.GetProcessedString(VietnameseMode))
450450
}
451451
ng.RestoreLastWord()
452-
if ng.GetProcessedString(EnglishMode|WithEffectKeys) != "12" {
453-
t.Errorf("Process-ENG 112 (Microsoft layout), got [%v] expected [12]", ng.GetProcessedString(EnglishMode|WithEffectKeys))
452+
if ng.GetProcessedString(EnglishMode) != "12" {
453+
t.Errorf("Process-ENG 112 (Microsoft layout), got [%v] expected [12]", ng.GetProcessedString(EnglishMode))
454454
}
455455
ng.Reset()
456456
ng.ProcessString("d[]ng9 t4i", VietnameseMode)
457457
ng.RestoreLastWord()
458-
if ng.GetProcessedString(VietnameseMode|WithEffectKeys) != "t4i" {
459-
t.Errorf("Process [duongwj t4i - MS layout], got [%v] expected [t4i]", ng.GetProcessedString(VietnameseMode|WithEffectKeys))
458+
if ng.GetProcessedString(VietnameseMode) != "t4i" {
459+
t.Errorf("Process [duongwj t4i - MS layout], got [%v] expected [t4i]", ng.GetProcessedString(VietnameseMode))
460460
}
461461
}
462462

@@ -589,13 +589,13 @@ func TestDoubleTyping(t *testing.T) {
589589
ng.Reset()
590590
ng.ProcessString("[[", VietnameseMode)
591591
ng.ProcessString("oo", VietnameseMode)
592-
if ng.GetProcessedString(VietnameseMode|WithEffectKeys) != "[ô" {
593-
t.Errorf("Process [oo, got %s expected [ô", ng.GetProcessedString(VietnameseMode|WithEffectKeys))
592+
if ng.GetProcessedString(VietnameseMode) != "[ô" {
593+
t.Errorf("Process [oo, got %s expected [ô", ng.GetProcessedString(VietnameseMode))
594594
}
595595
ng.Reset()
596596
ng.ProcessString("oo]", VietnameseMode)
597-
if ng.GetProcessedString(VietnameseMode|WithEffectKeys) != "ô]" {
598-
t.Errorf("Process oo], got %s expected ô]", ng.GetProcessedString(VietnameseMode|WithEffectKeys))
597+
if ng.GetProcessedString(VietnameseMode) != "ôư" {
598+
t.Errorf("Process oo], got %s expected ôư", ng.GetProcessedString(VietnameseMode))
599599
}
600600
ng.Reset()
601601
ng.ProcessString("chury", VietnameseMode)
@@ -639,9 +639,9 @@ func TestDoubleTyping(t *testing.T) {
639639
}
640640
ng.Reset()
641641
ng.ProcessString("tôi)t", EnglishMode)
642-
if ng.GetProcessedString(VietnameseMode) != "t" {
643-
t.Errorf("Process [tôi)t], got %s expected t", ng.GetProcessedString(VietnameseMode))
644-
}
642+
if ng.GetProcessedString(VietnameseMode) != "t" {
643+
t.Errorf("Process [tôi)t], got %s expected t", ng.GetProcessedString(VietnameseMode))
644+
}
645645
log.Print("===============end")
646646
ng.Reset()
647647
}

0 commit comments

Comments
 (0)