Merge pull request #5044 from Janfel/fix-delete-whitespace-to-column
Fix #4577: WS not at BOL is deleted to tab columns
This commit is contained in:
commit
4c6418fcf7
1 changed files with 4 additions and 8 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,9 @@ 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)))
|
||||
(when (= movement 0)
|
||||
(setq movement tab-width))
|
||||
(delete-char (- movement)))
|
||||
(unless (memq (char-before) (list ?\n ?\ ))
|
||||
(insert " ")))
|
||||
(>= (abs (save-excursion (skip-chars-backward " \t")))
|
||||
(setq current-column (current-column))))
|
||||
(delete-char (- (1+ (% (1- current-column) tab-width)))))
|
||||
|
||||
;; Otherwise do a regular delete
|
||||
((delete-char -1)))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue