diff options
| author | Zufu Liu <unknown> | 2021-05-08 14:41:20 +1000 | 
|---|---|---|
| committer | Zufu Liu <unknown> | 2021-05-08 14:41:20 +1000 | 
| commit | 9547147a9ca0f258d5d25a0b0b116373ed29533f (patch) | |
| tree | 479c3f194faeec5a21deaf36433334f4d130a884 /src/Document.cxx | |
| parent | f8dd521303ff7e201a3ee37a72d7d56d63e161c7 (diff) | |
| download | scintilla-mirror-9547147a9ca0f258d5d25a0b0b116373ed29533f.tar.gz | |
Feature [feature-requests:1373]. Add methods for refining idle task durations.
Diffstat (limited to 'src/Document.cxx')
| -rw-r--r-- | src/Document.cxx | 18 | 
1 files changed, 18 insertions, 0 deletions
diff --git a/src/Document.cxx b/src/Document.cxx index ffbf8f557..21d492a8e 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -107,6 +107,10 @@ double ActionDuration::Duration() const noexcept {  	return duration;  } +size_t ActionDuration::ActionsInAllowedTime(double secondsAllowed) const noexcept { +	return std::lround(secondsAllowed / Duration()); +} +  Document::Document(int options) :  	cb((options & SC_DOCUMENTOPTION_STYLES_NONE) == 0, (options & SC_DOCUMENTOPTION_TEXT_LARGE) != 0),  	durationStyleOneLine(0.00001, 0.000001, 0.0001) { @@ -474,6 +478,20 @@ Sci::Line Document::LineFromPositionIndex(Sci::Position pos, int lineCharacterIn  	return cb.LineFromPositionIndex(pos, lineCharacterIndex);  } +Sci::Line Document::LineFromPositionAfter(Sci::Line line, Sci::Position length) const noexcept { +	const Sci::Position posAfter = cb.LineStart(line) + length; +	if (posAfter >= LengthNoExcept()) { +		return LinesTotal(); +	} +	const Sci::Line lineAfter = SciLineFromPosition(posAfter); +	if (lineAfter > line) { +		return lineAfter; +	} else { +		// Want to make some progress so return next line +		return lineAfter + 1; +	} +} +  int SCI_METHOD Document::SetLevel(Sci_Position line, int level) {  	const int prev = Levels()->SetLevel(line, level, LinesTotal());  	if (prev != level) {  | 
