CEdit::DeleteOne expands selection to delete integer number of UTF-8 symbols

fix-squashed-planets
Evgeny Pestov 2021-12-17 00:18:08 +07:00
parent cd059bd511
commit 65da4c42c4
1 changed files with 5 additions and 0 deletions

View File

@ -2787,6 +2787,11 @@ void CEdit::DeleteOne(int dir)
}
if ( m_cursor1 > m_cursor2 ) Math::Swap(m_cursor1, m_cursor2);
// Expands selection to delete integer number of UTF-8 symbols
while ( m_cursor1 > 0 && (m_text[m_cursor1] & 0xC0) == 0x80 ) m_cursor1 --;
while ( m_cursor2 < m_len && (m_text[m_cursor2] & 0xC0) == 0x80 ) m_cursor2 ++;
hole = m_cursor2-m_cursor1;
end = m_len-hole;
for ( i=m_cursor1 ; i<end ; i++ )