瀏覽代碼

cmd: inline function

ayn2op 9 月之前
父節點
當前提交
9cff20fdc8
共有 1 個文件被更改,包括 3 次插入5 次删除
  1. 3 5
      cmd/message_input.go

+ 3 - 5
cmd/message_input.go

@@ -215,7 +215,9 @@ func expandMentions(cID discord.ChannelID, src []byte) []byte {
 }
 
 func (mi *messageInput) tabComplete(isAuto bool) {
-	posEnd, name, r := mi.GetWordUnderCursor(isValidUserRune)
+	posEnd, name, r := mi.GetWordUnderCursor(func(r rune) bool {
+		return unicode.IsLetter(r) || unicode.IsDigit(r) || r == '_' || r == '.'
+	})
 	if r != '@' {
 		mi.stopTabCompletion()
 		return
@@ -340,10 +342,6 @@ func (mi *messageInput) searchMember(gID discord.GuildID, name string) {
 	mi.cache.Create(key, app.messagesList.waitForChunkEvent())
 }
 
-func isValidUserRune(x rune) bool {
-	return unicode.IsLetter(x) || unicode.IsDigit(x) || x == '_' || x == '.'
-}
-
 func (mi *messageInput) showMentionList(col int) {
 	borders := 0
 	if mi.cfg.Theme.Border.Enabled {