go fmt ui/*

This commit is contained in:
Luke I. Wilson
2021-03-11 22:25:19 -06:00
parent a6674fb918
commit a4e2dae43e
3 changed files with 9 additions and 9 deletions

View File

@ -56,17 +56,17 @@ func (f *InputField) Delete(forward bool) {
if f.cursorPos < len(f.Text) { // If the cursor is not at the very end (past text)...
lineRunes := []rune(f.Text)
copy(lineRunes[f.cursorPos:], lineRunes[f.cursorPos+1:]) // Shift characters after cursor left
lineRunes = lineRunes[:len(lineRunes)-1] // Shrink line
f.Text = string(lineRunes) // Update line with new runes
lineRunes = lineRunes[:len(lineRunes)-1] // Shrink line
f.Text = string(lineRunes) // Update line with new runes
}
} else {
if f.cursorPos > 0 { // If the cursor is not at the beginning...
lineRunes := []rune(f.Text)
copy(lineRunes[f.cursorPos-1:], lineRunes[f.cursorPos:]) // Shift characters at cursor left
lineRunes = lineRunes[:len(lineRunes)-1] // Shrink line length
f.Text = string(lineRunes) // Update line with new runes
lineRunes = lineRunes[:len(lineRunes)-1] // Shrink line length
f.Text = string(lineRunes) // Update line with new runes
f.SetCursorPos(f.cursorPos-1) // Move cursor back
f.SetCursorPos(f.cursorPos - 1) // Move cursor back
}
}
}