From 00537a0e67c54cfdfe1f73f166af13e2dcfb1783 Mon Sep 17 00:00:00 2001 From: Steven Hugg Date: Sun, 24 Jun 2018 13:39:08 -0400 Subject: [PATCH] marker for current breakpoint line --- doc/notes.txt | 6 +++--- src/ui.js | 33 +++++++++++++++++++++++++++------ 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/doc/notes.txt b/doc/notes.txt index e7985340..6faf84ee 100644 --- a/doc/notes.txt +++ b/doc/notes.txt @@ -16,13 +16,13 @@ TODO: - case sensisitvity looking for mismatch variables - remove pulldown when no preset? - can't step after reset (or when funky frame; TIA frame is out of sync) -- break on BRK/illegal opcode? +- break on BRK/illegal opcode? (or warnings?) - skeleton for each platform/tool (check?) - disassembler/debugger - multiple breakpoints, expression breakpoints - current exec. pos in gutter - cc65: parse listing -- faster Z80 compile -- projects w/ multiple files, navigation (need refactor UI) +- faster Z80 compile (maybe split up files?) +- projects w/ multiple files, navigation (need refactor UI, backend) - nes: tools (nesst, tiled) https://shiru.untergrund.net/software.shtml diff --git a/src/ui.js b/src/ui.js index dc45d105..0dff96de 100644 --- a/src/ui.js +++ b/src/ui.js @@ -582,13 +582,33 @@ worker.onmessage = function(e) { setCompileOutput(e.data); } -function setCurrentLine(line) { - editor.setSelection({line:line,ch:0}, {line:line-1,ch:0}, {scroll:true}); -} - +var currentDebugLine; var lastDebugInfo; var lastDebugState; +function setCurrentLine(line) { + function addCurrentMarker(line) { + var div = document.createElement("div"); + div.style.color = '#66ffff'; // TODO + div.appendChild(document.createTextNode("\u25b6")); + editor.setGutterMarker(line, "gutter-info", div); + } + clearCurrentLine(); + if (line>0) { + addCurrentMarker(line-1); + editor.setSelection({line:line,ch:0}, {line:line-1,ch:0}, {scroll:true}); + currentDebugLine = line; + } +} + +function clearCurrentLine() { + if (currentDebugLine) { + editor.clearGutter("gutter-info"); + editor.setSelection(editor.getCursor()); // TODO?? + currentDebugLine = 0; + } +} + function showMemory(state) { var s = state && platform.cpuStateToLongString && platform.cpuStateToLongString(state.c); if (s) { @@ -654,8 +674,9 @@ function _resume() { function resume() { clearBreakpoint(); - if (! platform.isRunning() ) - editor.setSelection(editor.getCursor()); // TODO?? + if (! platform.isRunning() ) { + clearCurrentLine(); + } _resume(); userPaused = false; }