diff --git a/components/input.go b/components/input.go index 141e223..1a9a493 100644 --- a/components/input.go +++ b/components/input.go @@ -194,11 +194,12 @@ func (i *Input) Clear() { i.Par.Text = "" i.CursorPositionScreen = 0 i.CursorPositionText = 0 + i.Offset = 0 } // GetText returns the text currently in the input func (i *Input) GetText() string { - return i.Par.Text + return string(i.Text) } // GetMaxWidth returns the maximum number of positions diff --git a/handlers/event.go b/handlers/event.go index b100639..556c46b 100644 --- a/handlers/event.go +++ b/handlers/event.go @@ -163,6 +163,12 @@ func actionKeyEvent(ctx *context.AppContext, ev termbox.Event) { func actionResizeEvent(ctx *context.AppContext, ev termbox.Event) { termui.Body.Width = termui.TermWidth() + + // Vertical resize components + ctx.View.Channels.List.Height = termui.TermHeight() - ctx.View.Input.Par.Height + ctx.View.Chat.List.Height = termui.TermHeight() - ctx.View.Input.Par.Height + ctx.View.Debug.List.Height = termui.TermHeight() - ctx.View.Input.Par.Height + termui.Body.Align() termui.Render(termui.Body) } @@ -214,10 +220,16 @@ func actionSend(ctx *context.AppContext) { ctx.View.Input.Clear() ctx.View.Refresh() + // Send message ctx.Service.SendMessage( ctx.View.Channels.SelectedChannel, message, ) + + // Clear notification icon if there is any + ctx.Service.MarkAsRead(ctx.View.Channels.SelectedChannel) + ctx.View.Channels.SetChannels(ctx.Service.ChannelsToString()) + termui.Render(ctx.View.Channels) } } diff --git a/main.go b/main.go index 074d10d..8077e97 100644 --- a/main.go +++ b/main.go @@ -16,7 +16,7 @@ import ( ) const ( - VERSION = "v0.3.0" + VERSION = "v0.3.1" USAGE = `NAME: slack-term - slack client for your terminal