This commit is contained in:
IgorTimofeev 2021-09-11 02:15:50 +07:00
parent 45f2c0b2a1
commit ceb8b40136

View File

@ -533,8 +533,10 @@ end
local function openFile(path) local function openFile(path)
local file, reason = filesystem.open(path, "r") local file, reason = filesystem.open(path, "r")
if file then if file then
newFile() newFile()
leftTreeView.selectedItem = path leftTreeView.selectedItem = path
codeView.hidden = true codeView.hidden = true
@ -548,11 +550,12 @@ local function openFile(path)
local counter, currentSize, totalSize = 1, 0, filesystem.size(path) local counter, currentSize, totalSize = 1, 0, filesystem.size(path)
for line in file:lines() do for line in file:lines() do
counter, currentSize = counter + 1, currentSize + #line + 1
line = optimizeString(line) line = optimizeString(line)
table.insert(lines, line) table.insert(lines, line)
codeView.maximumLineLength = math.max(codeView.maximumLineLength, unicode.len(line)) codeView.maximumLineLength = math.max(codeView.maximumLineLength, unicode.len(line))
counter, currentSize = counter + 1, currentSize + #line
if counter % config.linesToShowOpenProgress == 0 then if counter % config.linesToShowOpenProgress == 0 then
progressBar.value = math.floor(currentSize / totalSize * 100) progressBar.value = math.floor(currentSize / totalSize * 100)
computer.pullSignal(0) computer.pullSignal(0)
@ -562,15 +565,15 @@ local function openFile(path)
file:close() file:close()
if #lines > 1 then
table.remove(lines, 1)
end
if counter > config.linesToShowOpenProgress then if counter > config.linesToShowOpenProgress then
progressBar.value = 100 progressBar.value = 100
workspace:draw() workspace:draw()
end end
if #lines > 1 then
table.remove(lines, 1)
end
codeView.hidden = false codeView.hidden = false
container:remove() container:remove()
updateAutocompleteDatabaseFromAllLines() updateAutocompleteDatabaseFromAllLines()