Browse Source

Document changes submitted by Andreas Bieber

tablepad
Trevor Slocum 2 years ago
parent
commit
5505bb7a58
  1. 7
      CHANGELOG
  2. 2
      demos/inputfield/autocomplete/main.go
  3. 4
      flex.go
  4. 15
      inputfield.go

7
CHANGELOG

@ -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

2
demos/inputfield/autocomplete/main.go

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

4
flex.go

@ -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
}

15
inputfield.go

@ -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 = ""

Loading…
Cancel
Save