Browse Source

Additional fix for #82

Make sure to delete the entire debugger overlay when the line has been split.
/cc @DamienCassou
workspaces
Nicolas Petton 4 years ago
parent
commit
f0e2e29410
2 changed files with 21 additions and 4 deletions
  1. +5
    -4
      indium-breakpoint.el
  2. +16
    -0
      test/unit/indium-breakpoint-test.el

+ 5
- 4
indium-breakpoint.el View File

@ -131,10 +131,11 @@ An icon is added to the left fringe."
(defun indium-breakpoint-remove-overlay ()
"Remove the breakpoint overlay from the current line."
(remove-overlays (point-at-bol)
(1+ (point-at-eol))
'indium-breakpoint-ov
t))
(let ((ov (indium-breakpoint-overlay-on-current-line)))
(remove-overlays (overlay-start ov)
(overlay-end ov)
'indium-breakpoint-ov
t)))
(defun indium-breakpoint--fringe-icon ()
"Return the fringe icon used for breakpoints."


+ 16
- 0
test/unit/indium-breakpoint-test.el View File

@ -47,6 +47,22 @@
(open-line 1)
(forward-line)
(indium-breakpoint-remove-overlay)
(let ((overlays (seq-find (lambda (ov)
(overlay-get ov 'indium-breakpoint-ov))
(overlays-in (point-min) (point-max)))))
(expect overlays :to-equal nil)))))
(it "should not add a brk on the next line when the line is split "
;; When inserting a line before, deleting a breakpoint resulted in an
;; overlay being added on the next line when the line where the breakpoint
;; was added had been split.
(with-js2-buffer "let a = true;"
(let ((ov (indium-breakpoint--ensure-overlay)))
;; add a line before the current line with the breakpoint overlay
(goto-char 5)
(newline)
(forward-line -1)
(indium-breakpoint-remove-overlay)
(let ((overlays (seq-find (lambda (ov)
(overlay-get ov 'indium-breakpoint-ov))
(overlays-in (point-min) (point-max)))))


Loading…
Cancel
Save