mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
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:
@ -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)))))
|
||||
|
Reference in New Issue
Block a user