Add optional emoji support

Fixes #76
This commit is contained in:
erroneousboat 2018-08-11 13:19:58 +02:00
parent fd5d8bdf8a
commit 16a5a53692
3 changed files with 8 additions and 4 deletions

View File

@ -51,6 +51,9 @@ Setup
// value as: "mention", default is turned off: ""
"notify": "",
// OPTIONAL: turn on emoji's, default is false
"emoji": false,
// OPTIONAL: define custom key mappings, defaults are:
"key_map": {
"command": {

View File

@ -18,6 +18,7 @@ const (
type Config struct {
SlackToken string `json:"slack_token"`
Notify string `json:"notify"`
Emoji bool `json:"emoji"`
SidebarWidth int `json:"sidebar_width"`
MainWidth int `json:"-"`
KeyMap map[string]keyMapping `json:"key_map"`
@ -69,6 +70,7 @@ func getDefaultConfig() Config {
SidebarWidth: 1,
MainWidth: 11,
Notify: "",
Emoji: false,
KeyMap: map[string]keyMapping{
"command": {
"i": "mode-insert",

View File

@ -582,10 +582,9 @@ func (s *SlackService) CreateNotifyMessage(channelID string) string {
// - emoji's
// - mentions
func parseMessage(s *SlackService, msg string) string {
// NOTE: Commented out because rendering of the emoji's
// creates artifacts from the last view because of
// double width emoji's
// msg = parseEmoji(msg)
if s.Config.Emoji {
msg = parseEmoji(msg)
}
msg = parseMentions(s, msg)