From 54c044f1ffab6ef44a9c6b4d44fdcaed4e10865c Mon Sep 17 00:00:00 2001 From: eeeXun Date: Fri, 21 Oct 2022 23:27:10 +0800 Subject: [PATCH] camel case --- main.go | 2 +- ui.go | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index 5209d24..da644f4 100644 --- a/main.go +++ b/main.go @@ -28,7 +28,7 @@ func main() { // result, _ := translator.Translate("Hello world\nApple\nbumper") // fmt.Println(result) window.colorInit() - ui_init() + uiInit() translate_page.SetDirection(tview.FlexColumn). AddItem(src_box, 0, 1, true). AddItem(dst_box, 0, 1, false) diff --git a/ui.go b/ui.go index 4b1c87f..9801de9 100644 --- a/ui.go +++ b/ui.go @@ -4,7 +4,7 @@ import ( "github.com/gdamore/tcell/v2" ) -func update_background() { +func updateBackground() { // box src_box.SetBackgroundColor(window.src.background_color) src_box.SetTextStyle(tcell.StyleDefault. @@ -31,8 +31,8 @@ func update_background() { Foreground(window.src.prefix_color)) } -func ui_init() { - update_background() +func uiInit() { + updateBackground() // box src_box.SetBorder(true). @@ -91,7 +91,7 @@ func PagesHandler(event *tcell.EventKey) *tcell.EventKey { window.src.background_color = Transparent window.dst.background_color = Transparent } - update_background() + updateBackground() transparent = !transparent } @@ -118,7 +118,7 @@ func TranslatePageHandler(event *tcell.EventKey) *tcell.EventKey { case tcell.KeyCtrlP: translator.PlaySound(translator.dst_lang, dst_box.GetText(false)) case tcell.KeyCtrlS: - dst_box.SetText("SSS") + translator.src_lang, translator.dst_lang = translator.dst_lang, translator.src_lang } return event