Merge branch 'v0.3.1'

* v0.3.1:
  Fix vertical resizing
  Fix GetText to return actual text not representation
  Update version number
  Clear notification when sending message on channel
  Reset offset when sending message
This commit is contained in:
erroneousboat 2018-01-27 12:57:29 +01:00
commit 0e7dac5ffe
3 changed files with 15 additions and 2 deletions

View File

@ -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

View File

@ -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)
}
}

View File

@ -16,7 +16,7 @@ import (
)
const (
VERSION = "v0.3.0"
VERSION = "v0.3.1"
USAGE = `NAME:
slack-term - slack client for your terminal