From ceb8b40136133cdafcad3e137c2df8dc03137e8a Mon Sep 17 00:00:00 2001 From: IgorTimofeev Date: Sat, 11 Sep 2021 02:15:50 +0700 Subject: [PATCH] =?UTF-8?q?=D0=91=D0=BB=D1=8F))?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Applications/MineCode IDE.app/Main.lua | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Applications/MineCode IDE.app/Main.lua b/Applications/MineCode IDE.app/Main.lua index 18982634..08c49bfa 100755 --- a/Applications/MineCode IDE.app/Main.lua +++ b/Applications/MineCode IDE.app/Main.lua @@ -533,8 +533,10 @@ end local function openFile(path) local file, reason = filesystem.open(path, "r") + if file then newFile() + leftTreeView.selectedItem = path codeView.hidden = true @@ -548,11 +550,12 @@ local function openFile(path) local counter, currentSize, totalSize = 1, 0, filesystem.size(path) for line in file:lines() do + counter, currentSize = counter + 1, currentSize + #line + 1 + line = optimizeString(line) table.insert(lines, line) codeView.maximumLineLength = math.max(codeView.maximumLineLength, unicode.len(line)) - counter, currentSize = counter + 1, currentSize + #line if counter % config.linesToShowOpenProgress == 0 then progressBar.value = math.floor(currentSize / totalSize * 100) computer.pullSignal(0) @@ -562,15 +565,15 @@ local function openFile(path) file:close() - if #lines > 1 then - table.remove(lines, 1) - end - if counter > config.linesToShowOpenProgress then progressBar.value = 100 workspace:draw() end + if #lines > 1 then + table.remove(lines, 1) + end + codeView.hidden = false container:remove() updateAutocompleteDatabaseFromAllLines()