c-family: fix whitespace trimming in comments

This commit is contained in:
Cormac Stephenson 2021-11-29 12:33:30 +00:00
parent c120063da9
commit ed9d99c7b3

View File

@ -151,6 +151,9 @@ define-command -hidden c-family-insert-on-newline %[ evaluate-commands -itersel
execute-keys d execute-keys d
] ]
] ]
# trim trailing whitespace on the previous line
try %[ execute-keys -draft k <a-x> s\h+$<ret> d ]
] ]
try %[ try %[
# if the previous line isn't within a comment scope, break # if the previous line isn't within a comment scope, break
@ -180,7 +183,7 @@ define-command -hidden c-family-insert-on-newline %[ evaluate-commands -itersel
] ]
# trim trailing whitespace on the previous line # trim trailing whitespace on the previous line
try %[ execute-keys -draft s\h+$<ret> d ] try %[ execute-keys -draft k <a-x> s\h+$<ret> d ]
# align the new star with the previous one # align the new star with the previous one
execute-keys K<a-x>1s^[^*]*(\*)<ret>& execute-keys K<a-x>1s^[^*]*(\*)<ret>&
] ]