From c3be258da0a18187615197e6770ed4c6f512f5fb Mon Sep 17 00:00:00 2001 From: Jakub Sobon Date: Wed, 30 Dec 2020 00:59:39 -0500 Subject: [PATCH] Self-review. --- CHANGELOG.md | 2 +- widgets/button/formdemo/formdemo.go | 21 ++++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b0c39a7..f350786 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,7 +37,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 #### Text input form functionality with keyboard navigation -- added a new `formdemo` that demonstrates the text input form with keyboard +- added a new `formdemo` that demonstrates a text input form with keyboard navigation. #### Infrastructure changes diff --git a/widgets/button/formdemo/formdemo.go b/widgets/button/formdemo/formdemo.go index 5c29675..723318a 100644 --- a/widgets/button/formdemo/formdemo.go +++ b/widgets/button/formdemo/formdemo.go @@ -1,4 +1,4 @@ -// Copyright 2019 Google Inc. +// Copyright 2020 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -68,18 +68,25 @@ func buttonChunks(text string) []*button.TextChunk { } } -// form contains the elements of a text input form +// form contains the elements of a text input form. type form struct { + // userInput is a text input that accepts user name. userInput *textinput.TextInput - uidInput *textinput.TextInput - gidInput *textinput.TextInput + // uidInput is a text input that accepts UID. + uidInput *textinput.TextInput + // gidInput is a text input that accepts GID. + gidInput *textinput.TextInput + // homeInput is a text input that accepts path to the home folder. homeInput *textinput.TextInput - submitB *button.Button - cancelB *button.Button + + // submitB is a button that submits the form. + submitB *button.Button + // cancelB is a button that exist the application. + cancelB *button.Button } // newForm returns a new form instance. -// The cancel argument is a function that terminates Termdash when called. +// The cancel argument is a function that terminates the application when called. func newForm(cancel context.CancelFunc) (*form, error) { var username string u, err := user.Current()