"Return the line number corresponding to the location."
nil)
+(cl-defgeneric xref-location-column (_location)
+ "Return the exact column corresponding to the location."
+ nil)
+
(cl-defgeneric xref-match-length (_item)
"Return the length of the match."
nil)
(defclass xref-file-location (xref-location)
((file :type string :initarg :file)
(line :type fixnum :initarg :line :reader xref-location-line)
- (column :type fixnum :initarg :column :reader xref-file-location-column))
+ (column :type fixnum :initarg :column :reader xref-location-column))
:documentation "A file location is a file/line/column triple.
Line numbers start from 1 and columns from 0.")
" ")))
;; Render multiple matches on the same line, together.
(when (and line (equal prev-line-key line-key))
- (let ((column (xref-file-location-column location)))
+ (when-let ((column (xref-location-column location)))
(delete-region
(save-excursion
(forward-line -1)
(should (string-match-p "file1\\.txt\\'" (xref-location-group (nth 1 locs))))
(should (equal 1 (xref-location-line (nth 0 locs))))
(should (equal 1 (xref-location-line (nth 1 locs))))
- (should (equal 0 (xref-file-location-column (nth 0 locs))))
- (should (equal 4 (xref-file-location-column (nth 1 locs))))))
+ (should (equal 0 (xref-location-column (nth 0 locs))))
+ (should (equal 4 (xref-location-column (nth 1 locs))))))
(ert-deftest xref-matches-in-directory-finds-an-empty-line-regexp-match ()
(let* ((matches (xref-matches-in-directory "^$" "*" xref-tests-data-dir nil))
(should (= 1 (length matches)))
(should (string-match-p "file2\\.txt\\'" (xref-location-group (nth 0 locs))))
(should (equal 1 (xref-location-line (nth 0 locs))))
- (should (equal 0 (xref-file-location-column (nth 0 locs))))))
+ (should (equal 0 (xref-location-column (nth 0 locs))))))
(ert-deftest xref--buf-pairs-iterator-groups-markers-by-buffers-1 ()
(let* ((xrefs (xref-matches-in-directory "foo" "*" xref-tests-data-dir nil))