[education/rkward] rkward: Remove unused code
Thomas Friedrichsmeier
null at kde.org
Mon May 26 15:06:38 BST 2025
Git commit 6ce01269161327e9879b4a4f42b4d5c757dcff19 by Thomas Friedrichsmeier.
Committed on 26/05/2025 at 14:06.
Pushed by tfry into branch 'master'.
Remove unused code
M +0 -14 rkward/rkconsole.cpp
M +0 -1 rkward/rkconsole.h
M +0 -14 rkward/windows/rkcommandeditorwindow.cpp
M +2 -10 rkward/windows/rkcommandeditorwindow.h
https://invent.kde.org/education/rkward/-/commit/6ce01269161327e9879b4a4f42b4d5c757dcff19
diff --git a/rkward/rkconsole.cpp b/rkward/rkconsole.cpp
index 7ec4ac549..979e3569e 100644
--- a/rkward/rkconsole.cpp
+++ b/rkward/rkconsole.cpp
@@ -331,20 +331,6 @@ bool RKConsole::handleKeyPress(QKeyEvent *e) {
return false;
}
-QString RKConsole::provideContext(int line_rev) {
- RK_TRACE(COMMANDEDITOR);
-
- QString ret;
- if (line_rev == 0) ret = currentEditingLine().left(currentCursorPositionInCommand());
- else if (!incomplete_command.isEmpty()) {
- QStringList lines = incomplete_command.split(u'\n');
- if (lines.size() > line_rev) {
- ret = lines[lines.size() - line_rev - 1];
- }
- }
- return ret;
-}
-
bool RKConsole::eventFilter(QObject *o, QEvent *e) {
if (o == getPart()) {
return RKMDIWindow::eventFilter(o, e);
diff --git a/rkward/rkconsole.h b/rkward/rkconsole.h
index 2718f6fcd..96ff39901 100644
--- a/rkward/rkconsole.h
+++ b/rkward/rkconsole.h
@@ -47,7 +47,6 @@ class RKConsole : public RKMDIWindow, public RKScriptContextProvider {
QString currentEditingLine() const;
/** Returns the current cursor position, within the current command (without taking into account the prefix). Returns -1 if the cursor is not on the line containing the command. */
int currentCursorPositionInCommand();
- QString provideContext(int line_rev) override;
void currentHelpContext(QString *symbol, QString *package) override;
static RKConsole *mainConsole() { return main_console; };
diff --git a/rkward/windows/rkcommandeditorwindow.cpp b/rkward/windows/rkcommandeditorwindow.cpp
index bdf578e89..df2004fb1 100644
--- a/rkward/windows/rkcommandeditorwindow.cpp
+++ b/rkward/windows/rkcommandeditorwindow.cpp
@@ -953,20 +953,6 @@ void RKCommandEditorWindow::currentHelpContext(QString *symbol, QString *package
}
}
-QString RKCommandEditorWindow::provideContext(int line_rev) {
- RK_TRACE(COMMANDEDITOR);
-
- KTextEditor::Cursor c = m_view->cursorPosition();
- int current_line_num = c.line();
- int cursor_pos = c.column();
-
- if (line_rev > current_line_num) return QString();
-
- QString ret = m_doc->line(current_line_num - line_rev);
- if (line_rev == 0) ret = ret.left(cursor_pos);
- return ret;
-}
-
void RKCommandEditorWindow::paste(const QString &text) {
RK_TRACE(COMMANDEDITOR);
diff --git a/rkward/windows/rkcommandeditorwindow.h b/rkward/windows/rkcommandeditorwindow.h
index 7e3dbb3bc..44b256a13 100644
--- a/rkward/windows/rkcommandeditorwindow.h
+++ b/rkward/windows/rkcommandeditorwindow.h
@@ -43,20 +43,13 @@ class RKCommandEditorWindowPart : public KParts::Part {
~RKCommandEditorWindowPart();
};
-/** classes wishing to use context help should derive from this, and implement provideContext () */
+/** classes wishing to use context help should derive from this, and implement currentHelpContext() */
class RKScriptContextProvider {
public:
RKScriptContextProvider(){};
virtual ~RKScriptContextProvider(){};
- /** to be implemented in subclasses. Provide some context, i.e. text *preceding* the cursor position (probably a line, but you may provide chunks in arbitrary size). If line_rev is 0, provide the line, the cursor is in. If line_rev is greater than 0, provide context before that.
- @param context Place the context here
- @returns a chunk of context. A null QString(), if no context was available. */
- virtual QString provideContext(int line_rev) {
- Q_UNUSED(line_rev);
- return QString();
- };
- /** to be implemented in subclasses. Provide current context for help searches (based on current selection / current cursor position). If not package information is known, leave that empty. */
+ /** to be implemented in subclasses. Provide current context for help searches (based on current selection / current cursor position). If no package information is known, leave that empty. */
virtual void currentHelpContext(QString *symbol, QString *package) = 0;
};
@@ -107,7 +100,6 @@ class RKCommandEditorWindow : public RKMDIWindow, public RKScriptContextProvider
/** Returns an id string for this document. Meaningful, only when url is empty. For keeping track of split views on unnamed/unsaved windows */
QString id() const { return _id; };
- QString provideContext(int line_rev) override;
void currentHelpContext(QString *symbol, QString *package) override;
void highlightLine(int linenum);
More information about the rkward-tracker
mailing list