mirror of
https://github.com/Maks1mS/bubbles.git
synced 2025-01-11 14:38:10 +03:00
Fix duplicate character bug when deleting chars in long strings
If the string is longer than the width of the field and the horizontal viewport (so to speak) was on the right edge, the last character would repeat when deleting characters because the viewport offset wasn't being corrected. This fixes that.
This commit is contained in:
parent
7cef3a6f59
commit
e9dd6b06e0
@ -135,6 +135,9 @@ func (m *Model) handleOverflow() {
|
||||
return
|
||||
}
|
||||
|
||||
// Correct right offset if we've deleted characters
|
||||
m.offsetRight = min(m.offsetRight, len(m.value))
|
||||
|
||||
if m.pos < m.offset {
|
||||
|
||||
m.offset = m.pos
|
||||
|
Loading…
Reference in New Issue
Block a user