Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit064750a

Browse files
committed
Improve indentation of multiline initialization expressions.
If a variable has an initialization expression that wraps onto thenext line(s), pg_bsd_indent will now indent the continuation linesone stop, instead of aligning them flush with the variable declaration.We've been holding off applying this until the last v16 CF finished,but now it's time.Thomas Munro and Tom LaneDiscussion:https://postgr.es/m/20230120013137.7ky7nl4e4zjorrfa@awork3.anarazel.de
1 parentbbec50d commit064750a

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

‎src/tools/pg_bsd_indent/args.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ static char sccsid[] = "@(#)args.c8.1 (Berkeley) 6/6/93";
5151
#include"indent_globs.h"
5252
#include"indent.h"
5353

54-
#defineINDENT_VERSION"2.1.1"
54+
#defineINDENT_VERSION"2.1.2"
5555

5656
/* profile types */
5757
#definePRO_SPECIAL1/* special case */

‎src/tools/pg_bsd_indent/io.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,12 @@ dump_line(void)
201201
ps.decl_on_line=ps.in_decl;/* if we are in the middle of a
202202
* declaration, remember that fact for
203203
* proper comment indentation */
204-
ps.ind_stmt=ps.in_stmt& ~ps.in_decl;/* next line should be
205-
* indented if we have not
206-
* completed this stmt and if
207-
* we are not in the middle of
208-
* a declaration */
204+
/* next line should be indented if we have not completed this stmt, and
205+
* either we are not in a declaration or we are in an initialization
206+
* assignment; but not if we're within braces in an initialization,
207+
* because that scenario is handled by other rules. */
208+
ps.ind_stmt=ps.in_stmt&&
209+
(!ps.in_decl|| (ps.block_init&&ps.block_init_level <=0));
209210
ps.use_ff= false;
210211
ps.dumped_decl_indent=0;
211212
*(e_lab=s_lab)='\0';/* reset buffers */

‎src/tools/pgindent/pgindent

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use IO::Handle;
1313
use Getopt::Long;
1414

1515
# Update for pg_bsd_indent version
16-
my$INDENT_VERSION ="2.1.1";
16+
my$INDENT_VERSION ="2.1.2";
1717

1818
# Our standard indent settings
1919
my$indent_opts =

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp