mirror of
https://github.com/eeeXun/GTT.git
synced 2025-05-17 00:00:16 -07:00
fix swap, if box do not have words, no need to cut last char
This commit is contained in:
parent
681f349fc4
commit
aa7e1e46f8
5
ui.go
5
ui.go
@ -125,7 +125,12 @@ func TranslatePageHandler(event *tcell.EventKey) *tcell.EventKey {
|
|||||||
updateTitle()
|
updateTitle()
|
||||||
src_text := src_box.GetText()
|
src_text := src_box.GetText()
|
||||||
dst_text := dst_box.GetText(false)
|
dst_text := dst_box.GetText(false)
|
||||||
|
if len(dst_text) > 0 {
|
||||||
|
// GetText of Box contains "\n" if it has words
|
||||||
src_box.SetText(dst_text[:len(dst_text)-1], true)
|
src_box.SetText(dst_text[:len(dst_text)-1], true)
|
||||||
|
} else {
|
||||||
|
src_box.SetText(dst_text, true)
|
||||||
|
}
|
||||||
dst_box.SetText(src_text)
|
dst_box.SetText(src_text)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user