alignRuneEnd moves byte index idx forward to the next UTF-8 rune start. idx <= 0 or idx >= len(s) is returned unchanged.
(s string, idx int)
| 47 | // alignRuneEnd moves byte index idx forward to the next UTF-8 rune start. |
| 48 | // idx <= 0 or idx >= len(s) is returned unchanged. |
| 49 | func alignRuneEnd(s string, idx int) int { |
| 50 | for idx > 0 && idx < len(s) && !utf8.RuneStart(s[idx]) { |
| 51 | idx++ |
| 52 | } |
| 53 | return idx |
| 54 | } |
| 55 | |
| 56 | // Patch represents one patch operation. |
| 57 | type Patch struct { |
no outgoing calls