mirror of
https://github.com/IgorTimofeev/MineOS.git
synced 2025-12-21 19:49:23 +01:00
aefaefafe
This commit is contained in:
parent
8306cd4c5b
commit
8a73dfc2f5
@ -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.28,
|
version=1.29,
|
||||||
resources={
|
resources={
|
||||||
{
|
{
|
||||||
name="Localization/Russian.lang",
|
name="Localization/Russian.lang",
|
||||||
|
|||||||
BIN
Applications/.DS_Store
vendored
BIN
Applications/.DS_Store
vendored
Binary file not shown.
@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
selectWord = "Select current word",
|
||||||
gotoCyka = "Goto",
|
gotoCyka = "Goto",
|
||||||
gotoEnd = "Scroll to end",
|
gotoEnd = "Scroll to end",
|
||||||
gotoStart = "Scroll to start",
|
gotoStart = "Scroll to start",
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
selectWord = "Выделить текущее слово",
|
||||||
gotoCyka = "Переход",
|
gotoCyka = "Переход",
|
||||||
gotoEnd = "В конец",
|
gotoEnd = "В конец",
|
||||||
gotoStart = "В начало",
|
gotoStart = "В начало",
|
||||||
|
|||||||
@ -61,6 +61,7 @@ local config = {
|
|||||||
cursorColor = 0x00A8FF,
|
cursorColor = 0x00A8FF,
|
||||||
cursorSymbol = "┃",
|
cursorSymbol = "┃",
|
||||||
cursorBlinkDelay = 0.4,
|
cursorBlinkDelay = 0.4,
|
||||||
|
doubleClickDelay = 0.4,
|
||||||
}
|
}
|
||||||
|
|
||||||
local cursor = {
|
local cursor = {
|
||||||
@ -71,12 +72,14 @@ local cursor = {
|
|||||||
blinkState = false
|
blinkState = false
|
||||||
}
|
}
|
||||||
|
|
||||||
local configPath = MineOSCore.paths.system .. "MineCode/Config.cfg"
|
local resourcesPath = MineOSCore.getCurrentApplicationResourcesDirectory()
|
||||||
local localization = MineOSCore.getCurrentApplicationLocalization()
|
local configPath = resourcesPath .. "Config.cfg"
|
||||||
|
local localization = MineOSCore.getLocalization(resourcesPath .. "Localization/")
|
||||||
local findStartFrom
|
local findStartFrom
|
||||||
local workPath
|
local workPath
|
||||||
local clipboard
|
local clipboard
|
||||||
local lastErrorLine
|
local lastErrorLine
|
||||||
|
local lastClickUptime = computer.uptime()
|
||||||
local mainWindow = {}
|
local mainWindow = {}
|
||||||
|
|
||||||
---------------------------------------------------- Functions ----------------------------------------------------
|
---------------------------------------------------- Functions ----------------------------------------------------
|
||||||
@ -278,6 +281,27 @@ local function gotoLine(line)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function selectWord()
|
||||||
|
local shittySymbolsRegexp, from, to = "[%s%c%p]"
|
||||||
|
|
||||||
|
for i = cursor.position.symbol, 1, -1 do
|
||||||
|
if unicode.sub(mainWindow.codeView.lines[cursor.position.line], i, i):match(shittySymbolsRegexp) then break end
|
||||||
|
from = i
|
||||||
|
end
|
||||||
|
|
||||||
|
for i = cursor.position.symbol, unicode.len(mainWindow.codeView.lines[cursor.position.line]) do
|
||||||
|
if unicode.sub(mainWindow.codeView.lines[cursor.position.line], i, i):match(shittySymbolsRegexp) then break end
|
||||||
|
to = i
|
||||||
|
end
|
||||||
|
|
||||||
|
if from and to then
|
||||||
|
mainWindow.codeView.selections[1] = {
|
||||||
|
from = {symbol = from, line = cursor.position.line},
|
||||||
|
to = {symbol = to, line = cursor.position.line},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function removeTabs(text)
|
local function removeTabs(text)
|
||||||
local result = text:gsub("\t", string.rep(" ", mainWindow.codeView.indentationWidth))
|
local result = text:gsub("\t", string.rep(" ", mainWindow.codeView.indentationWidth))
|
||||||
return result
|
return result
|
||||||
@ -749,6 +773,9 @@ local function createWindow()
|
|||||||
deleteLine(cursor.position.line)
|
deleteLine(cursor.position.line)
|
||||||
end
|
end
|
||||||
menu:addSeparator()
|
menu:addSeparator()
|
||||||
|
menu:addItem(localization.selectWord, false, "^\\").onTouch = function()
|
||||||
|
selectWord()
|
||||||
|
end
|
||||||
menu:addItem(localization.selectAll, false, "^A").onTouch = function()
|
menu:addItem(localization.selectAll, false, "^A").onTouch = function()
|
||||||
selectAll()
|
selectAll()
|
||||||
end
|
end
|
||||||
@ -916,6 +943,10 @@ local function createWindow()
|
|||||||
menu:show()
|
menu:show()
|
||||||
else
|
else
|
||||||
setCursorPositionAndClearSelection(convertScreenCoordinatesToCursorPosition(eventData[3], eventData[4]))
|
setCursorPositionAndClearSelection(convertScreenCoordinatesToCursorPosition(eventData[3], eventData[4]))
|
||||||
|
|
||||||
|
local newUptime = computer.uptime()
|
||||||
|
if newUptime - lastClickUptime <= config.doubleClickDelay then selectWord() end
|
||||||
|
lastClickUptime = newUptime
|
||||||
end
|
end
|
||||||
elseif eventData[1] == "drag" and isClickedOnCodeArea(eventData[3], eventData[4]) then
|
elseif eventData[1] == "drag" and isClickedOnCodeArea(eventData[3], eventData[4]) then
|
||||||
if eventData[5] ~= 1 then
|
if eventData[5] ~= 1 then
|
||||||
@ -935,8 +966,11 @@ local function createWindow()
|
|||||||
elseif eventData[1] == "key_down" then
|
elseif eventData[1] == "key_down" then
|
||||||
-- Ctrl or CMD
|
-- Ctrl or CMD
|
||||||
if keyboard.isKeyDown(29) or keyboard.isKeyDown(219) then
|
if keyboard.isKeyDown(29) or keyboard.isKeyDown(219) then
|
||||||
|
-- Backslash
|
||||||
|
if eventData[4] == 43 then
|
||||||
|
selectWord()
|
||||||
-- Slash
|
-- Slash
|
||||||
if eventData[4] == 53 then
|
elseif eventData[4] == 53 then
|
||||||
toggleComment()
|
toggleComment()
|
||||||
-- A
|
-- A
|
||||||
elseif eventData[4] == 30 then
|
elseif eventData[4] == 30 then
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user