Rename "margins" to "indents"

The name "margin" conflicts with another meaning, so we're making the
name in the public api "idents" and the code consistent in naming.

Change-Id: I9170116b4d972e4b25f0f319e78376310288eb41
This commit is contained in:
Raph Levien 2015-04-15 15:22:42 -07:00
parent dc7bc6e39e
commit bb86b433f9
2 changed files with 11 additions and 11 deletions

View File

@ -44,20 +44,20 @@ class LineWidths {
mFirstWidthLineCount = firstWidthLineCount;
mRestWidth = restWidth;
}
void setMargins(const std::vector<float>& margins) {
mMargins = margins;
void setIndents(const std::vector<float>& indents) {
mIndents = indents;
}
bool isConstant() const {
// technically mFirstWidthLineCount == 0 would count too, but doesn't actually happen
return mRestWidth == mFirstWidth && mMargins.empty();
return mRestWidth == mFirstWidth && mIndents.empty();
}
float getLineWidth(int line) const {
float width = (line < mFirstWidthLineCount) ? mFirstWidth : mRestWidth;
if (!mMargins.empty()) {
if ((size_t)line < mMargins.size()) {
width -= mMargins[line];
if (!mIndents.empty()) {
if ((size_t)line < mIndents.size()) {
width -= mIndents[line];
} else {
width -= mMargins.back();
width -= mIndents.back();
}
}
return width;
@ -66,7 +66,7 @@ class LineWidths {
float mFirstWidth;
int mFirstWidthLineCount;
float mRestWidth;
std::vector<float> mMargins;
std::vector<float> mIndents;
};
class TabStops {
@ -132,7 +132,7 @@ class LineBreaker {
void setLineWidths(float firstWidth, int firstWidthLineCount, float restWidth);
void setMargins(const std::vector<float>& margins);
void setIndents(const std::vector<float>& indents);
void setTabStops(const int* stops, size_t nStops, int tabWidth) {
mTabStops.set(stops, nStops, tabWidth);

View File

@ -79,8 +79,8 @@ void LineBreaker::setLineWidths(float firstWidth, int firstWidthLineCount, float
}
void LineBreaker::setMargins(const std::vector<float>& margins) {
mLineWidths.setMargins(margins);
void LineBreaker::setIndents(const std::vector<float>& indents) {
mLineWidths.setIndents(indents);
}
// This function determines whether a character is a space that disappears at end of line.