Blame SOURCES/kate-4.10.5-properly-remove-composed-characters.patch

326678
diff --git a/part/document/katedocument.cpp b/part/document/katedocument.cpp
326678
index 3ba2ddd..1409aaf 100644
326678
--- a/part/document/katedocument.cpp
326678
+++ b/part/document/katedocument.cpp
326678
@@ -2684,7 +2684,9 @@ void KateDocument::backspace( KateView *view, const KTextEditor::Cursor& c )
326678
     {
326678
       // ordinary backspace
326678
       //c.cursor.col--;
326678
-      removeText(KTextEditor::Range(line, col-1, line, col));
326678
+      KTextEditor::Cursor beginCursor(line, view->currentTextLayout()->previousCursorPosition(c.column()));
326678
+      KTextEditor::Cursor endCursor(line, col);
326678
+      removeText(KTextEditor::Range(beginCursor, endCursor));
326678
     }
326678
     else
326678
     {
326678
@@ -2705,8 +2707,11 @@ void KateDocument::backspace( KateView *view, const KTextEditor::Cursor& c )
326678
         // only spaces on left side of cursor
326678
         indent( KTextEditor::Range( line, 0, line, 0), -1);
326678
       }
326678
-      else
326678
-        removeText(KTextEditor::Range(line, col-1, line, col));
326678
+      else {
326678
+        KTextEditor::Cursor beginCursor(line, view->currentTextLayout()->previousCursorPosition(c.column()));
326678
+        KTextEditor::Cursor endCursor(line, col);
326678
+        removeText(KTextEditor::Range(beginCursor, endCursor));
326678
+      }
326678
     }
326678
   }
326678
   else
326678
@@ -2740,7 +2745,8 @@ void KateDocument::del( KateView *view, const KTextEditor::Cursor& c )
326678
 
326678
   if( c.column() < (int) m_buffer->plainLine(c.line())->length())
326678
   {
326678
-    removeText(KTextEditor::Range(c, 1));
326678
+    KTextEditor::Cursor endCursor(c.line(), view->currentTextLayout()->nextCursorPosition(c.column()));
326678
+    removeText(KTextEditor::Range(c, endCursor));
326678
   }
326678
   else if ( c.line() < lastLine() )
326678
   {
326678
diff --git a/part/view/kateview.cpp b/part/view/kateview.cpp
326678
index 39f0956..b081657 100644
326678
--- a/part/view/kateview.cpp
326678
+++ b/part/view/kateview.cpp
326678
@@ -2341,6 +2341,12 @@ QString KateView::currentTextLine( )
326678
   return m_doc->line( cursorPosition().line() );
326678
 }
326678
 
326678
+QTextLayout * KateView::currentTextLayout() const
326678
+{
326678
+    KateLineLayoutPtr thisLine = m_viewInternal->cache()->line(cursorPosition().line());
326678
+    return thisLine->layout();
326678
+}
326678
+
326678
 QString KateView::searchPattern() const
326678
 {
326678
     if (hasSearchBar()) {
326678
diff --git a/part/view/kateview.h b/part/view/kateview.h
326678
index 69dbe1b..25126d0 100644
326678
--- a/part/view/kateview.h
326678
+++ b/part/view/kateview.h
326678
@@ -382,6 +382,7 @@ class KATEPART_TESTS_EXPORT KateView : public KTextEditor::View,
326678
     bool isOverwriteMode() const;
326678
     enum KTextEditor::View::EditMode viewEditMode() const {return isOverwriteMode() ? KTextEditor::View::EditOverwrite : KTextEditor::View::EditInsert;}
326678
     QString currentTextLine();
326678
+    QTextLayout * currentTextLayout() const;
326678
 
326678
     /**
326678
      * The current search pattern.