aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil Hodgson <nyamatongwe@gmail.com>2014-09-05 14:29:55 +1000
committerNeil Hodgson <nyamatongwe@gmail.com>2014-09-05 14:29:55 +1000
commitfd6f558374a70cd51e4395f0c761c4586d687984 (patch)
tree2cc302232e23f8227ce162f4412f0252a5ae2e75
parente2144921e8113a36f01ae029af0ce7924f233613 (diff)
downloadscintilla-mirror-fd6f558374a70cd51e4395f0c761c4586d687984.tar.gz
Bug [#1652]. Revert to allowing fractional tab stops.
-rw-r--r--src/EditView.cxx13
-rw-r--r--src/EditView.h2
2 files changed, 7 insertions, 8 deletions
diff --git a/src/EditView.cxx b/src/EditView.cxx
index c46a0fbcf..7d5860ef8 100644
--- a/src/EditView.cxx
+++ b/src/EditView.cxx
@@ -215,11 +215,11 @@ void EditView::ClearAllTabstops() {
ldTabstops = 0;
}
-int EditView::NextTabstopPos(int line, int x, int tabWidth) const {
- int next = GetNextTabstop(line, x);
+XYPOSITION EditView::NextTabstopPos(int line, XYPOSITION x, XYPOSITION tabWidth) const {
+ int next = GetNextTabstop(line, static_cast<int>(x + 2));
if (next > 0)
- return next;
- return ((((x + 2) / tabWidth) + 1) * tabWidth);
+ return static_cast<XYPOSITION>(next);
+ return (static_cast<int>((x + 2) / tabWidth) + 1) * tabWidth;
}
bool EditView::ClearTabstops(int line) {
@@ -452,9 +452,8 @@ void EditView::LayoutLine(const EditModel &model, int line, Surface *surface, co
XYPOSITION representationWidth = vstyle.controlCharWidth;
if (ll->chars[ts.start] == '\t') {
// Tab is a special case of representation, taking a variable amount of space
- const int x = static_cast<int>(ll->positions[ts.start]);
- const int tabWidth = static_cast<int>(vstyle.tabWidth);
- representationWidth = static_cast<XYPOSITION>(NextTabstopPos(line, x, tabWidth) - ll->positions[ts.start]);
+ const XYPOSITION x = ll->positions[ts.start];
+ representationWidth = NextTabstopPos(line, x, vstyle.tabWidth) - ll->positions[ts.start];
} else {
if (representationWidth <= 0.0) {
XYPOSITION positionsRepr[256]; // Should expand when needed
diff --git a/src/EditView.h b/src/EditView.h
index dfcf3160c..733612e8e 100644
--- a/src/EditView.h
+++ b/src/EditView.h
@@ -86,7 +86,7 @@ public:
bool LinesOverlap() const;
void ClearAllTabstops();
- int NextTabstopPos(int line, int x, int tabWidth) const;
+ XYPOSITION NextTabstopPos(int line, XYPOSITION x, XYPOSITION tabWidth) const;
bool ClearTabstops(int line);
bool AddTabstop(int line, int x);
int GetNextTabstop(int line, int x) const;