Commit c82e1ee2 authored by Robert Knight's avatar Robert Knight
Browse files

Fix possible assert failure when in insert mode. Ensure that current line...

Fix possible assert failure when in insert mode.  Ensure that current line buffer has enough elements before trying to insert characters.  Use konsole_wcwidth value to calculate required buffer size.

svn path=/trunk/KDE/kdebase/apps/konsole/; revision=709585
parent 53833b68
......@@ -306,7 +306,7 @@ void Screen::deleteChars(int n)
void Screen::insertChars(int n)
{
if (n == 0) n = 1; // Default
screenLines[cuY].insert(cuX,n,' ');
if ( screenLines[cuY].count() > columns )
......@@ -789,28 +789,29 @@ void Screen::ShowCharacter(unsigned short c)
cuX = columns-w;
}
if (getMode(MODE_Insert)) insertChars(w);
// int i = loc(cuX,cuY);
lastPos = loc(cuX,cuY);
// checkSelection(i, i); // check if selection is still valid.
checkSelection(cuX,cuY);
// ensure current line vector has enough elements
int size = screenLines[cuY].size();
if (size == 0 && cuY > 0)
{
screenLines[cuY].resize( qMax(screenLines[cuY-1].size() , cuX+1) );
screenLines[cuY].resize( qMax(screenLines[cuY-1].size() , cuX+w) );
}
else
{
if (size < cuX+1)
if (size < cuX+w)
{
screenLines[cuY].resize(cuX+1);
screenLines[cuY].resize(cuX+w);
}
}
if (getMode(MODE_Insert)) insertChars(w);
lastPos = loc(cuX,cuY);
// // check if selection is still valid.
checkSelection(cuX,cuY);
Character& currentChar = screenLines[cuY][cuX];
currentChar.character = c;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment