Skip to content

[feature-request] [clang-format] Preserve the form feed character (^L, 0xC, \f) #113170

Closed
@Gleefre

Description

@Gleefre

The form feed character is often used to divide programs into logical blocks. When placed alone on a line, it acts as a logical page break, which can be used by text editors for efficient navigation and various display features. For example, Emacs has commands like narrow-to-page and forward-page / backward-page, and Vim also recognizes the ^L markers for navigation. Additionally, various IDE extensions provide similar functionality.

Although formfeeds are mostly used in lisp code, they also can be found in C/C++ code. Here's a quote from the GNU coding standards (gcc's code style):

Please use formfeed characters (control-L) to divide the program into pages at logical places (but not within a function). It does not matter just how long the pages are, since they do not have to fit on a printed page. The formfeeds should appear alone on lines by themselves.

Currently, clang-format removes form feed characters that appear alone on a line, and to my knowledge there is no option to disable this behavior. It would be great either if formfeeds were always preserved or if there was an configuration option to control that.

Metadata

Metadata

Assignees

Labels

clang-formatenhancementImproving things as opposed to bug fixing, e.g. new or missing feature

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions