parent
02c086239e
commit
7e57b42c91
@ -2,6 +2,7 @@ package handlers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/gizak/termui"
|
"github.com/gizak/termui"
|
||||||
"github.com/nlopes/slack"
|
"github.com/nlopes/slack"
|
||||||
@ -11,6 +12,8 @@ import (
|
|||||||
"github.com/erroneousboat/slack-term/views"
|
"github.com/erroneousboat/slack-term/views"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var timer *time.Timer
|
||||||
|
|
||||||
// actionMap binds specific action names to the function counterparts,
|
// actionMap binds specific action names to the function counterparts,
|
||||||
// these action names can then be used to bind them to specific keys
|
// these action names can then be used to bind them to specific keys
|
||||||
// in the Config.
|
// in the Config.
|
||||||
@ -193,19 +196,36 @@ func actionGetMessages(ctx *context.AppContext) {
|
|||||||
termui.Render(ctx.View.Chat)
|
termui.Render(ctx.View.Chat)
|
||||||
}
|
}
|
||||||
|
|
||||||
func actionGetChannels(ctx *context.AppContext) {
|
func actionMoveCursorUpChannels(ctx *context.AppContext) {
|
||||||
ctx.View.Channels.GetChannels(ctx.Service)
|
go func() {
|
||||||
termui.Render(ctx.View.Channels)
|
if timer != nil {
|
||||||
|
timer.Stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
func actionMoveCursorUpChannels(ctx *context.AppContext) {
|
|
||||||
ctx.View.Channels.MoveCursorUp()
|
ctx.View.Channels.MoveCursorUp()
|
||||||
|
termui.Render(ctx.View.Channels)
|
||||||
|
|
||||||
|
timer = time.NewTimer(time.Second / 4)
|
||||||
|
<-timer.C
|
||||||
|
|
||||||
actionChangeChannel(ctx)
|
actionChangeChannel(ctx)
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
func actionMoveCursorDownChannels(ctx *context.AppContext) {
|
func actionMoveCursorDownChannels(ctx *context.AppContext) {
|
||||||
|
go func() {
|
||||||
|
if timer != nil {
|
||||||
|
timer.Stop()
|
||||||
|
}
|
||||||
|
|
||||||
ctx.View.Channels.MoveCursorDown()
|
ctx.View.Channels.MoveCursorDown()
|
||||||
|
termui.Render(ctx.View.Channels)
|
||||||
|
|
||||||
|
timer = time.NewTimer(time.Second / 4)
|
||||||
|
<-timer.C
|
||||||
|
|
||||||
actionChangeChannel(ctx)
|
actionChangeChannel(ctx)
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
func actionMoveCursorTopChannels(ctx *context.AppContext) {
|
func actionMoveCursorTopChannels(ctx *context.AppContext) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user