refactor: use string for command line buffers (#2412)

This commit is contained in:
Joe Lim authored and GitHub committed 2026-03-04 22:24:06 +11:00
1 parent d082410b3d
commit 1afe4ff441
6 files changed
+148 -148

No files matched your search

+11 -11
View File
@@ -39,21 +39,21 @@ func replaceTilde(s string) string {
return s
}
// firstGraphemeCluster returns the runes forming the first grapheme cluster of
// the input.
func firstGraphemeCluster(rs []rune) []rune {
gr := uniseg.NewGraphemes(string(rs))
// firstGraphemeCluster returns the string containing the first grapheme cluster
// of the input.
func firstGraphemeCluster(s string) string {
gr := uniseg.NewGraphemes(s)
gr.Next()
return gr.Runes()
return gr.Str()
}
// lastGraphemeCluster returns the runes forming the last grapheme cluster of
// the input.
func lastGraphemeCluster(rs []rune) []rune {
gr := uniseg.NewGraphemes(string(rs))
var last []rune
// lastGraphemeCluster returns the string containing the last grapheme cluster
// of the input.
func lastGraphemeCluster(s string) string {
gr := uniseg.NewGraphemes(s)
var last string
for gr.Next() {
last = gr.Runes()
last = gr.Str()
}
return last
}