1
0

documentation fixes

This commit is contained in:
Arpad Ryszka 2026-01-21 22:35:47 +01:00
parent 5a3e22b886
commit a14e7b19e2

10
lib.go
View File

@ -82,8 +82,8 @@ func Indent(first, rest string) Editor {
return indent([]rune(first), []rune(rest)) return indent([]rune(first), []rune(rest))
} }
// Wrap wrap wraps multiline text to define maximual text width. Duplicate, leading, trailing and non-space // Wrap wraps text to the defined maximum text width. Duplicate, leading, trailing and non-space whitespaces are
// whitespaces are collapsed into a single space. // collapsed into a single space.
func Wrap(firstWidth, restWidth int) Editor { func Wrap(firstWidth, restWidth int) Editor {
return wrapIndent(nil, nil, firstWidth, restWidth) return wrapIndent(nil, nil, firstWidth, restWidth)
} }
@ -151,7 +151,7 @@ func (w *Writer) flush() error {
} }
// Write calls the configured editors with the input and forwards their output to the underlying io.Writer. It // Write calls the configured editors with the input and forwards their output to the underlying io.Writer. It
// always returns len(p) as the number bytes written. It only returns an error when the underlying writer // always returns len(p) as the number of bytes written. It only returns an error when the underlying writer
// returns and error. // returns and error.
func (w *Writer) Write(p []byte) (int, error) { func (w *Writer) Write(p []byte) (int, error) {
return len(p), w.write([]rune(string(p))) return len(p), w.write([]rune(string(p)))
@ -159,13 +159,13 @@ func (w *Writer) Write(p []byte) (int, error) {
// WriteRune calls the configured editors with the input and forwards their output to the underlying io.Writer. // WriteRune calls the configured editors with the input and forwards their output to the underlying io.Writer.
// It always returns byte length of the input rune as the number bytes written. It only returns an error when // It always returns byte length of the input rune as the number bytes written. It only returns an error when
// the underlying writer returns and error. // the underlying writer returns an error.
func (w *Writer) WriteRune(r rune) (int, error) { func (w *Writer) WriteRune(r rune) (int, error) {
return len([]byte(string(r))), w.write([]rune{r}) return len([]byte(string(r))), w.write([]rune{r})
} }
// Flush makes the underlying editors to release their associated state, and writes out the resulting text to // Flush makes the underlying editors to release their associated state, and writes out the resulting text to
// the underlying io.Writer, but first passes it to the subsequent editors for editing. Is there were no errors, // the underlying io.Writer, but first passes it to the subsequent editors for editing. If there were no errors,
// and the used editor instances comply with the expectations of the Editor interface, the writer will have a // and the used editor instances comply with the expectations of the Editor interface, the writer will have a
// fresh state and can be reused for further editing. The Flush method of underlying writers is not called. // fresh state and can be reused for further editing. The Flush method of underlying writers is not called.
func (w *Writer) Flush() error { func (w *Writer) Flush() error {