mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-23 14:54:34 +00:00
Don't reload source file, if it's already there.
This commit is contained in:
parent
5dc3d73ad6
commit
d45efbe640
@ -405,16 +405,19 @@ void View::InitTextEditor()
|
|||||||
|
|
||||||
void View::SetTextEditorFile( const char* fileName, int line )
|
void View::SetTextEditorFile( const char* fileName, int line )
|
||||||
{
|
{
|
||||||
FILE* f = fopen( fileName, "rb" );
|
if( !m_textEditorFile || strcmp( m_textEditorFile, fileName ) != 0 )
|
||||||
fseek( f, 0, SEEK_END );
|
{
|
||||||
const auto sz = ftell( f );
|
FILE* f = fopen( fileName, "rb" );
|
||||||
fseek( f, 0, SEEK_SET );
|
fseek( f, 0, SEEK_END );
|
||||||
std::string data;
|
const auto sz = ftell( f );
|
||||||
data.resize( sz );
|
fseek( f, 0, SEEK_SET );
|
||||||
fread( data.data(), 1, sz, f );
|
std::string data;
|
||||||
fclose( f );
|
data.resize( sz );
|
||||||
|
fread( data.data(), 1, sz, f );
|
||||||
|
fclose( f );
|
||||||
|
m_textEditor->SetText( data );
|
||||||
|
}
|
||||||
|
|
||||||
m_textEditor->SetText( data );
|
|
||||||
m_textEditor->SetCursorPosition( TextEditor::Coordinates( line-1, 0 ) );
|
m_textEditor->SetCursorPosition( TextEditor::Coordinates( line-1, 0 ) );
|
||||||
|
|
||||||
m_textEditorFile = fileName;
|
m_textEditorFile = fileName;
|
||||||
|
Loading…
Reference in New Issue
Block a user