Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions client.el/client.el
Original file line number Diff line number Diff line change
Expand Up @@ -959,9 +959,12 @@ Returns the line number, or nil if not found."

;; Hunk header
((string-prefix-p "@@ " line)
(when (not first-hunk-seen)
(setq first-hunk-seen t)
(setq current-position 0)))
(if (not first-hunk-seen)
(progn
(setq first-hunk-seen t)
(setq current-position 0))
;; Count subsequent hunk headers to match GitHub's position convention
(setq current-position (1+ current-position))))

;; Skip comment blocks
((string-match-p "^[[:space:]]*[│┌└]" line)
Expand Down Expand Up @@ -1586,11 +1589,16 @@ If on a local comment, local-comment-id and local-comment-body will be set."
(goto-char (point-min))
(forward-line (1- first-hunk-line-num))
(let ((count 0)
(file-line nil))
(file-line nil)
(first-hunk-counted nil))
(while (<= (line-number-at-pos) target-line)
(let ((line-content (buffer-substring-no-properties (line-beginning-position) (line-end-position))))
(cond
((string-match "^@@ -[0-9]+,[0-9]+ \\+\\([0-9]+\\),[0-9]+ @@" line-content)
(if (not first-hunk-counted)
(setq first-hunk-counted t)
;; Count subsequent hunk headers to match GitHub's position convention
(setq count (1+ count)))
(setq file-line (string-to-number (match-string 1 line-content)))
(setq target-file-line file-line))
((string-match-p "^[[:cntrl:][:space:]]*[│┌└]" line-content)
Expand Down
11 changes: 11 additions & 0 deletions client.el/test.el
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ https://github.com/C-Hipple/diff-lsp/pull/5

(crs-shutdown-server)

(clear-buffer-by-name "*crs-client stderr")

(defun hurr()
(interactive)
Expand All @@ -34,3 +35,13 @@ https://github.com/C-Hipple/diff-lsp/pull/5
(when (string-match-p "^\\* Review" (buffer-name buffer))
(kill-buffer buffer)))
(crs-restart-server))


(defun clear-buffer-by-name (buffer-name)
"Clear the contents of the buffer named BUFFER-NAME."
(interactive)
(let ((buf (get-buffer buffer-name)))
(if buf
(with-current-buffer buf
(erase-buffer))
(message "Buffer '%s' not found." buffer-name))))
Loading