MCPcopy Create free account
hub / github.com/SpartanJ/eepp / getVisibleIndexRange

Method getVisibleIndexRange

src/eepp/ui/doc/documentview.cpp:269–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

267}
268
269TextRange DocumentView::getVisibleIndexRange( VisibleIndex visibleIndex ) const {
270 if ( isOneToOne() )
271 return mDoc->getLineRange( static_cast<Int64>( visibleIndex ) );
272 Int64 idx = static_cast<Int64>( visibleIndex );
273 auto start = getVisibleIndexPosition( visibleIndex );
274 auto end = start;
275 eeASSERT( visibleIndex >= static_cast<VisibleIndex>( 0 ) );
276 if ( idx >= 0 && idx + 1 < static_cast<Int64>( mVisibleLines.size() ) &&
277 mVisibleLines[idx + 1].line() == start.line() ) {
278 end.setColumn( mVisibleLines[idx + 1].column() );
279 } else {
280 end.setColumn( mDoc->getLineLength( start.line() ) );
281 }
282 return { start, end };
283}
284
285std::shared_ptr<TextDocument> DocumentView::getDocument() const {
286 return mDoc;

Callers 2

getColFromXOffsetMethod · 0.80
moveToLineOffsetMethod · 0.80

Calls 5

getLineRangeMethod · 0.80
setColumnMethod · 0.80
columnMethod · 0.80
getLineLengthMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected