This commit is contained in:
Tulir Asokan 2018-04-19 11:10:34 +03:00
parent b17ff318c2
commit b1dc965a4a
14 changed files with 29 additions and 31 deletions

View File

@ -25,7 +25,6 @@ import (
"time" "time"
"runtime/debug" "runtime/debug"
) )
var writer io.Writer var writer io.Writer

View File

@ -67,7 +67,7 @@ type LoginView interface {
type MessageDirection int type MessageDirection int
const ( const (
AppendMessage MessageDirection = iota AppendMessage MessageDirection = iota
PrependMessage PrependMessage
IgnoreMessage IgnoreMessage
) )

View File

@ -102,13 +102,13 @@ func (ai *ANSImage) SetAt(y, x int, r, g, b, brightness uint8) error {
func (ai *ANSImage) GetAt(y, x int) (*ANSIpixel, error) { func (ai *ANSImage) GetAt(y, x int) (*ANSIpixel, error) {
if y >= 0 && y < ai.h && x >= 0 && x < ai.w { if y >= 0 && y < ai.h && x >= 0 && x < ai.w {
return &ANSIpixel{ return &ANSIpixel{
R: ai.pixmap[y][x].R, R: ai.pixmap[y][x].R,
G: ai.pixmap[y][x].G, G: ai.pixmap[y][x].G,
B: ai.pixmap[y][x].B, B: ai.pixmap[y][x].B,
Brightness: ai.pixmap[y][x].Brightness, Brightness: ai.pixmap[y][x].Brightness,
upper: ai.pixmap[y][x].upper, upper: ai.pixmap[y][x].upper,
source: ai.pixmap[y][x].source, source: ai.pixmap[y][x].source,
}, },
nil nil
} }
return nil, ErrOutOfBounds return nil, ErrOutOfBounds
@ -170,7 +170,7 @@ func New(h, w int, bg color.Color) (*ANSImage, error) {
r, g, b, _ := bg.RGBA() r, g, b, _ := bg.RGBA()
ansimage := &ANSImage{ ansimage := &ANSImage{
h: h, w: w, h: h, w: w,
maxprocs: 1, maxprocs: 1,
bgR: uint8(r), bgR: uint8(r),
bgG: uint8(g), bgG: uint8(g),

View File

@ -9,4 +9,3 @@
// //
// This package is licensed under the Mozilla Public License v2.0. // This package is licensed under the Mozilla Public License v2.0.
package ansimage package ansimage

View File

@ -42,9 +42,9 @@ func Send(title, text string, critical, sound bool) error {
if sound { if sound {
args = append(args, "-sound", "default") args = append(args, "-sound", "default")
} }
// if len(iconPath) > 0 { // if len(iconPath) > 0 {
// args = append(args, "-appIcon", iconPath) // args = append(args, "-appIcon", iconPath)
// } // }
return exec.Command("terminal-notifier", args...).Run() return exec.Command("terminal-notifier", args...).Run()
} }
title = strings.Replace(title, `"`, `\"`, -1) title = strings.Replace(title, `"`, `\"`, -1)

View File

@ -23,9 +23,9 @@ func Send(title, text string, critical, sound bool) error {
if critical { if critical {
args = append(args, "-u", "critical") args = append(args, "-u", "critical")
} }
// if iconPath { // if iconPath {
// args = append(args, "-i", iconPath) // args = append(args, "-i", iconPath)
// } // }
args = append(args, title, text) args = append(args, title, text)
if sound { if sound {
soundName := "message-new-instant" soundName := "message-new-instant"

View File

@ -25,7 +25,7 @@ func Send(title, text string, critical, sound bool) error {
Message: message, Message: message,
Audio: toast.Silent, Audio: toast.Silent,
Duration: toast.Short, Duration: toast.Short,
// Icon: ..., // Icon: ...,
} }
if sound { if sound {
notification.Audio = toast.IM notification.Audio = toast.IM

View File

@ -35,8 +35,8 @@ func TestPushActionArray_Should_EmptyArrayReturnsDefaults(t *testing.T) {
func TestPushActionArray_Should_MixedArrayReturnsExpected1(t *testing.T) { func TestPushActionArray_Should_MixedArrayReturnsExpected1(t *testing.T) {
should := pushrules.PushActionArray{ should := pushrules.PushActionArray{
{Action: pushrules.ActionNotify}, {Action: pushrules.ActionNotify},
{Action: pushrules.ActionSetTweak, Tweak: pushrules.TweakHighlight }, {Action: pushrules.ActionSetTweak, Tweak: pushrules.TweakHighlight},
{Action: pushrules.ActionSetTweak, Tweak: pushrules.TweakSound, Value: "ping" }, {Action: pushrules.ActionSetTweak, Tweak: pushrules.TweakSound, Value: "ping"},
}.Should() }.Should()
assert.True(t, should.NotifySpecified) assert.True(t, should.NotifySpecified)
assert.True(t, should.Notify) assert.True(t, should.Notify)
@ -49,7 +49,7 @@ func TestPushActionArray_Should_MixedArrayReturnsExpected2(t *testing.T) {
should := pushrules.PushActionArray{ should := pushrules.PushActionArray{
{Action: pushrules.ActionDontNotify}, {Action: pushrules.ActionDontNotify},
{Action: pushrules.ActionSetTweak, Tweak: pushrules.TweakHighlight, Value: false}, {Action: pushrules.ActionSetTweak, Tweak: pushrules.TweakHighlight, Value: false},
{Action: pushrules.ActionSetTweak, Tweak: pushrules.TweakSound, Value: "" }, {Action: pushrules.ActionSetTweak, Tweak: pushrules.TweakSound, Value: ""},
}.Should() }.Should()
assert.True(t, should.NotifySpecified) assert.True(t, should.NotifySpecified)
assert.False(t, should.Notify) assert.False(t, should.Notify)
@ -92,7 +92,7 @@ func TestPushActionArray_Should_DontNotify(t *testing.T) {
func TestPushActionArray_Should_HighlightBlank(t *testing.T) { func TestPushActionArray_Should_HighlightBlank(t *testing.T) {
should := pushrules.PushActionArray{ should := pushrules.PushActionArray{
{Action: pushrules.ActionSetTweak, Tweak: pushrules.TweakHighlight }, {Action: pushrules.ActionSetTweak, Tweak: pushrules.TweakHighlight},
}.Should() }.Should()
assert.False(t, should.NotifySpecified) assert.False(t, should.NotifySpecified)
assert.False(t, should.Notify) assert.False(t, should.Notify)
@ -103,7 +103,7 @@ func TestPushActionArray_Should_HighlightBlank(t *testing.T) {
func TestPushActionArray_Should_HighlightFalse(t *testing.T) { func TestPushActionArray_Should_HighlightFalse(t *testing.T) {
should := pushrules.PushActionArray{ should := pushrules.PushActionArray{
{Action: pushrules.ActionSetTweak, Tweak: pushrules.TweakHighlight, Value: false }, {Action: pushrules.ActionSetTweak, Tweak: pushrules.TweakHighlight, Value: false},
}.Should() }.Should()
assert.False(t, should.NotifySpecified) assert.False(t, should.NotifySpecified)
assert.False(t, should.Notify) assert.False(t, should.Notify)
@ -114,7 +114,7 @@ func TestPushActionArray_Should_HighlightFalse(t *testing.T) {
func TestPushActionArray_Should_SoundName(t *testing.T) { func TestPushActionArray_Should_SoundName(t *testing.T) {
should := pushrules.PushActionArray{ should := pushrules.PushActionArray{
{Action: pushrules.ActionSetTweak, Tweak: pushrules.TweakSound, Value: "ping" }, {Action: pushrules.ActionSetTweak, Tweak: pushrules.TweakSound, Value: "ping"},
}.Should() }.Should()
assert.False(t, should.NotifySpecified) assert.False(t, should.NotifySpecified)
assert.False(t, should.Notify) assert.False(t, should.Notify)
@ -125,7 +125,7 @@ func TestPushActionArray_Should_SoundName(t *testing.T) {
func TestPushActionArray_Should_SoundNameEmpty(t *testing.T) { func TestPushActionArray_Should_SoundNameEmpty(t *testing.T) {
should := pushrules.PushActionArray{ should := pushrules.PushActionArray{
{Action: pushrules.ActionSetTweak, Tweak: pushrules.TweakSound, Value: "" }, {Action: pushrules.ActionSetTweak, Tweak: pushrules.TweakSound, Value: ""},
}.Should() }.Should()
assert.False(t, should.NotifySpecified) assert.False(t, should.NotifySpecified)
assert.False(t, should.Notify) assert.False(t, should.Notify)

View File

@ -17,8 +17,8 @@
package tstring package tstring
import ( import (
"maunium.net/go/tcell"
"github.com/mattn/go-runewidth" "github.com/mattn/go-runewidth"
"maunium.net/go/tcell"
) )
type Cell struct { type Cell struct {

View File

@ -20,9 +20,9 @@ import (
"fmt" "fmt"
"strconv" "strconv"
"maunium.net/go/tcell"
"maunium.net/go/gomuks/matrix/rooms" "maunium.net/go/gomuks/matrix/rooms"
"maunium.net/go/gomuks/ui/widget" "maunium.net/go/gomuks/ui/widget"
"maunium.net/go/tcell"
"maunium.net/go/tview" "maunium.net/go/tview"
) )

View File

@ -17,8 +17,8 @@
package ui package ui
import ( import (
"maunium.net/go/tcell"
"maunium.net/go/gomuks/interface" "maunium.net/go/gomuks/interface"
"maunium.net/go/tcell"
"maunium.net/go/tview" "maunium.net/go/tview"
) )

View File

@ -18,8 +18,8 @@ package ui
import ( import (
"maunium.net/go/gomuks/config" "maunium.net/go/gomuks/config"
"maunium.net/go/gomuks/interface"
"maunium.net/go/gomuks/debug" "maunium.net/go/gomuks/debug"
"maunium.net/go/gomuks/interface"
"maunium.net/go/gomuks/ui/widget" "maunium.net/go/gomuks/ui/widget"
"maunium.net/go/tview" "maunium.net/go/tview"
) )

View File

@ -24,9 +24,9 @@ import (
"strings" "strings"
"unicode/utf8" "unicode/utf8"
"maunium.net/go/tcell"
"github.com/mattn/go-runewidth" "github.com/mattn/go-runewidth"
"github.com/zyedidia/clipboard" "github.com/zyedidia/clipboard"
"maunium.net/go/tcell"
"maunium.net/go/tview" "maunium.net/go/tview"
) )

View File

@ -17,8 +17,8 @@
package widget package widget
import ( import (
"maunium.net/go/tcell"
"github.com/mattn/go-runewidth" "github.com/mattn/go-runewidth"
"maunium.net/go/tcell"
"maunium.net/go/tview" "maunium.net/go/tview"
) )