aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-08-30 01:58:15 +0000
committerBlaž Hrastnik2021-08-30 02:07:59 +0000
commit2c7b75475f9534ca330cccea4778a3878fed6b4c (patch)
tree4cab34a9a54bd86b816b14ce8832cf42158a44bd /helix-term/src/ui
parent986828e75c17662da39505c7190220b8c352bc8a (diff)
dap: refactor frame handling
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r--helix-term/src/ui/editor.rs31
1 files changed, 18 insertions, 13 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs
index bb183b3a..e13eb323 100644
--- a/helix-term/src/ui/editor.rs
+++ b/helix-term/src/ui/editor.rs
@@ -446,12 +446,16 @@ impl EditorView {
.map(|range| range.cursor_line(text))
.collect();
- let mut breakpoints: Option<Vec<SourceBreakpoint>> = None;
- let mut stack_pointer: Option<StackFrame> = None;
+ let mut breakpoints: Option<&Vec<SourceBreakpoint>> = None;
+ let mut stack_frame: Option<&StackFrame> = None;
if let Some(debugger) = debugger {
if let Some(path) = doc.path() {
- breakpoints = debugger.breakpoints.get(path).cloned();
- stack_pointer = debugger.stack_pointer.clone()
+ breakpoints = debugger.breakpoints.get(path);
+
+ if let (Some(frame), Some(thread_id)) = (debugger.active_frame, debugger.thread_id)
+ {
+ stack_frame = debugger.stack_frames[&thread_id].get(frame); // TODO: drop the clone..
+ };
}
}
@@ -477,23 +481,24 @@ impl EditorView {
if let Some(bps) = breakpoints.as_ref() {
if let Some(breakpoint) = bps.iter().find(|breakpoint| breakpoint.line - 1 == line)
{
- if breakpoint.condition.is_some() {
- surface.set_stringn(viewport.x, viewport.y + i as u16, "▲", 1, error);
+ let style = if breakpoint.condition.is_some() {
+ error
} else if breakpoint.log_message.is_some() {
- surface.set_stringn(viewport.x, viewport.y + i as u16, "▲", 1, info);
+ info
} else {
- surface.set_stringn(viewport.x, viewport.y + i as u16, "▲", 1, warning);
- }
+ warning
+ };
+ surface.set_stringn(viewport.x, viewport.y + i as u16, "▲", 1, style);
}
}
- if let Some(sp) = stack_pointer.as_ref() {
- if let Some(src) = sp.source.as_ref() {
+ if let Some(frame) = stack_frame {
+ if let Some(src) = &frame.source {
if doc
.path()
- .map(|path| src.path == Some(path.clone()))
+ .map(|path| src.path.as_ref() == Some(path))
.unwrap_or(false)
- && sp.line - 1 == line
+ && frame.line - 1 == line
{
surface.set_style(
Rect::new(viewport.x, viewport.y + i as u16, 6, 1),