mirror of
https://github.com/IgorTimofeev/MineOS.git
synced 2025-12-20 02:59:20 +01:00
MineCode fixes
This commit is contained in:
parent
c7b62da6a8
commit
2bc0c4d1d3
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
enableSyntaxHighlight = "Enable syntax highlighting",
|
toggleSyntaxHighlight = "Toggle syntax highlighting",
|
||||||
disableSyntaxHighlight = "Disable syntax highlighting",
|
toggleAutocompletion = "Toggle autocompletion",
|
||||||
|
toggleAutoBrackets = "Toggle autobrackets",
|
||||||
toUpperCase = "To upper",
|
toUpperCase = "To upper",
|
||||||
toLowerCase = "To lower",
|
toLowerCase = "To lower",
|
||||||
convertCase = "Convert case",
|
convertCase = "Convert case",
|
||||||
@ -13,11 +14,7 @@
|
|||||||
continueDebug = "Continue",
|
continueDebug = "Continue",
|
||||||
gotoLine = "Goto line",
|
gotoLine = "Goto line",
|
||||||
lineNumber = "Line",
|
lineNumber = "Line",
|
||||||
enableAutocompletion = "Enable autocompletion",
|
|
||||||
disableAutocompletion = "Disable autocompletion",
|
|
||||||
selectAndPasteColor = "Select and paste color",
|
selectAndPasteColor = "Select and paste color",
|
||||||
enableAutoBrackets = "Enable autobrackets",
|
|
||||||
disableAutoBrackets = "Disable autobrackets",
|
|
||||||
url = "http://example.com/something.lua",
|
url = "http://example.com/something.lua",
|
||||||
getFromWeb = "Open from URL",
|
getFromWeb = "Open from URL",
|
||||||
downloading = "Downloading file...",
|
downloading = "Downloading file...",
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
enableSyntaxHighlight = "Activer la coloration syntaxique",
|
toggleSyntaxHighlight = "Toggle syntax highlighting",
|
||||||
disableSyntaxHighlight = "Désactiver la coloration syntaxique",
|
toggleAutocompletion = "Toggle autocompletion",
|
||||||
|
toggleAutoBrackets = "Toggle autobrackets",
|
||||||
toUpperCase = "Monter",
|
toUpperCase = "Monter",
|
||||||
toLowerCase = "Baisser",
|
toLowerCase = "Baisser",
|
||||||
convertCase = "Convertir le cas",
|
convertCase = "Convertir le cas",
|
||||||
@ -13,11 +14,7 @@
|
|||||||
continueDebug = "Continuer",
|
continueDebug = "Continuer",
|
||||||
gotoLine = "Aller à la ligne",
|
gotoLine = "Aller à la ligne",
|
||||||
lineNumber = "Ligne",
|
lineNumber = "Ligne",
|
||||||
enableAutocompletion = "Activer l'auto-complétion",
|
|
||||||
disableAutocompletion = "Désactiver l'auto-complétion",
|
|
||||||
selectAndPasteColor = "Sélectionnez et collez la couleur",
|
selectAndPasteColor = "Sélectionnez et collez la couleur",
|
||||||
enableAutoBrackets = "Activer le crochetage automatiques",
|
|
||||||
disableAutoBrackets = "Désactiver le crochetage automatiques",
|
|
||||||
url = "http://example.org/quelquechose.lua",
|
url = "http://example.org/quelquechose.lua",
|
||||||
getFromWeb = "Télécharger depuis une URL",
|
getFromWeb = "Télécharger depuis une URL",
|
||||||
downloading = "Téléchargement du fichier...",
|
downloading = "Téléchargement du fichier...",
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
enableSyntaxHighlight = "Syntaxhervorhebung aktivieren",
|
toggleSyntaxHighlight = "Toggle syntax highlighting",
|
||||||
disableSyntaxHighlight = "Syntaxhervorhebung deaktivieren",
|
toggleAutocompletion = "Toggle autocompletion",
|
||||||
|
toggleAutoBrackets = "Toggle autobrackets",
|
||||||
toUpperCase = "Nach oben",
|
toUpperCase = "Nach oben",
|
||||||
toLowerCase = "Senken",
|
toLowerCase = "Senken",
|
||||||
convertCase = "Konvertieren Fall",
|
convertCase = "Konvertieren Fall",
|
||||||
@ -13,11 +14,7 @@
|
|||||||
continueDebug = "Weiterhin",
|
continueDebug = "Weiterhin",
|
||||||
gotoLine = "Gehe zu Zeile",
|
gotoLine = "Gehe zu Zeile",
|
||||||
lineNumber = "Linie",
|
lineNumber = "Linie",
|
||||||
enableAutocompletion = "Autovervollständigung aktivieren",
|
|
||||||
disableAutocompletion = "Autovervollständigung deaktivieren",
|
|
||||||
selectAndPasteColor = "Farbe auswählen und einfügen",
|
selectAndPasteColor = "Farbe auswählen und einfügen",
|
||||||
enableAutoBrackets = "Automatische Klammern aktivieren",
|
|
||||||
disableAutoBrackets = "Automatische Klammern deaktivieren",
|
|
||||||
url = "http://example.com/something.lua",
|
url = "http://example.com/something.lua",
|
||||||
getFromWeb = "Von URL öffnen",
|
getFromWeb = "Von URL öffnen",
|
||||||
downloading = "Herunterladenzeit...",
|
downloading = "Herunterladenzeit...",
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
enableSyntaxHighlight = "Attiva evidenziazione sintassi",
|
toggleSyntaxHighlight = "Toggle syntax highlighting",
|
||||||
disableSyntaxHighlight = "Disabilita evidenziazione sintassi",
|
toggleAutocompletion = "Toggle autocompletion",
|
||||||
|
toggleAutoBrackets = "Toggle autobrackets",
|
||||||
toUpperCase = "In alto",
|
toUpperCase = "In alto",
|
||||||
toLowerCase = "Abbassare",
|
toLowerCase = "Abbassare",
|
||||||
convertCase = "Converti maiuscole / minuscole",
|
convertCase = "Converti maiuscole / minuscole",
|
||||||
@ -13,11 +14,7 @@
|
|||||||
continueDebug = "Continuare",
|
continueDebug = "Continuare",
|
||||||
gotoLine = "Va alla riga",
|
gotoLine = "Va alla riga",
|
||||||
lineNumber = "Linea",
|
lineNumber = "Linea",
|
||||||
enableAutocompletion = "Abilita completamento automatico",
|
|
||||||
disableAutocompletion = "Disabilita completamento automatico",
|
|
||||||
selectAndPasteColor = "Seleziona e incolla colore",
|
selectAndPasteColor = "Seleziona e incolla colore",
|
||||||
enableAutoBrackets = "Abilita parentesi automatiche",
|
|
||||||
disableAutoBrackets = "Disabilita parentesi automatiche",
|
|
||||||
url = "http://example.com/something.lua",
|
url = "http://example.com/something.lua",
|
||||||
getFromWeb = "Apri DALL'URL",
|
getFromWeb = "Apri DALL'URL",
|
||||||
downloading = "Scaricamento file...",
|
downloading = "Scaricamento file...",
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
enableSyntaxHighlight = "Включить подсветку синтаксиса",
|
toggleSyntaxHighlight = "Вкл/выкл подсветку синтаксиса",
|
||||||
disableSyntaxHighlight = "Отключить подсветку синтаксиса",
|
toggleAutocompletion = "Вкл/выкл автодополнение",
|
||||||
|
toggleAutoBrackets = "Вкл/выкл автоскобки",
|
||||||
toUpperCase = "В верхний",
|
toUpperCase = "В верхний",
|
||||||
toLowerCase = "В нижний",
|
toLowerCase = "В нижний",
|
||||||
convertCase = "Преобразовать регистр",
|
convertCase = "Преобразовать регистр",
|
||||||
@ -13,11 +14,7 @@
|
|||||||
continueDebug = "Продолжить",
|
continueDebug = "Продолжить",
|
||||||
gotoLine = "Перейти к строке",
|
gotoLine = "Перейти к строке",
|
||||||
lineNumber = "Номер строки",
|
lineNumber = "Номер строки",
|
||||||
enableAutocompletion = "Включить автодополнение",
|
|
||||||
disableAutocompletion = "Отключить автодополнение",
|
|
||||||
selectAndPasteColor = "Выбрать и вставить цвет",
|
selectAndPasteColor = "Выбрать и вставить цвет",
|
||||||
enableAutoBrackets = "Включить авто-скобки",
|
|
||||||
disableAutoBrackets = "Отключить авто-скобки",
|
|
||||||
url = "http://example.com/something.lua",
|
url = "http://example.com/something.lua",
|
||||||
getFromWeb = "Открыть по URL",
|
getFromWeb = "Открыть по URL",
|
||||||
downloading = "Идет загрузка файла...",
|
downloading = "Идет загрузка файла...",
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
enableSyntaxHighlight = "Включити підсвічування синтаксису",
|
toggleSyntaxHighlight = "Toggle syntax highlighting",
|
||||||
disableSyntaxHighlight = "Відключити підсвічування синтаксису",
|
toggleAutocompletion = "Toggle autocompletion",
|
||||||
|
toggleAutoBrackets = "Toggle autobrackets",
|
||||||
toUpperCase = "У верхній",
|
toUpperCase = "У верхній",
|
||||||
toLowerCase = "У нижній",
|
toLowerCase = "У нижній",
|
||||||
convertCase = "Перетворити регістр",
|
convertCase = "Перетворити регістр",
|
||||||
@ -13,11 +14,7 @@
|
|||||||
continueDebug = "Продовжити",
|
continueDebug = "Продовжити",
|
||||||
gotoLine = "Перейти до рядка",
|
gotoLine = "Перейти до рядка",
|
||||||
lineNumber = "Номер рядка",
|
lineNumber = "Номер рядка",
|
||||||
enableAutocompletion = "Включити автодоповнення",
|
|
||||||
disableAutocompletion = "Відключити автодоповнення",
|
|
||||||
selectAndPasteColor = "Вибрати і вставити колір",
|
selectAndPasteColor = "Вибрати і вставити колір",
|
||||||
enableAutoBrackets = "Включити авто-дужки",
|
|
||||||
disableAutoBrackets = "Відключити авто-дужки",
|
|
||||||
url = "http://example.com/something.lua",
|
url = "http://example.com/something.lua",
|
||||||
getFromWeb = "Завантажити з URL",
|
getFromWeb = "Завантажити з URL",
|
||||||
debugging = "Отладчик на рядку",
|
debugging = "Отладчик на рядку",
|
||||||
|
|||||||
@ -111,24 +111,11 @@ codeView.draw = function(...)
|
|||||||
x >= codeView.codeAreaPosition + 1 and
|
x >= codeView.codeAreaPosition + 1 and
|
||||||
y >= codeView.y and
|
y >= codeView.y and
|
||||||
x <= codeView.codeAreaPosition + codeView.codeAreaWidth - 2 and
|
x <= codeView.codeAreaPosition + codeView.codeAreaWidth - 2 and
|
||||||
y <= codeView.y + codeView.height - 2
|
y <= codeView.y + codeView.height - (codeView.horizontalScrollBar.hidden and 1 or 2)
|
||||||
then
|
then
|
||||||
screen.drawText(x, y, config.cursorColor, config.cursorSymbol)
|
screen.drawText(x, y, config.cursorColor, config.cursorSymbol)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- if autocompleteDatabase then
|
|
||||||
-- local w = 30
|
|
||||||
-- local x, y = codeView.x + codeView.width - w, codeView.y
|
|
||||||
-- screen.drawRectangle(x, y, w, codeView.height, 0x0, 0xFFFFFF, " ")
|
|
||||||
-- for key, value in pairs(autocompleteDatabase) do
|
|
||||||
-- screen.drawText(x + 1, y, 0xFFFFFF, key .. ": " .. value)
|
|
||||||
-- y = y + 1
|
|
||||||
-- if y > codeView.y + codeView.height - 1 then
|
|
||||||
-- break
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function saveConfig()
|
local function saveConfig()
|
||||||
@ -408,10 +395,11 @@ local function addBreakpoint()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function fixFromLineByCursorPosition()
|
local function fixFromLineByCursorPosition()
|
||||||
|
local offset = codeView.horizontalScrollBar.hidden and 1 or 2
|
||||||
if codeView.fromLine > cursorPositionLine then
|
if codeView.fromLine > cursorPositionLine then
|
||||||
codeView.fromLine = cursorPositionLine
|
codeView.fromLine = cursorPositionLine
|
||||||
elseif codeView.fromLine + codeView.height - 2 < cursorPositionLine then
|
elseif codeView.fromLine + codeView.height - offset < cursorPositionLine then
|
||||||
codeView.fromLine = cursorPositionLine - codeView.height + 2
|
codeView.fromLine = cursorPositionLine - codeView.height + offset
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -437,7 +425,7 @@ local function fixCursorPosition(symbol, line)
|
|||||||
symbol = lineLength + 1
|
symbol = lineLength + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
return symbol, line
|
return math.floor(symbol), math.floor(line)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function setCursorPosition(symbol, line)
|
local function setCursorPosition(symbol, line)
|
||||||
@ -469,7 +457,7 @@ local function moveCursor(symbolOffset, lineOffset, ignoreHidden)
|
|||||||
newLine, newSymbol = newLine + 1, 1
|
newLine, newSymbol = newLine + 1, 1
|
||||||
end
|
end
|
||||||
|
|
||||||
setCursorPositionAndClearSelection(newSymbol, newLine)
|
setCursorPosition(newSymbol, newLine)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1366,9 +1354,13 @@ local function createEditOrRightClickMenu(menu)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function checkScrollbar(y)
|
||||||
|
return codeView.horizontalScrollBar.hidden or y < codeView.y + codeView.height - 1
|
||||||
|
end
|
||||||
|
|
||||||
local uptime = computer.uptime()
|
local uptime = computer.uptime()
|
||||||
codeView.eventHandler = function(workspace, object, e1, e2, e3, e4, e5)
|
codeView.eventHandler = function(workspace, object, e1, e2, e3, e4, e5)
|
||||||
if e1 == "touch" then
|
if e1 == "touch" and checkScrollbar(e4) then
|
||||||
if e5 == 1 then
|
if e5 == 1 then
|
||||||
createEditOrRightClickMenu(GUI.addContextMenu(workspace, e3, e4))
|
createEditOrRightClickMenu(GUI.addContextMenu(workspace, e3, e4))
|
||||||
else
|
else
|
||||||
@ -1379,19 +1371,17 @@ codeView.eventHandler = function(workspace, object, e1, e2, e3, e4, e5)
|
|||||||
elseif e1 == "double_touch" then
|
elseif e1 == "double_touch" then
|
||||||
selectWord()
|
selectWord()
|
||||||
tick(true)
|
tick(true)
|
||||||
elseif e1 == "drag" then
|
elseif e1 == "drag" and checkScrollbar(e4) then
|
||||||
if e5 ~= 1 then
|
codeView.selections[1] = codeView.selections[1] or {from = {}, to = {}}
|
||||||
codeView.selections[1] = codeView.selections[1] or {from = {}, to = {}}
|
codeView.selections[1].from.symbol, codeView.selections[1].from.line = cursorPositionSymbol, cursorPositionLine
|
||||||
codeView.selections[1].from.symbol, codeView.selections[1].from.line = cursorPositionSymbol, cursorPositionLine
|
codeView.selections[1].to.symbol, codeView.selections[1].to.line = fixCursorPosition(convertScreenCoordinatesToTextPosition(e3, e4))
|
||||||
codeView.selections[1].to.symbol, codeView.selections[1].to.line = fixCursorPosition(convertScreenCoordinatesToTextPosition(e3, e4))
|
|
||||||
|
if codeView.selections[1].from.line > codeView.selections[1].to.line then
|
||||||
if codeView.selections[1].from.line > codeView.selections[1].to.line then
|
codeView.selections[1].from.line, codeView.selections[1].to.line = codeView.selections[1].to.line, codeView.selections[1].from.line
|
||||||
codeView.selections[1].from.line, codeView.selections[1].to.line = codeView.selections[1].to.line, codeView.selections[1].from.line
|
codeView.selections[1].from.symbol, codeView.selections[1].to.symbol = codeView.selections[1].to.symbol, codeView.selections[1].from.symbol
|
||||||
|
elseif codeView.selections[1].from.line == codeView.selections[1].to.line then
|
||||||
|
if codeView.selections[1].from.symbol > codeView.selections[1].to.symbol then
|
||||||
codeView.selections[1].from.symbol, codeView.selections[1].to.symbol = codeView.selections[1].to.symbol, codeView.selections[1].from.symbol
|
codeView.selections[1].from.symbol, codeView.selections[1].to.symbol = codeView.selections[1].to.symbol, codeView.selections[1].from.symbol
|
||||||
elseif codeView.selections[1].from.line == codeView.selections[1].to.line then
|
|
||||||
if codeView.selections[1].from.symbol > codeView.selections[1].to.symbol then
|
|
||||||
codeView.selections[1].from.symbol, codeView.selections[1].to.symbol = codeView.selections[1].to.symbol, codeView.selections[1].from.symbol
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1753,17 +1743,17 @@ end
|
|||||||
|
|
||||||
propertiesContextMenu:addSeparator()
|
propertiesContextMenu:addSeparator()
|
||||||
|
|
||||||
propertiesContextMenu:addItem(config.syntaxHighlight and localization.disableSyntaxHighlight or localization.enableSyntaxHighlight).onTouch = function()
|
propertiesContextMenu:addItem(localization.toggleSyntaxHighlight).onTouch = function()
|
||||||
syntaxHighlightingButton.pressed = not syntaxHighlightingButton.pressed
|
syntaxHighlightingButton.pressed = not syntaxHighlightingButton.pressed
|
||||||
syntaxHighlightingButton.onTouch()
|
syntaxHighlightingButton.onTouch()
|
||||||
end
|
end
|
||||||
|
|
||||||
propertiesContextMenu:addItem(config.enableAutoBrackets and localization.disableAutoBrackets or localization.enableAutoBrackets, false, "^]").onTouch = function()
|
propertiesContextMenu:addItem(localization.toggleAutoBrackets, false, "^]").onTouch = function()
|
||||||
config.enableAutoBrackets = not config.enableAutoBrackets
|
config.enableAutoBrackets = not config.enableAutoBrackets
|
||||||
saveConfig()
|
saveConfig()
|
||||||
end
|
end
|
||||||
|
|
||||||
propertiesContextMenu:addItem(config.enableAutocompletion and localization.disableAutocompletion or localization.enableAutocompletion, false, "^I").onTouch = function()
|
propertiesContextMenu:addItem(localization.toggleAutocompletion, false, "^I").onTouch = function()
|
||||||
toggleEnableAutocompleteDatabase()
|
toggleEnableAutocompleteDatabase()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -979,55 +979,66 @@ end
|
|||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
local function codeViewDraw(codeView)
|
local function codeViewDraw(codeView)
|
||||||
local toLine, colorScheme, patterns = codeView.fromLine + codeView.height - 1, codeView.syntaxColorScheme, codeView.syntaxPatterns
|
local y, toLine, colorScheme, patterns = codeView.y, codeView.fromLine + codeView.height - 1, codeView.syntaxColorScheme, codeView.syntaxPatterns
|
||||||
|
|
||||||
-- Line numbers bar and code area
|
-- Line numbers bar and code area
|
||||||
codeView.lineNumbersWidth = unicode.len(tostring(toLine)) + 2
|
codeView.lineNumbersWidth = unicode.len(tostring(toLine)) + 2
|
||||||
codeView.codeAreaPosition = codeView.x + codeView.lineNumbersWidth
|
codeView.codeAreaPosition = codeView.x + codeView.lineNumbersWidth
|
||||||
codeView.codeAreaWidth = codeView.width - codeView.lineNumbersWidth
|
codeView.codeAreaWidth = codeView.width - codeView.lineNumbersWidth
|
||||||
|
|
||||||
-- Line numbers
|
-- Line numbers
|
||||||
screen.drawRectangle(codeView.x, codeView.y, codeView.lineNumbersWidth, codeView.height, colorScheme.lineNumbersBackground, colorScheme.lineNumbersText, " ")
|
screen.drawRectangle(codeView.x, y, codeView.lineNumbersWidth, codeView.height, colorScheme.lineNumbersBackground, colorScheme.lineNumbersText, " ")
|
||||||
|
|
||||||
-- Background
|
-- Background
|
||||||
screen.drawRectangle(codeView.codeAreaPosition, codeView.y, codeView.codeAreaWidth, codeView.height, colorScheme.background, colorScheme.text, " ")
|
screen.drawRectangle(codeView.codeAreaPosition, y, codeView.codeAreaWidth, codeView.height, colorScheme.background, colorScheme.text, " ")
|
||||||
|
|
||||||
-- Line numbers texts
|
-- Line numbers texts
|
||||||
local y = codeView.y
|
local text
|
||||||
for line = codeView.fromLine, toLine do
|
for line = codeView.fromLine, toLine do
|
||||||
if codeView.lines[line] then
|
if codeView.lines[line] then
|
||||||
local text = tostring(line)
|
text = line .. ""
|
||||||
if codeView.highlights[line] then
|
if codeView.highlights[line] then
|
||||||
screen.drawRectangle(codeView.x, y, codeView.lineNumbersWidth, 1, codeView.highlights[line], colorScheme.text, " ", 0.3)
|
screen.drawRectangle(codeView.x, y, codeView.lineNumbersWidth, 1, codeView.highlights[line], colorScheme.text, " ", 0.3)
|
||||||
screen.drawRectangle(codeView.codeAreaPosition, y, codeView.codeAreaWidth, 1, codeView.highlights[line], colorScheme.text, " ")
|
screen.drawRectangle(codeView.codeAreaPosition, y, codeView.codeAreaWidth, 1, codeView.highlights[line], colorScheme.text, " ")
|
||||||
end
|
end
|
||||||
|
|
||||||
screen.drawText(codeView.codeAreaPosition - unicode.len(text) - 1, y, colorScheme.lineNumbersText, text)
|
screen.drawText(codeView.codeAreaPosition - unicode.len(text) - 1, y, colorScheme.lineNumbersText, text)
|
||||||
|
|
||||||
y = y + 1
|
y = y + 1
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function drawUpperSelection(y, selectionIndex)
|
|
||||||
screen.drawRectangle(
|
|
||||||
codeView.codeAreaPosition + codeView.selections[selectionIndex].from.symbol - codeView.fromSymbol + 1,
|
|
||||||
y + codeView.selections[selectionIndex].from.line - codeView.fromLine,
|
|
||||||
codeView.codeAreaWidth - codeView.selections[selectionIndex].from.symbol + codeView.fromSymbol - 1,
|
|
||||||
1,
|
|
||||||
codeView.selections[selectionIndex].color or colorScheme.selection, colorScheme.text, " "
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
local function drawLowerSelection(y, selectionIndex)
|
|
||||||
screen.drawRectangle(
|
|
||||||
codeView.codeAreaPosition,
|
|
||||||
y + codeView.selections[selectionIndex].from.line - codeView.fromLine,
|
|
||||||
codeView.selections[selectionIndex].to.symbol - codeView.fromSymbol + 2,
|
|
||||||
1,
|
|
||||||
codeView.selections[selectionIndex].color or colorScheme.selection, colorScheme.text, " "
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
if #codeView.selections > 0 then
|
if #codeView.selections > 0 then
|
||||||
|
local function drawUpperSelection(y, selectionIndex)
|
||||||
|
screen.drawRectangle(
|
||||||
|
math.max(codeView.codeAreaPosition, codeView.codeAreaPosition + codeView.selections[selectionIndex].from.symbol - codeView.fromSymbol + 1),
|
||||||
|
y + codeView.selections[selectionIndex].from.line - codeView.fromLine,
|
||||||
|
codeView.codeAreaWidth - codeView.selections[selectionIndex].from.symbol + codeView.fromSymbol - 1,
|
||||||
|
1,
|
||||||
|
codeView.selections[selectionIndex].color or colorScheme.selection,
|
||||||
|
colorScheme.text,
|
||||||
|
" "
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function drawLowerSelection(y, selectionIndex)
|
||||||
|
screen.drawRectangle(
|
||||||
|
codeView.codeAreaPosition,
|
||||||
|
y + codeView.selections[selectionIndex].from.line - codeView.fromLine,
|
||||||
|
codeView.selections[selectionIndex].to.symbol - codeView.fromSymbol + 2,
|
||||||
|
1,
|
||||||
|
codeView.selections[selectionIndex].color or colorScheme.selection,
|
||||||
|
colorScheme.text,
|
||||||
|
" "
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
for selectionIndex = 1, #codeView.selections do
|
for selectionIndex = 1, #codeView.selections do
|
||||||
y = codeView.y
|
y = codeView.y
|
||||||
local dy = codeView.selections[selectionIndex].to.line - codeView.selections[selectionIndex].from.line
|
local dy = codeView.selections[selectionIndex].to.line - codeView.selections[selectionIndex].from.line
|
||||||
|
|
||||||
if dy == 0 then
|
if dy == 0 then
|
||||||
screen.drawRectangle(
|
screen.drawRectangle(
|
||||||
codeView.codeAreaPosition + codeView.selections[selectionIndex].from.symbol - codeView.fromSymbol + 1,
|
codeView.codeAreaPosition + codeView.selections[selectionIndex].from.symbol - codeView.fromSymbol + 1,
|
||||||
@ -1037,12 +1048,26 @@ local function codeViewDraw(codeView)
|
|||||||
codeView.selections[selectionIndex].color or colorScheme.selection, colorScheme.text, " "
|
codeView.selections[selectionIndex].color or colorScheme.selection, colorScheme.text, " "
|
||||||
)
|
)
|
||||||
elseif dy == 1 then
|
elseif dy == 1 then
|
||||||
drawUpperSelection(y, selectionIndex); y = y + 1
|
drawUpperSelection(y, selectionIndex)
|
||||||
|
y = y + 1
|
||||||
|
|
||||||
drawLowerSelection(y, selectionIndex)
|
drawLowerSelection(y, selectionIndex)
|
||||||
else
|
else
|
||||||
drawUpperSelection(y, selectionIndex); y = y + 1
|
drawUpperSelection(y, selectionIndex)
|
||||||
|
y = y + 1
|
||||||
|
|
||||||
for i = 1, dy - 1 do
|
for i = 1, dy - 1 do
|
||||||
screen.drawRectangle(codeView.codeAreaPosition, y + codeView.selections[selectionIndex].from.line - codeView.fromLine, codeView.codeAreaWidth, 1, codeView.selections[selectionIndex].color or colorScheme.selection, colorScheme.text, " "); y = y + 1
|
screen.drawRectangle(
|
||||||
|
codeView.codeAreaPosition,
|
||||||
|
y + codeView.selections[selectionIndex].from.line - codeView.fromLine,
|
||||||
|
codeView.codeAreaWidth,
|
||||||
|
1,
|
||||||
|
codeView.selections[selectionIndex].color or colorScheme.selection,
|
||||||
|
colorScheme.text,
|
||||||
|
" "
|
||||||
|
)
|
||||||
|
|
||||||
|
y = y + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
drawLowerSelection(y, selectionIndex)
|
drawLowerSelection(y, selectionIndex)
|
||||||
@ -1052,7 +1077,6 @@ local function codeViewDraw(codeView)
|
|||||||
|
|
||||||
-- Code strings
|
-- Code strings
|
||||||
y = codeView.y
|
y = codeView.y
|
||||||
|
|
||||||
for i = codeView.fromLine, toLine do
|
for i = codeView.fromLine, toLine do
|
||||||
if codeView.lines[i] then
|
if codeView.lines[i] then
|
||||||
if codeView.syntaxHighlight then
|
if codeView.syntaxHighlight then
|
||||||
@ -1066,7 +1090,16 @@ local function codeViewDraw(codeView)
|
|||||||
codeView.lines[i]
|
codeView.lines[i]
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
screen.drawText(codeView.codeAreaPosition - codeView.fromSymbol + 2, y, colorScheme.text, codeView.lines[i])
|
screen.drawText(
|
||||||
|
codeView.codeAreaPosition + 1,
|
||||||
|
y,
|
||||||
|
colorScheme.text,
|
||||||
|
unicode.sub(
|
||||||
|
codeView.lines[i],
|
||||||
|
codeView.fromSymbol,
|
||||||
|
codeView.fromSymbol + codeView.codeAreaWidth - 3
|
||||||
|
)
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
y = y + 1
|
y = y + 1
|
||||||
@ -1075,6 +1108,7 @@ local function codeViewDraw(codeView)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Scrollbars
|
||||||
if #codeView.lines > codeView.height then
|
if #codeView.lines > codeView.height then
|
||||||
codeView.verticalScrollBar.colors.background, codeView.verticalScrollBar.colors.foreground = colorScheme.scrollBarBackground, colorScheme.scrollBarForeground
|
codeView.verticalScrollBar.colors.background, codeView.verticalScrollBar.colors.foreground = colorScheme.scrollBarBackground, colorScheme.scrollBarForeground
|
||||||
codeView.verticalScrollBar.minimumValue, codeView.verticalScrollBar.maximumValue, codeView.verticalScrollBar.value, codeView.verticalScrollBar.shownValueCount = 1, #codeView.lines, codeView.fromLine, codeView.height
|
codeView.verticalScrollBar.minimumValue, codeView.verticalScrollBar.maximumValue, codeView.verticalScrollBar.value, codeView.verticalScrollBar.shownValueCount = 1, #codeView.lines, codeView.fromLine, codeView.height
|
||||||
@ -3690,9 +3724,13 @@ function GUI.highlightString(x, y, fromChar, indentationWidth, patterns, colorSc
|
|||||||
x = x1
|
x = x1
|
||||||
end
|
end
|
||||||
|
|
||||||
local toChar, endX = stringLength, x + stringLength - 1
|
-- local toChar, endX = stringLength, x + stringLength - 1
|
||||||
if endX > x2 then
|
-- if endX > x2 then
|
||||||
toChar = toChar - endX + x2
|
-- toChar = toChar - endX + x2
|
||||||
|
-- end
|
||||||
|
local toChar = fromChar + x2 - x
|
||||||
|
if toChar > stringLength then
|
||||||
|
toChar = stringLength
|
||||||
end
|
end
|
||||||
|
|
||||||
local counter, symbols, colors, bufferIndex, newFrameBackgrounds, newFrameForegrounds, newFrameSymbols, searchFrom, starting, ending = indentationWidth, {}, {}, screen.getIndex(x, y), screen.getNewFrameTables()
|
local counter, symbols, colors, bufferIndex, newFrameBackgrounds, newFrameForegrounds, newFrameSymbols, searchFrom, starting, ending = indentationWidth, {}, {}, screen.getIndex(x, y), screen.getNewFrameTables()
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
|
|
||||||
local screen = require("Screen")
|
-- This's a copy-paste of orignal software from https://github.com/Maxu5/
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
local screen = require("Screen")
|
||||||
|
|
||||||
local starAmount, colors, copyright, braille1, braille2, braille3, braille4, braille5, braille6, braille7, braille8, braille9, braille10 =
|
local starAmount, colors, copyright, braille1, braille2, braille3, braille4, braille5, braille6, braille7, braille8, braille9, braille10 =
|
||||||
200,
|
200,
|
||||||
{
|
{
|
||||||
@ -28,19 +30,13 @@ local starAmount, colors, copyright, braille1, braille2, braille3, braille4, bra
|
|||||||
"⠁", "⠈", "⠂", "⠐", "⠄", "⠠", "⡀", "⢀", "⠛", "⣤"
|
"⠁", "⠈", "⠂", "⠐", "⠄", "⠠", "⡀", "⢀", "⠛", "⣤"
|
||||||
|
|
||||||
-- Faster access without tables indexing
|
-- Faster access without tables indexing
|
||||||
local computerPullSignal, tableRemove, mathSin, mathCos, mathRandom, screenDrawRectangle, screenSet, screenUpdate, screenGetIndex =
|
local computerPullSignal, tableRemove, mathSin, mathCos, mathRandom, screenUpdate =
|
||||||
computer.pullSignal,
|
computer.pullSignal,
|
||||||
table.remove,
|
table.remove,
|
||||||
math.sin,
|
math.sin,
|
||||||
math.cos,
|
math.cos,
|
||||||
math.random,
|
math.random,
|
||||||
screen.drawRectangle,
|
screen.update
|
||||||
screen.set,
|
|
||||||
screen.update,
|
|
||||||
screen.getIndex
|
|
||||||
|
|
||||||
-- Other variables, nil by default
|
|
||||||
local stars, i, star, rotationAngle, targetX, targetY, startWay, x, y, xmod, ymod, prevX, prevY, signalType, screenIndex, color = {}
|
|
||||||
|
|
||||||
-- Screen resolution in pixels
|
-- Screen resolution in pixels
|
||||||
local screenWidth, screenHeight = screen.getResolution()
|
local screenWidth, screenHeight = screen.getResolution()
|
||||||
@ -63,6 +59,9 @@ for i = 1, screenTablesLength do
|
|||||||
newFrameBackgrounds[i], newFrameForegrounds[i], newFrameSymbols[i] = 0x0, 0x0, " "
|
newFrameBackgrounds[i], newFrameForegrounds[i], newFrameSymbols[i] = 0x0, 0x0, " "
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Other variables, nil by default
|
||||||
|
local stars, i, star, rotationAngle, targetX, targetY, startWay, x, y, xmod, ymod, prevX, prevY, signalType, screenIndex, color = {}
|
||||||
|
|
||||||
-- Main loop
|
-- Main loop
|
||||||
while true do
|
while true do
|
||||||
-- Spawing stars
|
-- Spawing stars
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user