From 86b894772bcd53270465243204aa3f67aa48df8f Mon Sep 17 00:00:00 2001 From: Robert Knight Date: Sun, 5 Aug 2007 22:22:09 +0000 Subject: [PATCH] Attempt #2 to fix assert failure when deleting chars. svn path=/trunk/KDE/kdebase/apps/konsole/; revision=696791 --- src/Screen.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Screen.cpp b/src/Screen.cpp index 1bedbeb0..313a00a0 100644 --- a/src/Screen.cpp +++ b/src/Screen.cpp @@ -279,7 +279,16 @@ void Screen::eraseChars(int n) void Screen::deleteChars(int n) { - if (n == 0) n = 1; // Default + Q_ASSERT( n >= 0 ); + + // always delete at least one char + if (n == 0) + n = 1; + + // if cursor is beyond the end of the line there is nothing to do + if ( cuX >= screenLines[cuY].count() ) + return; + if ( cuX+n >= screenLines[cuY].count() ) n = screenLines[cuY].count() - 1 - cuX; -- GitLab