瀏覽代碼

Fix overlay copy

master
10sr 6 年之前
父節點
當前提交
3663fa52f6
簽署人: 10sr GPG 金鑰 ID: 7BEC428194130EB2
共有 1 個檔案被更改,包括 18 行新增8 行删除
  1. +18
    -8
      emacs.el

+ 18
- 8
emacs.el 查看文件

@@ -2333,10 +2333,20 @@ TYPE is target object type."
(current-buffer))))))

(defun git-walktree--replace-into-buffer (target)
"Replace TARGET buffer contents with that of current buffer."
(let ((buf (current-buffer)))
"Replace TARGET buffer contents with that of current buffer.
It also copy text overlays."
(let ((src (current-buffer)))
(with-current-buffer target
(replace-buffer-contents buf))))
(replace-buffer-contents src)))

(let ((overlays (overlays-in (point-min) (point-max))))
(dolist (o overlays)
(let ((beg (overlay-start o))
(end (overlay-end o)))
(move-overlay (copy-overlay o)
beg
end
target)))))

(require 'ansi-color)
(defun git-walktree--open-treeish (commitish path treeish)
@@ -2359,6 +2369,8 @@ TYPE is target object type."
(cd git-walktree-repository-root)
(save-excursion
(let ((inhibit-read-only t))
;; Remove existing overlays generated by ansi-color-apply-on-region
(remove-overlays)
(with-temp-buffer
(if commitish
(progn (git-walktree--call-process nil
@@ -2370,6 +2382,8 @@ TYPE is target object type."
"--decorate"
"--stat"
commitish)
(ansi-color-apply-on-region (point-min)
(point))
(insert "\n")
(insert (format "Contents of '%s:%s':\n"
(git-walktree--commitish-fordisplay commitish)
@@ -2384,11 +2398,7 @@ TYPE is target object type."

treeish)
(git-walktree--replace-into-buffer buf))
;; Overlays won't be copied with replace-buffer-contents so do this
;; after copying contents
(remove-overlays)
(ansi-color-apply-on-region (point-min)
(point-max))))
))
(git-walktree-mode)
(set-buffer-modified-p nil)



Loading…
取消
儲存