## Next
+* Pressing `backspace` in the search mode deletes the character at the end of
+ the search string.
* `company-semantic` displays function arguments as annotations.
* New user option, `company-bbdb-modes`.
* `company-show-numbers` and `company-complete-number` now use visual numbering
(defun company-search-printing-char ()
(interactive)
(company-search-assert-enabled)
- (let* ((ss (concat company-search-string (string last-command-event)))
- (pos (company-search ss (nthcdr company-selection company-candidates))))
+ (company-search--update-string (concat company-search-string
+ (string last-command-event))))
+
+(defun company-search--update-string (new)
+ (let* ((pos (company-search new (nthcdr company-selection company-candidates))))
(if (null pos)
(ding)
- (setq company-search-string ss
- company-search-lighter (concat " Search: \"" ss "\""))
+ (setq company-search-string new
+ company-search-lighter (concat " Search: \"" new "\""))
(company-set-selection (+ company-selection pos) t))))
(defun company-search-repeat-forward ()
(company-search-mode 0)
(company--unread-last-input))
+(defun company-search-delete-char ()
+ (interactive)
+ (company-search-assert-enabled)
+ (when (cl-plusp (length company-search-string))
+ (company-search--update-string (substring company-search-string 0 -1))))
+
(defvar company-search-map
(let ((i 0)
(keymap (make-keymap)))
(define-key keymap (vector meta-prefix-char t) 'company-search-other-char)
(define-key keymap "\e\e\e" 'company-search-other-char)
(define-key keymap [escape escape escape] 'company-search-other-char)
- (define-key keymap (kbd "DEL") 'company-search-other-char)
-
+ (define-key keymap (kbd "DEL") 'company-search-delete-char)
+ (define-key keymap [backspace] 'company-search-delete-char)
(define-key keymap "\C-g" 'company-search-abort)
(define-key keymap "\C-s" 'company-search-repeat-forward)
(define-key keymap "\C-r" 'company-search-repeat-backward)