chore!(cursor): improve naming around 'blinking'

This commit is contained in:
Christian Rocha
2025-05-26 09:15:38 -04:00
parent 0f113d10c4
commit e89dc94c85
4 changed files with 24 additions and 27 deletions
+6 -6
View File
@@ -8,7 +8,7 @@ import (
// TestBlinkCmdDataRace tests for a race on [Cursor.blinkTag].
//
// The original [Model.BlinkCmd] implementation returned a closure over the pointer receiver:
// The original [Model.Blink] implementation returned a closure over the pointer receiver:
//
// return func() tea.Msg {
// defer cancel()
@@ -20,12 +20,12 @@ import (
// }
//
// A race on “m.blinkTag” will occur if:
// 1. [Model.BlinkCmd] is called e.g. by calling [Model.Focus] from
// 1. [Model.Blink] is called e.g. by calling [Model.Focus] from
// ["github.com/charmbracelet/bubbletea".Model.Update];
// 2. ["github.com/charmbracelet/bubbletea".handleCommands] is kept sufficiently busy that it does not recieve and
// execute the [Model.BlinkCmd] e.g. by other long running command or commands;
// execute the [Model.Blink] e.g. by other long running command or commands;
// 3. at least [Mode.BlinkSpeed] time elapses;
// 4. [Model.BlinkCmd] is called again;
// 4. [Model.Blink] is called again;
// 5. ["github.com/charmbracelet/bubbletea".handleCommands] gets around to receiving and executing the original
// closure.
//
@@ -33,7 +33,7 @@ import (
// current value rather than the value at the time the closure was created).
func TestBlinkCmdDataRace(t *testing.T) {
m := New()
cmd := m.BlinkCmd()
cmd := m.Blink()
var wg sync.WaitGroup
wg.Add(2)
go func() {
@@ -44,7 +44,7 @@ func TestBlinkCmdDataRace(t *testing.T) {
go func() {
defer wg.Done()
time.Sleep(m.BlinkSpeed * 2)
m.BlinkCmd()
m.Blink()
}()
wg.Wait()
}