From ff00c45f77ca79cdcf06266b2faefc4a172b10b3 Mon Sep 17 00:00:00 2001 From: erroneousboat Date: Fri, 14 Oct 2016 23:57:34 +0200 Subject: [PATCH] Start with fixing paste issue --- src/handlers/event.go | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/handlers/event.go b/src/handlers/event.go index bcbb2ab..0ecff51 100644 --- a/src/handlers/event.go +++ b/src/handlers/event.go @@ -1,6 +1,11 @@ package handlers import ( + "bufio" + "io" + "log" + "os" + "github.com/gizak/termui" "github.com/nlopes/slack" @@ -60,7 +65,7 @@ func anyKeyHandler(ctx *context.AppContext) func(termui.Event) { case "": actionMoveCursorLeft(ctx.View) default: - actionInput(ctx.View, key) + // actionInput(ctx.View, key) } } } @@ -170,6 +175,21 @@ func actionInsertMode(ctx *context.AppContext) { ctx.Mode = context.InsertMode ctx.View.Mode.Par.Text = "INSERT" termui.Render(ctx.View.Mode) + + r := bufio.NewReader(os.Stdin) + for { + if c, _, err := r.ReadRune(); err != nil { + if err == io.EOF { + break + } else { + log.Fatal(err) + } + } else { + log.Fatal(string(c)) + ctx.View.Input.Insert(string(c)) + } + } + } func actionCommandMode(ctx *context.AppContext) {