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

Method drawLineEndings

src/eepp/ui/uicodeeditor.cpp:4680–4701  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4678}
4679
4680void UICodeEditor::drawLineEndings( const DocumentLineRange& lineRange, const Vector2f& startScroll,
4681 const Float& /*lineHeight*/ ) {
4682 Color color( Color( mWhitespaceColor ).blendAlpha( mAlpha ) );
4683 auto fontSize = getCharacterSize();
4684 bool hasMainGlyph = mFont && mFont->getType() == FontType::TTF &&
4685 static_cast<FontTrueType*>( mFont )->hasGlyph( 0x23CE ); // ⏎
4686 bool hasSecondaryGlyph = !hasMainGlyph && mFont && mFont->getType() == FontType::TTF &&
4687 static_cast<FontTrueType*>( mFont )->hasGlyph( 0x21B5 ); // ↵
4688 GlyphDrawable* nl = mFont->getGlyphDrawable(
4689 hasMainGlyph ? 0x23CE : ( hasSecondaryGlyph ? 0x21B5 /*'↵'*/ : 172 /* '¬'*/ ), fontSize );
4690 nl->setDrawMode( GlyphDrawable::DrawMode::Text );
4691 nl->setColor( color );
4692 for ( auto index = lineRange.first; index <= lineRange.second; index++ ) {
4693 if ( !mDocView.isLineVisible( index ) )
4694 continue;
4695 auto offset =
4696 getTextPositionOffset( { index, static_cast<Int64>( mDoc->line( index ).size() ) } );
4697 Vector2f position( { static_cast<Float>( startScroll.x + offset.x ),
4698 static_cast<Float>( startScroll.y + offset.y ) } );
4699 nl->draw( Vector2f( position.x, position.y ) );
4700 }
4701}
4702
4703void UICodeEditor::registerCommands() {
4704 mDoc->setCommand( "move-to-previous-line", [this] { moveToPreviousLine(); } );

Callers

nothing calls this directly

Calls 8

hasGlyphMethod · 0.80
isLineVisibleMethod · 0.80
getTypeMethod · 0.45
getGlyphDrawableMethod · 0.45
setDrawModeMethod · 0.45
setColorMethod · 0.45
sizeMethod · 0.45
drawMethod · 0.45

Tested by

no test coverage detected