Skip to content

Commit cd4dcfe

Browse files
adding some tests of the editor
1 parent a37fdd6 commit cd4dcfe

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

playground/internal/editor/editor.go

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,23 @@ func (ce *codeEditor) handleTab(shift, ctrl bool) bool {
7979
}
8080

8181
if shift {
82-
// Handle Shift+Tab for un-indenting the current line.
83-
// TODO(grantnelson-wf): Implement
84-
println("TODO: Handle un-indenting selected lines")
82+
ce.removeIndents(startLine, endLine)
8583
return true
8684
}
85+
ce.addIndents(startLine, endLine)
86+
return true
87+
}
8788

88-
// Handle indenting selected line(s).
89+
// addIndents adds indents to the non-blank lines in the selection.
90+
func (ce *codeEditor) addIndents(startLine, endLine int) {
8991
// TODO(grantnelson-wf): Implement
90-
println("TODO: Handle indenting selected lines")
91-
return true
92+
println("TODO: addIndents(", startLine, ", ", endLine, ")")
93+
}
94+
95+
// removeIndents handles un-indenting the non-blank lines in the selection.
96+
func (ce *codeEditor) removeIndents(startLine, endLine int) {
97+
// TODO(grantnelson-wf): Implement
98+
println("TODO: removeIndents(", startLine, ", ", endLine, ")")
9299
}
93100

94101
func (ce *codeEditor) handleMultilineComment(shift, ctrl bool) bool {

0 commit comments

Comments
 (0)