aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2018-04-26 14:10:15 +1000
committerNeil <nyamatongwe@gmail.com>2018-04-26 14:10:15 +1000
commitf2b280565298dc86af2885ad78d331ba37602bfc (patch)
tree94481faafd7dc3ee063b1ba41a6ff8b773b0ffe0
parent243f0f5ef7c14109f03eb627aee88028d6acfdf1 (diff)
downloadscintilla-mirror-f2b280565298dc86af2885ad78d331ba37602bfc.tar.gz
Backport: Specify concrete class for ldTabstops and use directly instead of copying value
of .get() before use. Backport of changeset 6745:f8cf44b26722.
-rw-r--r--src/EditView.cxx11
-rw-r--r--src/EditView.h4
2 files changed, 7 insertions, 8 deletions
diff --git a/src/EditView.cxx b/src/EditView.cxx
index 2d4e6a040..0a14d582b 100644
--- a/src/EditView.cxx
+++ b/src/EditView.cxx
@@ -223,22 +223,19 @@ XYPOSITION EditView::NextTabstopPos(Sci::Line line, XYPOSITION x, XYPOSITION tab
}
bool EditView::ClearTabstops(Sci::Line line) {
- LineTabstops *lt = static_cast<LineTabstops *>(ldTabstops.get());
- return lt && lt->ClearTabstops(line);
+ return ldTabstops && ldTabstops->ClearTabstops(line);
}
bool EditView::AddTabstop(Sci::Line line, int x) {
if (!ldTabstops) {
ldTabstops.reset(new LineTabstops());
}
- LineTabstops *lt = static_cast<LineTabstops *>(ldTabstops.get());
- return lt && lt->AddTabstop(line, x);
+ return ldTabstops && ldTabstops->AddTabstop(line, x);
}
int EditView::GetNextTabstop(Sci::Line line, int x) const {
- const LineTabstops *lt = static_cast<LineTabstops *>(ldTabstops.get());
- if (lt) {
- return lt->GetNextTabstop(line, x);
+ if (ldTabstops) {
+ return ldTabstops->GetNextTabstop(line, x);
} else {
return 0;
}
diff --git a/src/EditView.h b/src/EditView.h
index f79147135..37d0423bb 100644
--- a/src/EditView.h
+++ b/src/EditView.h
@@ -42,13 +42,15 @@ void DrawStyledText(Surface *surface, const ViewStyle &vs, int styleOffset, PRec
typedef void (*DrawTabArrowFn)(Surface *surface, PRectangle rcTab, int ymid);
+class LineTabstops;
+
/**
* EditView draws the main text area.
*/
class EditView {
public:
PrintParameters printParameters;
- std::unique_ptr<PerLine> ldTabstops;
+ std::unique_ptr<LineTabstops> ldTabstops;
int tabWidthMinimumPixels;
bool hideSelection;