Fix #4577: WS not at BOL is deleted to tab columns
Changes the behavior of doom/backward-delete-whitespace-to-column to only delete to the closest tab column if there is only whitespace between point and BOL. This coincides with what the comments state to be the original intent.
This commit is contained in:
parent
6d2c6b44fa
commit
6aa29e82ae
1 changed files with 5 additions and 6 deletions
|
@ -71,7 +71,7 @@ possible, or just one char if that's not possible."
|
|||
(ignore-errors (sp-get-thing))))
|
||||
(op (plist-get context :op))
|
||||
(cl (plist-get context :cl))
|
||||
open-len close-len)
|
||||
open-len close-len current-column)
|
||||
(cond ;; When in strings (sp acts weird with quotes; this is the fix)
|
||||
;; Also, skip closing delimiters
|
||||
((and op cl
|
||||
|
@ -89,13 +89,12 @@ possible, or just one char if that's not possible."
|
|||
(> tab-width 1)
|
||||
(not (bolp))
|
||||
(not (doom-point-in-string-p))
|
||||
(save-excursion (>= (- (skip-chars-backward " \t")) tab-width)))
|
||||
(let ((movement (% (current-column) tab-width)))
|
||||
(save-excursion (>= (- (skip-chars-backward " \t"))
|
||||
(setq current-column (current-column)))))
|
||||
(let ((movement (% current-column tab-width)))
|
||||
(when (= movement 0)
|
||||
(setq movement tab-width))
|
||||
(delete-char (- movement)))
|
||||
(unless (memq (char-before) (list ?\n ?\ ))
|
||||
(insert " ")))
|
||||
(delete-char (- movement))))
|
||||
|
||||
;; Otherwise do a regular delete
|
||||
((delete-char -1)))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue