diff --git a/.DS_Store b/.DS_Store index 354ec146..62a0e2ac 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/Applications.txt b/Applications.txt index 43f01b09..ee7f8ecb 100644 --- a/Applications.txt +++ b/Applications.txt @@ -517,7 +517,7 @@ icon="IgorTimofeev/OpenComputers/master/Applications/MineCodeIDE/Icon.pic", createShortcut="dock", forceDownload=true, - version=1.50, + version=1.51, resources={ { name="Localization/Russian.lang", diff --git a/Applications/.DS_Store b/Applications/.DS_Store index e28251d1..ba31b420 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 bf3528de..df66b7a2 100755 --- a/Applications/MineCodeIDE/MineCodeIDE.lua +++ b/Applications/MineCodeIDE/MineCodeIDE.lua @@ -377,15 +377,23 @@ local function isClickedOnCodeArea(x, y) end local function moveCursor(symbolOffset, lineOffset) - local newSymbol, newLine = cursor.position.symbol + symbolOffset, cursor.position.line + lineOffset - - if symbolOffset < 0 and newSymbol < 1 then - newLine, newSymbol = newLine - 1, math.huge - elseif symbolOffset > 0 and newSymbol > unicode.len(mainWindow.codeView.lines[newLine] or "") + 1 then - newLine, newSymbol = newLine + 1, 1 - end + if mainWindow.codeView.selections[1] then + if symbolOffset < 0 or lineOffset < 0 then + setCursorPositionAndClearSelection(mainWindow.codeView.selections[1].from.symbol, mainWindow.codeView.selections[1].from.line) + else + setCursorPositionAndClearSelection(mainWindow.codeView.selections[1].to.symbol, mainWindow.codeView.selections[1].to.line) + end + else + local newSymbol, newLine = cursor.position.symbol + symbolOffset, cursor.position.line + lineOffset + + if symbolOffset < 0 and newSymbol < 1 then + newLine, newSymbol = newLine - 1, math.huge + elseif symbolOffset > 0 and newSymbol > unicode.len(mainWindow.codeView.lines[newLine] or "") + 1 then + newLine, newSymbol = newLine + 1, 1 + end - setCursorPositionAndClearSelection(newSymbol, newLine) + setCursorPositionAndClearSelection(newSymbol, newLine) + end end local function setCursorPositionToHome()