@@ -7,8 +7,8 @@ return {
local love2d = ide.config.path.love2d
or wx.wxFileName(self:fprojdir(wfilename)):GetPath(wx.wxPATH_GET_VOLUME)
.. '/love'
local cmd = string.gsub(love2d, "\\","/") .. ' "' .. self:fprojdir(wfilename) .. '"'
.. (rundebug and ' -debug' or '')
local cmd = ('"%s" "%s"%s'):format(string.gsub(love2d, "\\","/"),
self:fprojdir(wfilename), rundebug and ' -debug' or '')
-- CommandLineRun(cmd,wdir,tooutput,nohide,stringcallback,uid,endcallback)
return CommandLineRun(cmd,self:fworkdir(wfilename),true,false,nil,nil,
function() ide.debugger.pid = nil end)
@@ -1,12 +1,12 @@
--
-- MobDebug 0.467
-- MobDebug 0.471
-- Copyright 2011-12 Paul Kulchenko
-- Based on RemDebug 1.0 Copyright Kepler Project 2005
--

local mobdebug = {
_NAME = "mobdebug",
_VERSION = 0.467,
_VERSION = 0.471,
_COPYRIGHT = "Paul Kulchenko",
_DESCRIPTION = "Mobile Remote Debugger for the Lua programming language",
port = 8171
@@ -980,7 +980,8 @@ local function handle(params, client)
else
local file = io.open(exp, "r")
if not file then print("Cannot open file " .. exp); return end
local lines = file:read("*all")
-- read the file and remove the shebang line as it causes a compilation error
local lines = file:read("*all"):gsub("^#!.-\n", "\n")
file:close()

local file = string.gsub(exp, "\\", "/") -- convert slash
@@ -398,7 +398,10 @@ function ClearAllCurrentLineMarkers()
end

function CompileProgram(editor, quiet)
local editorText = editor:GetText()
-- remove shebang line (#!) as it throws a compilation error as
-- loadstring() doesn't allow it even though lua/loadfile accepts it.
-- replace with a new line to keep the number of lines the same.
local editorText = editor:GetText():gsub("^#!.-\n", "\n")
local id = editor:GetId()
local filePath = DebuggerMakeFileName(editor, openDocuments[id].filePath)
local _, errMsg, line_num = wxlua.CompileLuaScript(editorText, filePath)
@@ -496,7 +499,8 @@ function ShowFullScreen(setFullScreen)

uimgr:GetPane("toolBar"):Show(not setFullScreen)
uimgr:Update()
frame:ShowFullScreen(setFullScreen)
-- protect from systems that don't have ShowFullScreen (GTK on linux?)
pcall(function() frame:ShowFullScreen(setFullScreen) end)
end

function CloseWindow(event)
@@ -514,9 +518,9 @@ function CloseWindow(event)
SettingsSaveView()
SettingsSaveFramePosition(ide.frame, "MainFrame")
SettingsSaveEditorSettings()
DebuggerCloseWatchWindow()
DebuggerCloseStackWindow()
DebuggerShutdown()
if DebuggerCloseWatchWindow then DebuggerCloseWatchWindow() end
if DebuggerCloseStackWindow then DebuggerCloseStackWindow() end
if DebuggerShutdown then DebuggerShutdown() end
ide.settings:delete() -- always delete the config
event:Skip()
end
@@ -205,6 +205,7 @@ debugger.shell = function(expression, isstatement)
local _, values, err = debugger.evaluate(expression)
if not forceexpression and err and
(err:find("'<eof>' expected near '") or
err:find("'%(' expected near") or
err:find("unexpected symbol near '")) then
_, values, err = debugger.execute(expression)
addedret = false
@@ -427,6 +428,17 @@ end
debugger.breakpoint = function(file, line, state)
debugger.handleAsync((state and "setb " or "delb ") .. file .. " " .. line)
end
debugger.quickeval = function(var, callback)
if debugger.server and not debugger.running then
copas.addthread(function ()
local _, values, err = debugger.evaluate(var)
local val = err
and err:gsub("%[.-%]:%d+:%s*","error: ")
or (var .. " = " .. (#values > 0 and values[1] or 'nil'))
if callback then callback(val) end
end)
end
end

----------------------------------------------
-- public api
@@ -692,7 +704,8 @@ function DebuggerRefreshScratchpad()
else
local clear = ide.frame.menuBar:IsChecked(ID_CLEAROUTPUT)
local scratchpadEditor = debugger.scratchpad.editor
local code = scratchpadEditor:GetText()
-- take editor text and remove shebang line
local code = scratchpadEditor:GetText():gsub("^#!.-\n", "\n")
local filePath = DebuggerMakeFileName(scratchpadEditor,
ide.openDocuments[scratchpadEditor:GetId()].filePath)

@@ -53,6 +53,7 @@ ID_BREAK = NewID()
ID_TRACE = NewID()
ID_VIEWCALLSTACK = NewID()
ID_VIEWWATCHWINDOW = NewID()
ID_FULLSCREEN = NewID()
ID_CLEAROUTPUT = NewID()
ID_PROJECTDIR = NewID()
ID_INTERPRETER = NewID()
@@ -144,7 +144,9 @@ function MarkupStyle(editor, lines, linee)
if (f) then
local p = ls+f+off
local s = bit.band(editor:GetStyleAt(p), 31)
if iscomment[s] then
-- only style comments and only those that are not at the beginning
-- of the file to avoid styling shebang (#!) lines
if iscomment[s] and p > 0 then
local smark = #mark
local emark = #mark -- assumes end mark is the same length as start mark
if mark == MD_MARK_HEAD then
@@ -93,22 +93,38 @@ frame:Connect(ID "edit.cleardynamics", wx.wxEVT_COMMAND_MENU_SELECTED,
frame:Connect(ID "edit.showtooltip", wx.wxEVT_COMMAND_MENU_SELECTED,
function (event)
local editor = GetEditor()

if (editor:CallTipActive()) then
editor:CallTipCancel()
return
end

local pos = editor:GetCurrentPos()
local line = editor:GetCurrentLine()
local linetx = editor:GetLine(line)
local linestart = editor:PositionFromLine(line)
local localpos = pos-linestart

local ident = "([a-zA-Z_0-9][a-zA-Z_0-9%.%:]*)"
local linetxtopos = linetx:sub(1,localpos)
linetxtopos = linetxtopos..")"
linetxtopos = linetxtopos:match("([a-zA-Z_0-9%.%:]+)%b()$")
linetxtopos = linetxtopos:match(ident .. "%b()$")

local tip = linetxtopos and GetTipInfo(editor,linetxtopos.."(",false)
if tip then
if(editor:CallTipActive()) then
editor:CallTipCancel()
editor:CallTipShow(pos, tip)
else
-- check if we have a selected text or an identifier
-- for an identifier, check fragments on the left and on the right.
-- this is to match 'io' in 'i^o.print' and 'io.print' in 'io.pr^int'
local left = linetx:sub(1,localpos):match(ident.."$")
local right = linetx:sub(localpos+1,#linetx):match("^[a-zA-Z_0-9]*")
local var = editor:GetSelectionStart() ~= editor:GetSelectionEnd()
and editor:GetSelectedText()
or left and left..right or nil
if var and ide.debugger then
ide.debugger.quickeval(var, function(val) editor:CallTipShow(pos, val) end)
end
editor:CallTipShow(pos,tip)
end
end)

@@ -7,7 +7,6 @@ local ide = ide
local frame = ide.frame
local menuBar = frame.menuBar
local openDocuments = ide.openDocuments
local debugger = ide.debugger

local fileMenu = wx.wxMenu({
{ ID_NEW, "&New\tCtrl-N", "Create an empty document" },
@@ -6,9 +6,7 @@ local frame = ide.frame
local menuBar = frame.menuBar
local uimgr = frame.uimgr

local debugger = ide.debugger

local viewMenu = wx.wxMenu{
local viewMenu = wx.wxMenu {
-- NYI { ID "view.preferences", "&Preferences...", "Brings up dialog for settings (TODO)" },
-- NYI { },
{ ID "view.filetree.show", "Project/&FileTree Window\tCtrl-Shift-P", "View the project/filetree window" },
@@ -17,7 +15,7 @@ local viewMenu = wx.wxMenu{
{ ID_VIEWCALLSTACK, "&Stack Window\tCtrl-Shift-S", "View the Stack window" },
{ },
{ ID "view.defaultlayout", "&Default Layout", "Reset to default layout"},
{ ID "view.fullscreen", "Full &Screen\tCtrl-Shift-A", "Switch to or from full screen mode"},
{ ID_FULLSCREEN, "Full &Screen\tCtrl-Shift-A", "Switch to or from full screen mode"},
{ ID "view.style.loadconfig", "&Load Config Style...", "Load and apply style from config file (must contain .styles)"},
}
menuBar:Append(viewMenu, "&View")
@@ -47,8 +45,9 @@ frame:Connect(ID "view.filetree.show", wx.wxEVT_COMMAND_MENU_SELECTED,
uimgr:Update()
end)

frame:Connect(ID "view.fullscreen", wx.wxEVT_COMMAND_MENU_SELECTED,
function (event) ShowFullScreen(not frame:IsFullScreen()) end)
frame:Connect(ID_FULLSCREEN, wx.wxEVT_COMMAND_MENU_SELECTED, function ()
pcall(function() ShowFullScreen(not frame:IsFullScreen()) end)
end)

frame:Connect(ID_VIEWWATCHWINDOW, wx.wxEVT_COMMAND_MENU_SELECTED,
function (event) DebuggerCreateWatchWindow() end)
@@ -25,10 +25,9 @@ errorlog:SetReadOnly(true)
StylesApplyToEditor(ide.config.stylesoutshell,errorlog,ide.ofont,ide.ofontItalic)

function ClearOutput()
local current = errorlog:GetReadOnly()
errorlog:SetReadOnly(false)
errorlog:ClearAll()
errorlog:SetReadOnly(current)
errorlog:SetReadOnly(true)
end

function DisplayOutputNoMarker(...)
@@ -217,7 +216,6 @@ local function getStreams()
(getInputLine() > -1 or errorlog:GetReadOnly()) then
ActivateOutput()
updateInputMarker()
errorlog:SetFocus()
end
pfn = pfn and pfn()
end
@@ -254,6 +254,7 @@ local function executeShellCode(tx)
fn, err = loadstring("return "..tx)
if not forceexpression and err and
(err:find("'<eof>' expected near '") or
err:find("'%(' expected near") or
err:find("unexpected symbol near '")) then
fn, err = loadstring(tx)
addedret = false