Changeset 786 in code for trunk/irc.go
- Timestamp:
- Feb 25, 2022, 10:32:09 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/irc.go
r784 r786 682 682 func isWordBoundary(r rune) bool { 683 683 switch r { 684 case '-', '_', '|': 684 case '-', '_', '|': // inspired from weechat.look.highlight_regex 685 685 return false 686 case '\u00A0':687 return true688 686 default: 689 687 return !unicode.IsLetter(r) && !unicode.IsNumber(r) … … 698 696 } 699 697 700 // Detect word boundaries 701 var left, right rune 702 if i > 0 { 703 left, _ = utf8.DecodeLastRuneInString(text[:i]) 704 } 705 if i < len(text) { 706 right, _ = utf8.DecodeRuneInString(text[i+len(nick):]) 707 } 698 left, _ := utf8.DecodeLastRuneInString(text[:i]) 699 right, _ := utf8.DecodeRuneInString(text[i+len(nick):]) 708 700 if isWordBoundary(left) && isWordBoundary(right) { 709 701 return true
Note:
See TracChangeset
for help on using the changeset viewer.