Conversation
added 7 commits
April 21, 2026 11:33
phye
commented
Apr 23, 2026
|
|
||
| ;;;; ─── Hunk highlighting ───────────────────────────────────────────────────── | ||
|
|
||
| (defface code-review-minimal-hunk-added-face |
| :type 'boolean | ||
| :group 'code-review-minimal) | ||
|
|
||
| (defcustom code-review-minimal-highlight-hunks t |
Owner
Author
There was a problem hiding this comment.
Test comment 2 in code-review-minimal.el
| ;;; Code: | ||
|
|
||
| (require 'cl-lib) | ||
| (require 'code-review-minimal-faces) |
added 17 commits
April 23, 2026 08:49
diff --git a/code-review-minimal-diff.el b/code-review-minimal-diff.el index a80a956..71102d6 100644 --- a/code-review-minimal-diff.el +++ b/code-review-minimal-diff.el @@ -52,7 +52,7 @@ Each element of CHANGES is a plist with :old-path, :new-path, and :patch." "Format removed LINES as a display string. LINES is a list in push-order (most-recent first); the result is returned in original source order." - (mapconcat (lambda (l) (concat "- " l)) (nreverse lines) "\n")) + (mapconcat #'identity (nreverse lines) "\n")) (defun code-review-minimal--parse-patch (patch) "Parse unified diff PATCH string for a single file. @@ -159,7 +159,8 @@ ANCHOR is the new-file line number after which the removed lines should appear; (ov (make-overlay beg end))) (overlay-put ov 'before-string - (propertize "+ " + (propertize " " + 'display '((margin left-margin) "+") 'face 'code-review-minimal-hunk-added-face)) (overlay-put ov 'face 'code-review-minimal-hunk-added-face) (overlay-put ov 'code-review-minimal-hunk t) @@ -177,10 +178,19 @@ ANCHOR is the new-file line number after which the removed lines should appear; (let* ((pos (save-excursion (goto-char (point-min)) (point))) - (ov (make-overlay pos pos nil t nil))) + (ov (make-overlay pos pos nil t nil)) + (lines (split-string text "\n")) + (marked-text + (mapconcat + (lambda (l) + (concat (propertize " " + 'display '((margin left-margin) "-") + 'face 'code-review-minimal-hunk-removed-face) + " " l)) + lines "\n"))) (overlay-put ov 'before-string - (propertize (concat text "\n") + (propertize (concat marked-text "\n") 'face 'code-review-minimal-hunk-removed-face)) (overlay-put ov 'code-review-minimal-hunk t) (overlay-put ov 'evaporate t) @@ -192,10 +202,19 @@ ANCHOR is the new-file line number after which the removed lines should appear; (goto-char (point-min)) (forward-line (1- anchor)) (line-end-position))) - (ov (make-overlay pos pos nil t nil))) + (ov (make-overlay pos pos nil t nil)) + (lines (split-string text "\n")) + (marked-text + (mapconcat + (lambda (l) + (concat (propertize " " + 'display '((margin left-margin) "-") + 'face 'code-review-minimal-hunk-removed-face) + " " l)) + lines "\n"))) (overlay-put ov 'after-string - (propertize (concat "\n" text) + (propertize (concat "\n" marked-text) 'face 'code-review-minimal-hunk-removed-face)) (overlay-put ov 'code-review-minimal-hunk t) (overlay-put ov 'evaporate t) diff --git a/code-review-minimal.el b/code-review-minimal.el index 3a1c9ef..673f757 100644 --- a/code-review-minimal.el +++ b/code-review-minimal.el @@ -532,6 +532,10 @@ Commands: ;; review-url already refreshes overlays and handles the rest; bail out (setq code-review-minimal-mode nil) (cl-return-from nil)))) + ;; Set left margin for diff fringe indicators + (dolist (win (get-buffer-window-list (current-buffer) nil t)) + (let ((margins (window-margins win))) + (set-window-margins win 2 (cdr margins)))) ;; Refresh diff and comment overlays (code-review-minimal--refresh-overlays)) ;; Disable @@ -539,6 +543,9 @@ Commands: (code-review-minimal--clear-hunk-overlays) (when code-review-minimal--input-overlay (code-review-minimal--cancel-comment)) + (dolist (win (get-buffer-window-list (current-buffer) nil t)) + (let ((margins (window-margins win))) + (set-window-margins win 0 (cdr margins)))) (setq code-review-minimal--mr-iid nil code-review-minimal--mr-id nil code-review-minimal--project-info nil
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.