mirror of
https://github.com/Rudi9719/kbtui.git
synced 2026-03-22 08:47:24 +00:00
reverting main.go to upstream
This commit is contained in:
23
main.go
23
main.go
@ -1,9 +1,9 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -40,9 +40,11 @@ func main() {
|
|||||||
go RunCommand("config", "load")
|
go RunCommand("config", "load")
|
||||||
go populateList()
|
go populateList()
|
||||||
go updateChatWindow()
|
go updateChatWindow()
|
||||||
// use flag to parse command line arguments
|
if len(os.Args) > 1 {
|
||||||
flag.BoolVar(&UNICODE_EMOJI_SUPPORT, "ucode-emoji", false, "Enables unicode emoji printing to screen for supported systems")
|
os.Args[0] = "join"
|
||||||
flag.Parse()
|
RunCommand(os.Args...)
|
||||||
|
|
||||||
|
}
|
||||||
fmt.Println("initKeybindings")
|
fmt.Println("initKeybindings")
|
||||||
if err := initKeybindings(); err != nil {
|
if err := initKeybindings(); err != nil {
|
||||||
fmt.Printf("%+v", err)
|
fmt.Printf("%+v", err)
|
||||||
@ -270,12 +272,8 @@ func printToView(viewName string, message string) {
|
|||||||
updatingView, err := g.View(viewName)
|
updatingView, err := g.View(viewName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
} else {
|
|
||||||
if UNICODE_EMOJI_SUPPORT {
|
|
||||||
message = emojiUnicodeConvert(message)
|
|
||||||
}
|
}
|
||||||
fmt.Fprintf(updatingView, "%s\n", message)
|
fmt.Fprintf(updatingView, "%s\n", message)
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -545,10 +543,6 @@ func deleteEmpty(s []string) []string {
|
|||||||
func handleInput(viewName string) error {
|
func handleInput(viewName string) error {
|
||||||
clearView(viewName)
|
clearView(viewName)
|
||||||
inputString, _ := getInputString(viewName)
|
inputString, _ := getInputString(viewName)
|
||||||
if newViewTitle := getViewTitle(viewName); newViewTitle != "" {
|
|
||||||
// restore any tab completion view titles on input commit
|
|
||||||
setViewTitle(viewName, newViewTitle)
|
|
||||||
}
|
|
||||||
if inputString == "" {
|
if inputString == "" {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -572,9 +566,12 @@ func handleInput(viewName string) error {
|
|||||||
cmd[0] = inputString[:1]
|
cmd[0] = inputString[:1]
|
||||||
RunCommand(cmd...)
|
RunCommand(cmd...)
|
||||||
} else {
|
} else {
|
||||||
inputString = resolveRootEmojis(inputString)
|
|
||||||
go sendChat(inputString)
|
go sendChat(inputString)
|
||||||
}
|
}
|
||||||
|
// restore any tab completion view titles on input commit
|
||||||
|
if newViewTitle := getViewTitle(viewName); newViewTitle != "" {
|
||||||
|
setViewTitle(viewName, newViewTitle)
|
||||||
|
}
|
||||||
|
|
||||||
go populateList()
|
go populateList()
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user