mirror of
https://github.com/IgorTimofeev/MineOS.git
synced 2025-12-20 19:19:21 +01:00
aaefaef
This commit is contained in:
parent
5845615612
commit
a48c1e89e2
@ -253,7 +253,7 @@
|
||||
name="lib/MineOSCore.lua",
|
||||
url="IgorTimofeev/OpenComputers/master/lib/MineOSCore.lua",
|
||||
type="Library",
|
||||
version=1.43,
|
||||
version=1.44,
|
||||
},
|
||||
{
|
||||
name="lib/advancedLua.lua",
|
||||
@ -274,7 +274,7 @@
|
||||
url="IgorTimofeev/OpenComputers/master/lib/ECSAPI.lua",
|
||||
type="Library",
|
||||
preLoadFile=true,
|
||||
version=1.07,
|
||||
version=1.08,
|
||||
},
|
||||
{
|
||||
name="lib/colorlib.lua",
|
||||
@ -886,7 +886,7 @@
|
||||
icon="IgorTimofeev/OpenComputers/master/Applications/MineCodeIDE/Icon.pic",
|
||||
createShortcut="dock",
|
||||
forceDownload=true,
|
||||
version=1.10,
|
||||
version=1.11,
|
||||
},
|
||||
{
|
||||
name="MineOS/Applications/Battleship",
|
||||
|
||||
BIN
Applications/.DS_Store
vendored
BIN
Applications/.DS_Store
vendored
Binary file not shown.
@ -168,10 +168,30 @@ local function moveCursor(symbolOffset, lineOffset)
|
||||
setCursorPositionAndClearSelection(newSymbol, newLine)
|
||||
end
|
||||
|
||||
local function setCursorPositionToEOF()
|
||||
local function setCursorPositionToHome()
|
||||
setCursorPositionAndClearSelection(1, 1)
|
||||
end
|
||||
|
||||
local function setCursorPositionToEnd()
|
||||
setCursorPositionAndClearSelection(unicode.len(mainWindow.codeView.lines[#mainWindow.codeView.lines]) + 1, #mainWindow.codeView.lines)
|
||||
end
|
||||
|
||||
local function scroll(direction, speed)
|
||||
if direction == 1 then
|
||||
if mainWindow.codeView.fromLine > speed then
|
||||
mainWindow.codeView.fromLine = mainWindow.codeView.fromLine - speed
|
||||
else
|
||||
mainWindow.codeView.fromLine = 1
|
||||
end
|
||||
else
|
||||
if mainWindow.codeView.fromLine < #mainWindow.codeView.lines - speed then
|
||||
mainWindow.codeView.fromLine = mainWindow.codeView.fromLine + speed
|
||||
else
|
||||
mainWindow.codeView.fromLine = #mainWindow.codeView.lines
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function gotoLine(line)
|
||||
mainWindow.codeView.fromLine = math.floor(line - mainWindow.codeView.height / 2) + 1
|
||||
if mainWindow.codeView.fromLine < 1 then
|
||||
@ -183,11 +203,15 @@ end
|
||||
|
||||
---------------------------------------------------- File processing methods ----------------------------------------------------
|
||||
|
||||
local function removeTabs(text)
|
||||
return text:gsub("\t", string.rep(" ", mainWindow.codeView.indentationWidth))
|
||||
end
|
||||
|
||||
local function loadFile(path)
|
||||
mainWindow.codeView.fromLine, mainWindow.codeView.fromSymbol, mainWindow.codeView.lines, mainWindow.codeView.maximumLineLength = 1, 1, {}, 0
|
||||
local file = io.open(path, "r")
|
||||
for line in file:lines() do
|
||||
line = line:gsub("\t", string.rep(" ", mainWindow.codeView.indentationWidth))
|
||||
line = removeTabs(line)
|
||||
table.insert(mainWindow.codeView.lines, line)
|
||||
mainWindow.codeView.maximumLineLength = math.max(mainWindow.codeView.maximumLineLength, unicode.len(line))
|
||||
end
|
||||
@ -214,7 +238,7 @@ local function newFile()
|
||||
""
|
||||
}
|
||||
workPath = nil
|
||||
setCursorPositionToEOF()
|
||||
setCursorPositionAndClearSelection(1, 1)
|
||||
end
|
||||
|
||||
local function open()
|
||||
@ -714,6 +738,18 @@ local function createWindow()
|
||||
-- F5
|
||||
elseif eventData[4] == 63 then
|
||||
run()
|
||||
-- Home
|
||||
elseif eventData[4] == 199 then
|
||||
setCursorPositionToHome()
|
||||
-- End
|
||||
elseif eventData[4] == 207 then
|
||||
setCursorPositionToEnd()
|
||||
-- Page Up
|
||||
elseif eventData[4] == 201 then
|
||||
scroll(1, mainWindow.codeView.height - 2)
|
||||
-- Page Down
|
||||
elseif eventData[4] == 209 then
|
||||
scroll(-1, mainWindow.codeView.height - 2)
|
||||
else
|
||||
if not keyboard.isControl(eventData[3]) then
|
||||
deleteSelectedData()
|
||||
@ -721,22 +757,14 @@ local function createWindow()
|
||||
end
|
||||
end
|
||||
elseif eventData[1] == "clipboard" then
|
||||
local lines = {}
|
||||
for line in data:gmatch("(.+)\n") do
|
||||
table.insert(lines, removeTabs(line))
|
||||
end
|
||||
paste({eventData[3]})
|
||||
elseif eventData[1] == "scroll" then
|
||||
if mainWindow.codeView:isClicked(eventData[3], eventData[4]) then
|
||||
if eventData[5] == 1 then
|
||||
if mainWindow.codeView.fromLine > config.scrollSpeed then
|
||||
mainWindow.codeView.fromLine = mainWindow.codeView.fromLine - config.scrollSpeed
|
||||
else
|
||||
mainWindow.codeView.fromLine = 1
|
||||
end
|
||||
else
|
||||
if mainWindow.codeView.fromLine < #mainWindow.codeView.lines - config.scrollSpeed then
|
||||
mainWindow.codeView.fromLine = mainWindow.codeView.fromLine + config.scrollSpeed
|
||||
else
|
||||
mainWindow.codeView.fromLine = #mainWindow.codeView.lines
|
||||
end
|
||||
end
|
||||
scroll(eventData[5], config.scrollSpeed)
|
||||
end
|
||||
elseif not eventData[1] then
|
||||
cursor.blinkState = oldCursorState
|
||||
|
||||
@ -1178,8 +1178,8 @@ 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
|
||||
ecs.prepareToExit()
|
||||
ecs.editFile(path .. inputs[1])
|
||||
local MineOSCore = require("MineOSCore")
|
||||
MineOSCore.safeLaunch(MineOSCore.paths.applications .. "/MineCode IDE.app/MineCode IDE.lua", "open", path)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user