summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Cullmann <cullmann@kde.org>2014-01-18 21:19:48 (GMT)
committerChristoph Cullmann <cullmann@kde.org>2014-01-18 21:19:48 (GMT)
commite0f07584dfbde2e8854ce7dea05603904814310f (patch)
treeb515219934531d4cab6406f6ab62998c87c6f1a9
parent59b824fded498cc6860f2ded302e71e5255b6af0 (diff)
fix API to return a copy no reference
-rw-r--r--src/include/ktexteditor/view.h2
-rw-r--r--src/view/kateview.cpp8
-rw-r--r--src/view/kateview.h5
3 files changed, 4 insertions, 11 deletions
diff --git a/src/include/ktexteditor/view.h b/src/include/ktexteditor/view.h
index c159b70..d5a2f95 100644
--- a/src/include/ktexteditor/view.h
+++ b/src/include/ktexteditor/view.h
@@ -518,7 +518,7 @@ public:
* \return selection range, valid only if a selection currently exists.
* \see setSelection()
*/
- virtual const Range &selectionRange() const = 0;
+ virtual Range selectionRange() const = 0;
/**
* Get the view's selected text.
diff --git a/src/view/kateview.cpp b/src/view/kateview.cpp
index 1f8c6a8..d5f1f02 100644
--- a/src/view/kateview.cpp
+++ b/src/view/kateview.cpp
@@ -2833,13 +2833,9 @@ void KateView::shiftToMatchingBracket()
m_viewInternal->cursorToMatchingBracket(true);
}
-const KTextEditor::Range &KateView::selectionRange() const
+KTextEditor::Range KateView::selectionRange() const
{
- // update the cache
- m_holdSelectionRangeForAPI = m_selection;
-
- // return cached value, has right type!
- return m_holdSelectionRangeForAPI;
+ return m_selection;
}
KTextEditor::Document *KateView::document() const
diff --git a/src/view/kateview.h b/src/view/kateview.h
index dc4116b..31e86d7 100644
--- a/src/view/kateview.h
+++ b/src/view/kateview.h
@@ -283,13 +283,10 @@ public:
virtual bool selection() const;
virtual QString selectionText() const;
virtual bool blockSelection() const;
- virtual const KTextEditor::Range &selectionRange() const;
+ virtual KTextEditor::Range selectionRange() const;
static void blockFix(KTextEditor::Range &range);
-private:
- mutable KTextEditor::Range m_holdSelectionRangeForAPI;
-
//
// Arbitrary Syntax HL + Action extensions
//