[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#701463: kate: Kate crashes when selected text is deleted



Tags: patch

Hello!

Am Sonntag, 24. Februar 2013 schrieben Sie:
> On Sun 24 Feb 2013 08:43:19 Markus Raab escribió:
> > Hello!
> >
> > 
> >
> > Am Sonntag, 24. Februar 2013 schrieben Sie:
> > > maybe you forgot a press of Escape here? Else you will continue to
> > > write letters.
> >
> > 
> >
> > Ok, now the complete sequence to type in to get it crashed (on a new
> > document or the end of an existing document):
> > ia<enter>b<enter>c<enter><esc>v<up><shift>+d
> 
> Now I could reproduce it! 
> 
> [snip]

Perfectly!

> > > Anyway, this is an upstream bug, and the only way to get it fixed is to
> > > file a  bug upstream.
> >
> > 
> >
> > It is already filed upstream: https://bugs.kde.org/show_bug.cgi?id=315683
> 
> Indeed, I even marked it as such. My bad :-/ Sorry for the noise :-)

No problem.

> > But maybe it is already fixed in a later kde version and the problem only
> > exists in wheezy.
> 
> [snip] 
> 
> > Can you fix it for wheezy if an patch is available?
> 
> I think we are still on time, but we need a patch for that.

Hopefully we are still on time, here is the patch (see also in attachment):
diff --git a/part/vimode/katevinormalmode.cpp 
b/part/vimode/katevinormalmode.cpp
index fb6b899..4893736 100644
--- a/part/vimode/katevinormalmode.cpp
+++ b/part/vimode/katevinormalmode.cpp
@@ -698,6 +698,9 @@ bool KateViNormalMode::commandDeleteToEOL()
   if ( c.line() < 0 ) {
     c.setLine( 0 );
   }
+  if ( c.line() > doc()->lastLine() ) {
+    c.setLine( doc()->lastLine() );
+  }
   if ( c.column() > doc()->lineLength( c.line() )-1 ) {
     c.setColumn( doc()->lineLength( c.line() )-1 );
   }

And see also:
https://projects.kde.org/projects/kde/applications/kate/repository/revisions/e88d0d35c6e3cb40692a811f335a99cd79f0beaa/diff/part/vimode/katevinormalmode.cpp
https://bugs.kde.org/show_bug.cgi?id=300296

Would be great to see that fix in wheezy!

I tested it already and got no more crashes in kate or kdevelop when this 
patch is applied!


best regards
Markus
Description: Fix crash when text is deleted to EOF
 

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: upstream, https://projects.kde.org/projects/kde/applications/kate/repository/revisions/e88d0d35c6e3cb40692a811f335a99cd79f0beaa/diff/part/vimode/katevinormalmode.cpp
Bug: https://bugs.kde.org/show_bug.cgi?id=300296
Bug-Debian: http://bugs.debian.org/701463

--- kate-4.8.4.orig/part/vimode/katevinormalmode.cpp
+++ kate-4.8.4/part/vimode/katevinormalmode.cpp
@@ -698,6 +698,9 @@ bool KateViNormalMode::commandDeleteToEO
   if ( c.line() < 0 ) {
     c.setLine( 0 );
   }
+  if ( c.line() > doc()->lastLine() ) {
+    c.setLine( doc()->lastLine() );
+  }
   if ( c.column() > doc()->lineLength( c.line() )-1 ) {
     c.setColumn( doc()->lineLength( c.line() )-1 );
   }

Reply to: