diff options
author | Alan Mackenzie <acm@muc.de> | 2007-02-15 22:31:52 +0000 |
---|---|---|
committer | Alan Mackenzie <acm@muc.de> | 2007-02-15 22:31:52 +0000 |
commit | 94dd9d6dc94bcea09d78aedde0a02975be8d705f (patch) | |
tree | 8dcd5c5d93532275c19f21b0e73da2caf552b9dc /lisp/progmodes/cc-cmds.el | |
parent | 0535d51b4c2fd08dea93483d2daea7fd5f993941 (diff) | |
download | emacs-94dd9d6dc94bcea09d78aedde0a02975be8d705f.tar.gz |
(c-indent-new-comment-line): When splitting an empty one-line C-style
comment, post-position point properly.
Diffstat (limited to 'lisp/progmodes/cc-cmds.el')
-rw-r--r-- | lisp/progmodes/cc-cmds.el | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el index f8375d7fe36..4f9e1947738 100644 --- a/lisp/progmodes/cc-cmds.el +++ b/lisp/progmodes/cc-cmds.el @@ -4238,6 +4238,7 @@ If a fill prefix is specified, it overrides all the above." (c-collect-line-comments c-lit-limits)) c-lit-type))) (pos (point)) + (start-col (current-column)) (comment-text-end (or (and (eq c-lit-type 'c) (save-excursion @@ -4254,6 +4255,11 @@ If a fill prefix is specified, it overrides all the above." ;; ;; If point is on the 'B' then the line will be ;; broken after "Bla b". + ;; + ;; If we have an empty comment, /* */, the next + ;; lot of code pushes point to the */. We fix + ;; this by never allowing point to end up to the + ;; right of where it started. (while (and (< (current-column) (cdr fill)) (not (eolp))) (forward-char 1)) @@ -4276,7 +4282,10 @@ If a fill prefix is specified, it overrides all the above." ((< (point) (+ (car c-lit-limits) 2)) (goto-char (+ (car c-lit-limits) 2)))) (funcall do-line-break) - (insert-and-inherit (car fill)))) + (insert-and-inherit (car fill)) + (if (> (current-column) start-col) + (move-to-column start-col)))) ; can this hit the + ; middle of a TAB? ;; Inside a comment that should be broken. (let ((comment-start comment-start) (comment-end comment-end) |