Skip to content

Commit

Permalink
script_editor.as: fixed bogus filesize of Recent scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
ohlidalp committed Sep 26, 2023
1 parent 9cf3709 commit e1ca279
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions resources/scripts/script_editor.as
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const int BUFFER_MIN_SIZE = 10000;
const int BUFFER_INCREMENT_SIZE = 2500;
const color LINKCOLOR = color(0.3, 0.5, 0.9, 1.0);
ScriptEditorWindow editorWindow;
const uint FILEINFO_COMPRESSEDSIZE_UNKNOWN = uint(-1);

// Config:
// -------
Expand Down Expand Up @@ -461,7 +462,10 @@ class ScriptEditorWindow
ImGui::Bullet();
hovered = hovered || ImGui::IsItemHovered();
ImGui::SameLine(); ImGui::Text(filename); hovered = hovered || ImGui::IsItemHovered();
ImGui::SameLine(); ImGui::TextDisabled("("+formatFloat(float(size)/1000.f, "", 3, 2)+" KB)"); hovered = hovered || ImGui::IsItemHovered();
if(size != FILEINFO_COMPRESSEDSIZE_UNKNOWN)
{
ImGui::SameLine(); ImGui::TextDisabled("("+formatFloat(float(size)/1000.f, "", 3, 2)+" KB)"); hovered = hovered || ImGui::IsItemHovered();
}
ImGui::SameLine();
if (hovered && (@scriptinfo != null))
{
Expand Down Expand Up @@ -510,7 +514,10 @@ class ScriptEditorWindow

// if we got here, the name isn't in the list yet.
// Construct a pseudo-FileInfo format so we can use common helper.
recentScriptsRecord.fileinfos.insertLast({ {'filename', fnameBuf}, {'compressedSize',-1} } );
recentScriptsRecord.fileinfos.insertLast({
{'filename', fnameBuf},
{'compressedSize',FILEINFO_COMPRESSEDSIZE_UNKNOWN}
} );
}
}

Expand Down

0 comments on commit e1ca279

Please sign in to comment.