mirror of
				https://github.com/Maks1mS/bubbles.git
				synced 2025-11-04 07:31:23 +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:
		@@ -135,6 +135,9 @@ func (m *Model) handleOverflow() {
 | 
				
			|||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Correct right offset if we've deleted characters
 | 
				
			||||||
 | 
						m.offsetRight = min(m.offsetRight, len(m.value))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if m.pos < m.offset {
 | 
						if m.pos < m.offset {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		m.offset = m.pos
 | 
							m.offset = m.pos
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user