Clarifications in comments.

pull/711/merge
Oliver 10 months ago
parent 6cc0565bab
commit ccc2c81197

@ -569,8 +569,8 @@ func (a *Application) Draw() *Application {
// ForceDraw refreshes the screen immediately. Use this function with caution as // ForceDraw refreshes the screen immediately. Use this function with caution as
// it may lead to race conditions with updates to primitives in other // it may lead to race conditions with updates to primitives in other
// goroutines. It is always preferrable to use Draw() instead. Never call this // goroutines. It is always preferrable to call [Application.Draw] instead.
// function from a goroutine. // Never call this function from a goroutine.
// //
// It is safe to call this function during queued updates and direct event // It is safe to call this function during queued updates and direct event
// handling. // handling.

@ -885,7 +885,7 @@ func (t *TextArea) SetFormAttributes(labelWidth int, labelColor, bgColor, fieldT
// replace deletes a range of text and inserts the given text at that position. // replace deletes a range of text and inserts the given text at that position.
// If the resulting text would exceed the maximum length, the function does not // If the resulting text would exceed the maximum length, the function does not
// do anything. The function returns the end position of the deleted/inserted // do anything. The function returns the end position of the deleted/inserted
// range. The provided row is the row of the deleted range start. // range.
// //
// The function can hang if "deleteStart" is located after "deleteEnd". // The function can hang if "deleteStart" is located after "deleteEnd".
// //
@ -893,7 +893,8 @@ func (t *TextArea) SetFormAttributes(labelWidth int, labelColor, bgColor, fieldT
// either appended to the end of a span or a span is shortened at the beginning // either appended to the end of a span or a span is shortened at the beginning
// or the end (and nothing else). // or the end (and nothing else).
// //
// This function does not modify [TextArea.lineStarts]. // This function only modifies [TextArea.lineStarts] to update span references
// but does not change it to reflect the new layout.
func (t *TextArea) replace(deleteStart, deleteEnd [3]int, insert string, continuation bool) [3]int { func (t *TextArea) replace(deleteStart, deleteEnd [3]int, insert string, continuation bool) [3]int {
// Maybe nothing needs to be done? // Maybe nothing needs to be done?
if deleteStart == deleteEnd && insert == "" || t.maxLength > 0 && len(insert) > 0 && t.length+len(insert) >= t.maxLength { if deleteStart == deleteEnd && insert == "" || t.maxLength > 0 && len(insert) > 0 && t.length+len(insert) >= t.maxLength {

Loading…
Cancel
Save