cue/format: some tweaks

Always keep tabs used for indentation and explicitly
expand. This fixes some alignment issues.

This also prepares for having better eval output.

The default for single-element objects without
position information is now to not simplify.

Change-Id: I47546bce433cf99e2fc153540591cea51841b24c
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/2165
Reviewed-by: Marcel van Lohuizen <mpvl@google.com>
diff --git a/internal/protobuf/protobuf_test.go b/internal/protobuf/protobuf_test.go
index d75126d..e21a126 100644
--- a/internal/protobuf/protobuf_test.go
+++ b/internal/protobuf/protobuf_test.go
@@ -46,7 +46,7 @@
 			if f, err := Parse(filename, nil, c); err != nil {
 				fmt.Fprintln(out, err)
 			} else {
-				format.Node(out, f)
+				format.Node(out, f, format.Simplify())
 			}
 
 			wantFile := filepath.Join("testdata", filepath.Base(file)+".out.cue")
diff --git a/internal/protobuf/testdata/client_config.proto.out.cue b/internal/protobuf/testdata/client_config.proto.out.cue
index 880309e..efa1f40 100644
--- a/internal/protobuf/testdata/client_config.proto.out.cue
+++ b/internal/protobuf/testdata/client_config.proto.out.cue
@@ -52,8 +52,8 @@
 	"FAIL_CLOSE"
 
 NetworkFailPolicy_FailPolicy_value: {
-	"FAIL_OPEN":  0
-	"FAIL_CLOSE": 1
+	FAIL_OPEN:  0
+	FAIL_CLOSE: 1
 }
 
 //  Defines the per-service client configuration.
diff --git a/internal/protobuf/testdata/gateway.proto.out.cue b/internal/protobuf/testdata/gateway.proto.out.cue
index 14e4624..dc17a26 100644
--- a/internal/protobuf/testdata/gateway.proto.out.cue
+++ b/internal/protobuf/testdata/gateway.proto.out.cue
@@ -213,8 +213,8 @@
 	//  label search is restricted to the configuration namespace in which the
 	//  the resource is present. In other words, the Gateway resource must
 	//  reside in the same namespace as the gateway workload instance.
-	selector <_>: string
-	selector?: {<name>: name}
+	selector <_>:     string
+	selector? <name>: name
 }
 
 //  `Server` describes the properties of the proxy on a given load balancer
@@ -413,10 +413,10 @@
 	"AUTO_PASSTHROUGH"
 
 Server_TLSOptions_TLSmode_value: {
-	"PASSTHROUGH":      0
-	"SIMPLE":           1
-	"MUTUAL":           2
-	"AUTO_PASSTHROUGH": 3
+	PASSTHROUGH:      0
+	SIMPLE:           1
+	MUTUAL:           2
+	AUTO_PASSTHROUGH: 3
 }
 
 //  TLS protocol versions.
@@ -428,11 +428,11 @@
 	"TLSV1_3" //  TLS version 1.3
 
 Server_TLSOptions_TLSProtocol_value: {
-	"TLS_AUTO": 0
-	"TLSV1_0":  1
-	"TLSV1_1":  2
-	"TLSV1_2":  3
-	"TLSV1_3":  4
+	TLS_AUTO: 0
+	TLSV1_0:  1
+	TLSV1_1:  2
+	TLSV1_2:  3
+	TLSV1_3:  4
 }
 
 //  Port describes the properties of a specific port of a service.
diff --git a/internal/third_party/yaml/decode_test.go b/internal/third_party/yaml/decode_test.go
index 71cbf3c..d33e56c 100644
--- a/internal/third_party/yaml/decode_test.go
+++ b/internal/third_party/yaml/decode_test.go
@@ -209,7 +209,9 @@
 	// Structs
 	{
 		"a: {b: c}",
-		`a b: "c"`,
+		`a: {
+	b: "c"
+}`,
 	},
 	{
 		"hello: world",
@@ -231,7 +233,10 @@
 		"a: true",
 	}, {
 		"{ a: 1, b: {c: 1} }",
-		"a: 1\nb c: 1",
+		`a: 1
+b: {
+	c: 1
+}`,
 	},
 
 	// Some cross type conversions
@@ -396,7 +401,12 @@
 d: 2`,
 	}, {
 		"a: &a {c: 1}\nb: *a",
-		"a c: 1\nb c: 1",
+		`a: {
+	c: 1
+}
+b: {
+	c: 1
+}`,
 	}, {
 		"a: &a [1, 2]\nb: *a",
 		"a: [1, 2]\nb: [1, 2]", // TODO: a: [1, 2], b: a
@@ -449,7 +459,9 @@
 	// issue #295 (allow scalars with colons in flow mappings and sequences)
 	{
 		"a: {b: https://github.com/go-yaml/yaml}",
-		`a b: "https://github.com/go-yaml/yaml"`,
+		`a: {
+	b: "https://github.com/go-yaml/yaml"
+}`,
 	},
 	{
 		"a: [https://github.com/go-yaml/yaml]",
@@ -493,13 +505,19 @@
 a: 1
 d: 4
 c: 3
-sub e: 5`,
+sub: {
+	e: 5
+}`,
 	},
 
 	// Issue #39.
 	{
 		"a:\n b:\n  c: d\n",
-		`a b c: "d"`,
+		`a: {
+	b: {
+		c: "d"
+	}
+}`,
 	},
 
 	// Timestamps
diff --git a/internal/third_party/yaml/testdata/merge.out b/internal/third_party/yaml/testdata/merge.out
index e3edf5a..b8ed7a4 100644
--- a/internal/third_party/yaml/testdata/merge.out
+++ b/internal/third_party/yaml/testdata/merge.out
@@ -1,16 +1,18 @@
 // From http://yaml.org/type/merge.html
 // Test
-anchors list: [{
-	x: 1
-	y: 2
-}, {
-	x: 0
-	y: 2
-}, {
-	r: 10
-}, {
-	r: 1
-}]
+anchors: {
+	list: [{
+		x: 1
+		y: 2
+	}, {
+		x: 0
+		y: 2
+	}, {
+		r: 10
+	}, {
+		r: 1
+	}]
+}
 // All the following maps are equal:
 plain: {
 	// Explicit keys