mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-30 01:04:36 +00:00
Trim empty lines at top and bottom of source preview.
This commit is contained in:
parent
a15ba0c7fb
commit
62ac5544b6
@ -2554,15 +2554,24 @@ void SourceView::RenderAsmLine( AsmLine& line, uint32_t ipcnt, uint32_t iptotal,
|
|||||||
auto& lines = m_sourceTooltip.get();
|
auto& lines = m_sourceTooltip.get();
|
||||||
const int start = std::max( 0, (int)srcline - 4 );
|
const int start = std::max( 0, (int)srcline - 4 );
|
||||||
const int end = std::min<int>( m_sourceTooltip.get().size(), srcline + 3 );
|
const int end = std::min<int>( m_sourceTooltip.get().size(), srcline + 3 );
|
||||||
|
bool first = true;
|
||||||
|
int bottomEmpty = 0;
|
||||||
for( int i=start; i<end; i++ )
|
for( int i=start; i<end; i++ )
|
||||||
{
|
{
|
||||||
auto& line = lines[i];
|
auto& line = lines[i];
|
||||||
if( line.begin == line.end )
|
if( line.begin == line.end )
|
||||||
{
|
{
|
||||||
ImGui::TextUnformatted( "" );
|
if( !first ) bottomEmpty++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
first = false;
|
||||||
|
while( bottomEmpty > 0 )
|
||||||
|
{
|
||||||
|
ImGui::TextUnformatted( "" );
|
||||||
|
bottomEmpty--;
|
||||||
|
}
|
||||||
|
|
||||||
auto ptr = line.begin;
|
auto ptr = line.begin;
|
||||||
auto it = line.tokens.begin();
|
auto it = line.tokens.begin();
|
||||||
while( ptr < line.end )
|
while( ptr < line.end )
|
||||||
|
@ -17843,15 +17843,24 @@ void View::DrawSourceTooltip( const char* filename, uint32_t srcline, int before
|
|||||||
auto& lines = m_srcHintCache.get();
|
auto& lines = m_srcHintCache.get();
|
||||||
const int start = std::max( 0, (int)srcline - ( before+1 ) );
|
const int start = std::max( 0, (int)srcline - ( before+1 ) );
|
||||||
const int end = std::min<int>( m_srcHintCache.get().size(), srcline + after );
|
const int end = std::min<int>( m_srcHintCache.get().size(), srcline + after );
|
||||||
|
bool first = true;
|
||||||
|
int bottomEmpty = 0;
|
||||||
for( int i=start; i<end; i++ )
|
for( int i=start; i<end; i++ )
|
||||||
{
|
{
|
||||||
auto& line = lines[i];
|
auto& line = lines[i];
|
||||||
if( line.begin == line.end )
|
if( line.begin == line.end )
|
||||||
{
|
{
|
||||||
ImGui::TextUnformatted( "" );
|
if( !first ) bottomEmpty++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
first = false;
|
||||||
|
while( bottomEmpty > 0 )
|
||||||
|
{
|
||||||
|
ImGui::TextUnformatted( "" );
|
||||||
|
bottomEmpty--;
|
||||||
|
}
|
||||||
|
|
||||||
auto ptr = line.begin;
|
auto ptr = line.begin;
|
||||||
auto it = line.tokens.begin();
|
auto it = line.tokens.begin();
|
||||||
while( ptr < line.end )
|
while( ptr < line.end )
|
||||||
|
Loading…
Reference in New Issue
Block a user