diff --git a/.DS_Store b/.DS_Store index 82743031..ed27f62c 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/Applications.txt b/Applications.txt index 98302a3a..0edb41b4 100644 --- a/Applications.txt +++ b/Applications.txt @@ -274,7 +274,7 @@ url="IgorTimofeev/OpenComputers/master/lib/ECSAPI.lua", type="Library", preLoadFile=true, - version=1.11, + version=1.12, }, { name="lib/colorlib.lua", @@ -300,7 +300,7 @@ name="lib/GUI.lua", url="IgorTimofeev/OpenComputers/master/lib/GUI.lua", type="Library", - version=1.30, + version=1.31, }, { name="lib/windows.lua", @@ -886,7 +886,7 @@ icon="IgorTimofeev/OpenComputers/master/Applications/MineCodeIDE/Icon.pic", createShortcut="dock", forceDownload=true, - version=1.14, + version=1.15, }, { name="MineOS/Applications/Battleship", diff --git a/Applications/.DS_Store b/Applications/.DS_Store index f9f576eb..4bb09356 100644 Binary files a/Applications/.DS_Store and b/Applications/.DS_Store differ diff --git a/Applications/MineCodeIDE/MineCodeIDE.lua b/Applications/MineCodeIDE/MineCodeIDE.lua index 5d262372..80c96129 100755 --- a/Applications/MineCodeIDE/MineCodeIDE.lua +++ b/Applications/MineCodeIDE/MineCodeIDE.lua @@ -1,8 +1,7 @@ ---------------------------------------------------- Libraries ---------------------------------------------------- --- "/MineOS/Desktop/MineCode IDE.app/MineCode IDE.lua" --- "/MineOS/Applications/MineCode IDE.app/MineCode IDE.lua" +-- "/MineOS/Applications/MineCode IDE.app/MineCode IDE.lua" open Govno.lua -- package.loaded.syntax = nil -- package.loaded.GUI = nil @@ -218,6 +217,7 @@ local function loadFile(path) end file:close() workPath = path + if #mainWindow.codeView.lines == 0 then table.insert(mainWindow.codeView.lines, "") end setCursorPositionAndClearSelection(1, 1) end @@ -231,13 +231,7 @@ local function saveFile(path) end local function newFile() - mainWindow.codeView.lines = { - "", - "for i = 1, 10 do", - " print(\"Hello world!\")", - "end", - "" - } + mainWindow.codeView.lines = {""} workPath = nil setCursorPositionAndClearSelection(1, 1) end @@ -759,10 +753,14 @@ local function createWindow() end elseif eventData[1] == "clipboard" then local lines = {} - for line in eventData[3]:gmatch("(.+)\n") do table.insert(lines, removeTabs(line)) end + for line in eventData[3]:gmatch("([^\r\n]+)\r?\n?") do + line = removeTabs(line) + table.insert(lines, line) + end + table.insert(lines, "") paste(lines) elseif eventData[1] == "scroll" then - if mainWindow.codeView:isClicked(eventData[3], eventData[4]) then + if isClickedOnCodeArea(eventData[3], eventData[4]) then scroll(eventData[5], config.scrollSpeed) end elseif not eventData[1] then @@ -792,11 +790,15 @@ buffer.start() createWindow() calculateSizes() -mainWindow.drawShadow = false mainWindow:draw() -if args[1] == "open" and fs.exists(args[2]) then - loadFile(args[2]) +if args[1] == "open" then + if fs.exists(args[2]) then + loadFile(args[2]) + else + newFile() + workPath = args[2] + end else newFile() end diff --git a/lib/ECSAPI.lua b/lib/ECSAPI.lua index d8690332..3823aaa4 100755 --- a/lib/ECSAPI.lua +++ b/lib/ECSAPI.lua @@ -1178,8 +1178,6 @@ function ecs.newFile(path) local inputs = ecs.universalWindow("auto", "auto", 30, ecs.windowColors.background, true, {"EmptyLine"}, {"CenterText", 0x262626, "Новый файл"}, {"EmptyLine"}, {"Input", 0x262626, 0x880000, ""}, {"EmptyLine"}, {"Button", {0xbbbbbb, 0xffffff, "OK"}}) if ecs.checkName(inputs[1], path) then - fs.makeDirectory(path) - local file = io.open(path .. inputs[1], "w"); file:write(""); file:close() local MineOSCore = require("MineOSCore") MineOSCore.safeLaunch(MineOSCore.paths.applications .. "/MineCode IDE.app/MineCode IDE.lua", "open", path .. inputs[1]) end diff --git a/lib/GUI.lua b/lib/GUI.lua index c4f5e7fe..977b7bc1 100755 --- a/lib/GUI.lua +++ b/lib/GUI.lua @@ -1595,16 +1595,26 @@ local function codeViewDraw(codeView) end buffer.setDrawLimit(oldDrawLimit) - codeView.scrollBars.vertical.colors.background, codeView.scrollBars.vertical.colors.foreground = syntax.colorScheme.scrollBarBackground, syntax.colorScheme.scrollBarForeground - codeView.scrollBars.vertical.minimumValue, codeView.scrollBars.vertical.maximumValue, codeView.scrollBars.vertical.value, codeView.scrollBars.vertical.shownValueCount = 1, #codeView.lines, codeView.fromLine, codeView.height - codeView.scrollBars.vertical.localPosition.x = codeView.width - codeView.scrollBars.vertical.localPosition.y = 1 - codeView.scrollBars.vertical.height = codeView.height + if #codeView.lines > codeView.height then + codeView.scrollBars.vertical.isHidden = false + codeView.scrollBars.vertical.colors.background, codeView.scrollBars.vertical.colors.foreground = syntax.colorScheme.scrollBarBackground, syntax.colorScheme.scrollBarForeground + codeView.scrollBars.vertical.minimumValue, codeView.scrollBars.vertical.maximumValue, codeView.scrollBars.vertical.value, codeView.scrollBars.vertical.shownValueCount = 1, #codeView.lines, codeView.fromLine, codeView.height + codeView.scrollBars.vertical.localPosition.x = codeView.width + codeView.scrollBars.vertical.localPosition.y = 1 + codeView.scrollBars.vertical.height = codeView.height + else + codeView.scrollBars.vertical.isHidden = true + end - codeView.scrollBars.horizontal.colors.background, codeView.scrollBars.horizontal.colors.foreground = syntax.colorScheme.scrollBarBackground, syntax.colorScheme.scrollBarForeground - codeView.scrollBars.horizontal.minimumValue, codeView.scrollBars.horizontal.maximumValue, codeView.scrollBars.horizontal.value, codeView.scrollBars.horizontal.shownValueCount = 1, codeView.maximumLineLength, codeView.fromSymbol, codeView.codeAreaWidth - 2 - codeView.scrollBars.horizontal.localPosition.x, codeView.scrollBars.horizontal.width = codeView.lineNumbersWidth + 1, codeView.codeAreaWidth - 1 - codeView.scrollBars.horizontal.localPosition.y = codeView.height + if codeView.maximumLineLength > codeView.codeAreaWidth - 2 then + codeView.scrollBars.horizontal.isHidden = false + codeView.scrollBars.horizontal.colors.background, codeView.scrollBars.horizontal.colors.foreground = syntax.colorScheme.scrollBarBackground, syntax.colorScheme.scrollBarForeground + codeView.scrollBars.horizontal.minimumValue, codeView.scrollBars.horizontal.maximumValue, codeView.scrollBars.horizontal.value, codeView.scrollBars.horizontal.shownValueCount = 1, codeView.maximumLineLength, codeView.fromSymbol, codeView.codeAreaWidth - 2 + codeView.scrollBars.horizontal.localPosition.x, codeView.scrollBars.horizontal.width = codeView.lineNumbersWidth + 1, codeView.codeAreaWidth - codeView.lineNumbersWidth + codeView.scrollBars.horizontal.localPosition.y = codeView.height + else + codeView.scrollBars.horizontal.isHidden = true + end codeView:reimplementedDraw() end