Document changes submitted by Andreas Bieber

This commit is contained in:
Trevor Slocum 2020-09-23 15:44:28 -07:00
parent 1cfb3711cf
commit 5505bb7a58
4 changed files with 16 additions and 12 deletions

View File

@ -1,5 +1,12 @@
v1.5.0 (WIP)
- Add scroll bar to TextView
- Add focus-driven style options
- Add InputField autocomplete style options
- Add arrow symbol to DropDown
- Add Makefile
- Revamp FormItem styling as FormItem.SetAttributes
- Provide DropDownOption in DropDown handlers
- Provide ListItem in List handlers
v1.4.9 (2020-09-08)
- Add InputField.GetCursorPosition and InputField.SetCursorPosition

View File

@ -28,7 +28,7 @@ func main() {
entries = append(entries, cview.NewListItem(word))
}
}
if len(entries) <= 1 {
if len(entries) == 0 {
entries = nil
}
return

View File

@ -61,8 +61,8 @@ func NewFlex() *Flex {
// GetDirection returns the direction in which the contained primitives are
// distributed. This can be either FlexColumn (default) or FlexRow.
func (f *Flex) GetDirection() int {
f.l.RLock()
defer f.l.RUnlock()
f.RLock()
defer f.RUnlock()
return f.direction
}

View File

@ -510,11 +510,12 @@ func (i *InputField) Autocomplete() *InputField {
// autocompleteChanged gets called when another item in the
// autocomplete list has been selected.
func (i *InputField) autocompleteChanged(_ int, item *ListItem) {
if referenceVal, isString := item.reference.(string); isString {
i.autocompleteListSuggestion = referenceVal[len(i.text):]
} else {
i.autocompleteListSuggestion = item.mainText[len(i.text):]
if len(i.text) >= len(item.mainText) {
i.autocompleteListSuggestion = ""
return
}
i.autocompleteListSuggestion = item.mainText[len(i.text):]
}
// SetAcceptanceFunc sets a handler which may reject the last character that was
@ -857,11 +858,7 @@ func (i *InputField) InputHandler() func(event *tcell.EventKey, setFocus func(p
if i.autocompleteList != nil {
currentItem := i.autocompleteList.GetCurrentItem()
i.Unlock()
if referenceVal, isString := currentItem.reference.(string); isString {
i.SetText(referenceVal)
} else {
i.SetText(currentItem.mainText)
}
i.SetText(currentItem.mainText)
i.Lock()
i.autocompleteList = nil
i.autocompleteListSuggestion = ""