[kde-doc-english] [kile] /: Add missing 'backspace()' method to KileScriptView

Michel Ludwig michel.ludwig at kdemail.net
Sun Mar 31 16:42:14 UTC 2013


Git commit 92c9a7c74eb1f22c48a20d8cd2cc61e560d134df by Michel Ludwig.
Committed on 31/03/2013 at 18:41.
Pushed by mludwig into branch 'master'.

Add missing 'backspace()' method to KileScriptView

M  +9    -0    doc/scripting.docbook
M  +8    -0    src/scripting/kilescriptview.cpp
M  +2    -0    src/scripting/kilescriptview.h

http://commits.kde.org/kile/92c9a7c74eb1f22c48a20d8cd2cc61e560d134df

diff --git a/doc/scripting.docbook b/doc/scripting.docbook
index b2314fd..c6e9213 100644
--- a/doc/scripting.docbook
+++ b/doc/scripting.docbook
@@ -429,6 +429,15 @@ Returns the range as a string of the form <literal>Range(Cursor(line,column) - C
 
 <variablelist><varlistentry>
 <term><synopsis>
+void view.backspace();
+</synopsis></term>
+<listitem><para>
+Programmatically Performs the equivalent of pressing the backspace key.
+</para></listitem>
+</varlistentry></variablelist>
+
+<variablelist><varlistentry>
+<term><synopsis>
 Cursor view.cursorPosition();
 </synopsis></term>
 <listitem><para>
diff --git a/src/scripting/kilescriptview.cpp b/src/scripting/kilescriptview.cpp
index 0abdd77..0463dd5 100644
--- a/src/scripting/kilescriptview.cpp
+++ b/src/scripting/kilescriptview.cpp
@@ -38,6 +38,14 @@ KTextEditor::View *KileScriptView::view() const
 
 ////////////////////////////////// cursor //////////////////////////////////////
 
+void KileScriptView::backspace()
+{
+	QAction *action = m_view->action("backspace");
+	if(action) {
+		action->trigger();
+	}
+}
+
 KTextEditor::Cursor KileScriptView::cursorPosition()
 {
 	return m_view->cursorPosition();
diff --git a/src/scripting/kilescriptview.h b/src/scripting/kilescriptview.h
index 9ddf8b8..b246c19 100644
--- a/src/scripting/kilescriptview.h
+++ b/src/scripting/kilescriptview.h
@@ -44,6 +44,8 @@ class KileScriptView : public QObject, protected QScriptable
 		Q_INVOKABLE void setCursorPosition(int line, int column);
 		Q_INVOKABLE void setCursorPosition(const KTextEditor::Cursor& cursor);
 
+		Q_INVOKABLE void backspace();
+
 		Q_INVOKABLE void cursorLeft();
 		Q_INVOKABLE void cursorRight();
 		Q_INVOKABLE void cursorUp();


More information about the kde-doc-english mailing list