(put-text-property (point-min) (point-max) 'line-prefix " ")
(should (= (company--column) 2))))
-(ert-deftest company-modify-line-with-line-prefix ()
- (let ((str (propertize "foobar" 'line-prefix "-*-")))
+(ert-deftest company-plainify ()
+ (let ((tab-width 8))
+ (should (equal-including-properties
+ (company-plainify "\tabc\td\t")
+ (concat " "
+ "abc "
+ "d "))))
+ (should (equal-including-properties
+ (company-plainify (propertize "foobar" 'line-prefix "-*-"))
+ "-*-foobar")))
+
+(ert-deftest company-modify-line ()
+ (let ((str "-*-foobar"))
(should (equal-including-properties
(company-modify-line str "zz" 4)
"-*-fzzbar"))
- (should (equal-including-properties
- (company-modify-line str "zzxx" 1)
- "-zzxxobar"))
(should (equal-including-properties
(company-modify-line str "xx" 0)
"xx-foobar"))
(defsubst company-round-tab (arg)
(* (/ (+ arg tab-width) tab-width) tab-width))
-(defun company-untabify (str)
+(defun company-plainify (str)
+ (let ((prefix (get-text-property 0 'line-prefix str)))
+ (when prefix ; Keep the original value unmodified, for no special reason.
+ (setq str (concat prefix str))
+ (remove-text-properties 0 (length str) '(line-prefix) str)))
(let* ((pieces (split-string str "\t"))
(copy pieces))
(while (cdr copy)
(nreverse lines)))
(defun company-modify-line (old new offset)
- (let ((prefix (get-text-property 0 'line-prefix old)))
- (when prefix ; Keep the original value unmodified, for no special reason.
- (setq old (concat prefix old))
- (remove-text-properties 0 (length old) '(line-prefix) old)))
(concat (company-safe-substring old 0 offset)
new
(company-safe-substring old (+ offset (length new)))))
(move-to-window-line (+ row (abs height)))
(point)))
(ov (make-overlay beg end))
- (args (list (mapcar 'company-untabify
+ (args (list (mapcar 'company-plainify
(company-buffer-lines beg end))
column nl above)))