Skip to content

Commit

Permalink
fixing comments
Browse files Browse the repository at this point in the history
  • Loading branch information
or-else committed Apr 27, 2024
1 parent 8ae0f23 commit a97c494
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions server/drafty/grapheme.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"github.com/rivo/uniseg"
)

// graphemes is a container holding lengths of graphemes in a string.
// graphemes is a container holding lengths of grapheme clusters in a string.
type graphemes struct {
// The original string.
original string
Expand All @@ -13,7 +13,7 @@ type graphemes struct {
sizes []byte
}

// prepareGraphemes returns a parsed grapheme container by splitting the string into grapheme clusters
// prepareGraphemes returns a parsed grapheme cluster container by splitting the string into grapheme clusters
// and saving their lengths.
func prepareGraphemes(str string) *graphemes {
// Split the string into grapheme clusters and save the size of each cluster.
Expand All @@ -37,15 +37,15 @@ func (g *graphemes) length() int {
return len(g.sizes)
}

// string returns the original string from which the grapheme was created from.
// string returns the original string from which the grapheme cluster container was created.
func (g *graphemes) string() string {
if g == nil {
return ""
}
return g.original
}

// slice returns a new grapheme iterator containing graphemes from 'start' to 'end'.
// slice returns a new grapheme cluster container with grapheme clusters from 'start' to 'end'.
func (g *graphemes) slice(start, end int) *graphemes {

// Convert grapheme offsets to string offsets.
Expand All @@ -64,8 +64,8 @@ func (g *graphemes) slice(start, end int) *graphemes {
}
}

// append appends 'other' grapheme iterator to 'g' iterator and returns g.
// If g is nil, 'other' is returned.
// append appends 'other' grapheme cluster container to 'g' container and returns g.
// If g is nil, the 'other' is returned.
func (g *graphemes) append(other *graphemes) *graphemes {
if g == nil {
return other
Expand Down

0 comments on commit a97c494

Please sign in to comment.