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))))
|
(ignore-errors (sp-get-thing))))
|
||||||
(op (plist-get context :op))
|
(op (plist-get context :op))
|
||||||
(cl (plist-get context :cl))
|
(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)
|
(cond ;; When in strings (sp acts weird with quotes; this is the fix)
|
||||||
;; Also, skip closing delimiters
|
;; Also, skip closing delimiters
|
||||||
((and op cl
|
((and op cl
|
||||||
|
@ -89,13 +89,9 @@ possible, or just one char if that's not possible."
|
||||||
(> tab-width 1)
|
(> tab-width 1)
|
||||||
(not (bolp))
|
(not (bolp))
|
||||||
(not (doom-point-in-string-p))
|
(not (doom-point-in-string-p))
|
||||||
(save-excursion (>= (- (skip-chars-backward " \t")) tab-width)))
|
(>= (abs (save-excursion (skip-chars-backward " \t")))
|
||||||
(let ((movement (% (current-column) tab-width)))
|
(setq current-column (current-column))))
|
||||||
(when (= movement 0)
|
(delete-char (- (1+ (% (1- current-column) tab-width)))))
|
||||||
(setq movement tab-width))
|
|
||||||
(delete-char (- movement)))
|
|
||||||
(unless (memq (char-before) (list ?\n ?\ ))
|
|
||||||
(insert " ")))
|
|
||||||
|
|
||||||
;; Otherwise do a regular delete
|
;; Otherwise do a regular delete
|
||||||
((delete-char -1)))))
|
((delete-char -1)))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue