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