You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -3207,6 +3207,13 @@ struct FormatStyle {
/// \version 3.7
// bool KeepEmptyLinesAtTheStartOfBlocks;
+ /// Keep the form feed character if it's immediately preceded and followed by
+ /// a newline. Multiple form feeds and newlines within a whitespace range are
+ /// replaced with a single newline and form feed followed by the remaining
+ /// newlines.
+ /// \version 20
+ bool KeepFormFeed;
+
/// Indentation logic for lambda bodies.
enum LambdaBodyIndentationKind : int8_t {
/// Align lambda body relative to the lambda signature. This is the default.
owenca
added a commit
to owenca/llvm-project
that referenced
this issue
Oct 22, 2024
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
andforward-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):
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.The text was updated successfully, but these errors were encountered: