Browse Source

Fix breakpoints location when editing a buffer (fix #82)

workspaces
Nicolas Petton 4 years ago
parent
commit
b48a7551a7
Signed by: nico GPG Key ID: 233587A47C207910
2 changed files with 28 additions and 1 deletions
  1. +1
    -1
      indium-breakpoint.el
  2. +27
    -0
      test/unit/indium-breakpoint-test.el

+ 1
- 1
indium-breakpoint.el View File

@ -152,7 +152,7 @@ If no overlay is present, return nil."
"Return the breakpoint overlay on the current line.
If there is no overlay, make one."
(or (indium-breakpoint-overlay-on-current-line)
(let ((ov (make-overlay (point-at-bol) (point-at-eol))))
(let ((ov (make-overlay (point-at-bol) (point-at-eol) nil t)))
(overlay-put ov 'indium-breakpoint-ov t)
ov)))


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

@ -23,8 +23,35 @@
(require 'buttercup)
(require 'assess)
(require 'seq)
(require 'indium-breakpoint)
(describe "Breakpoint position when editing buffers (GH issue #82)"
(it "should keep the breakpoint on the original line when adding a line before"
(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 (point-min))
(open-line 1)
(forward-line)
(expect (overlay-start ov) :to-equal (point-at-bol))
(expect (overlay-end ov) :to-equal (point-at-eol)))))
(it "should not add a brk on the next line"
;; When inserting a line before, deleting a breakpoint resulted in an
;; overlay being added on the next line.
(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 (point-min))
(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))))))
(describe "Making markers (tests for issue #79)"
(it "should put breakpoint overlays on the entire line"
(with-js2-buffer "let a = true;"


Loading…
Cancel
Save