diff --git a/autoload/forms.vim b/autoload/forms.vim index 765ba81..c0a9dc5 100644 --- a/autoload/forms.vim +++ b/autoload/forms.vim @@ -6,7 +6,7 @@ " Summary: Vim Form Library " Author: Richard Emberson " Last Modified: 2012 -" Version: 1.18 +" Version: 1.20 " Modifications: " 1.0 : initial public release. " @@ -59,12 +59,12 @@ if &cp || ( exists("g:loaded_forms") && ! g:self#IN_DEVELOPMENT_MODE ) finish endif -let g:loaded_forms = 'v1.19' +let g:loaded_forms = 'v1.20' let s:keepcpo = &cpo set cpo&vim function! forms#version() - return '1.19' + return '1.20' endfunction " ++++++++++++++++++++++++++++++++++++++++++++ @@ -3229,6 +3229,23 @@ function! forms#loadLabelPrototype() let g:forms#Label = forms#loadLeafPrototype().clone('forms#Label') let g:forms#Label.__text = '' + function! FORMS_LABEL_init(attrs) dict + call call(g:forms#Leaf.init, [a:attrs], self) + + let text = self.__text + if type(text) == g:self#NUMBER_TYPE + unlet self.__text + let self.__text = "" . text + elseif type(text) == g:self#STRING_TYPE + " do nothing + else + throw "forms#loadLabelPrototype.init: text parameter must be String or Number: " . string(text) + endif + + return self + endfunction + let g:forms#Label.init = function("FORMS_LABEL_init") + function! FORMS_LABEL_reinit(attrs) dict " call forms#log("forms#Label.reinit TOP") let oldText = self.__text @@ -5364,6 +5381,17 @@ endif endfunction let g:forms#SelectList.requestedSize = function("FORMS_SELECT_LIST_requestedSize") + function! FORMS_SELECT_LIST_hide() dict + call call(g:forms#Leaf.hide, [], self) + + let selections = self.__selections + for selection in selections + let [idx, sid] = selection + call ClearSelectionId(sid) + endfor + endfunction + let g:forms#SelectList.hide = function("FORMS_SELECT_LIST_hide") + function! FORMS_SELECT_LIST_selection() dict return self.__pos endfunction @@ -11751,7 +11779,7 @@ endif endif endif if l:winWidth < formWidth || ! x_success - let textlines = "Form too big for current window width.\n Window width=".l:winWidth."\n Form width=" . formWidth."\nSuggest making window wider by ".(formHeight-l:winHeigth+1)." columns." + let textlines = "Form too big for current window width.\n Window width=".l:winWidth."\n Form width=" . formWidth."\nSuggest making window wider by ".(formWidth-l:winWidth+1)." columns." if s:handling_form_too_big_info == 1 throw textlines @@ -12909,6 +12937,7 @@ function! forms#loadDeckPrototype() let g:forms#Deck.getCard = function("FORMS_DECK_getCard") function! FORMS_DECK_setCard(card) dict +"call forms#logforce("g:forms#Deck.setCard card=". a:card) if a:card < 0 throw "Deck.setCard: card less than 0 " . card elseif a:card >= len(self.__children) @@ -12920,10 +12949,6 @@ function! forms#loadDeckPrototype() call child.hide() let self.__card = a:card - if exists("self.__textblock") -" call forms#log("g:forms#Deck.setCard add textblock") - call forms#ViewerRedrawListAdd(self.__textblock) - endif call forms#ViewerRedrawListAdd(self) endif endfunction @@ -12951,7 +12976,7 @@ function! forms#loadDeckPrototype() let g:forms#Deck.requestedSize = function("FORMS_DECK_requestedSize") function! FORMS_DECK_draw(allocation) dict -" call forms#log("g:forms#Deck.draw" . string(a:allocation)) +"call forms#logforce("g:forms#Deck.draw" . string(a:allocation)) let self.__allocation = a:allocation let a = a:allocation @@ -12964,27 +12989,14 @@ function! forms#loadDeckPrototype() let valignment = self.__valignment let char = '' - " Must capture background in a TextBlock - " Why? 1) Cards have different sizes and - " 2) So that when only the deck has changed (and a redraw() - " rather than a full top down draw is called) its background - " as well as itself can be put on the Viewer ReDraw list - if ! exists("self.__textblock") - let fulllines = getline(line, line+height-1) - let textblock = [] - for fline in fulllines - " let pline = fline[column-1 : column+width-2] - " let pline = fline[column : column+width-2] - let pline = fline[column : column+width-1] -" call forms#log("g:forms#Deck.draw pline=" . pline . "END") - call add(textblock, pline) - endfor - let attrs = { - \ 'textblock': textblock, - \ 'allocation': copy(a:allocation) - \ } - let self.__textblock = forms#newTextBlock(attrs) - endif + + " clear the deck + let str = repeat(' ', width) + let cnt = 0 + while cnt < height + call forms#SetStringAt(str, line+cnt, column) + let cnt += 1 + endwhile let card = self.__card " call forms#log("g:forms#Deck.draw card=" . card) diff --git a/doc/forms.txt b/doc/forms.txt index 4f8911d..e835111 100644 --- a/doc/forms.txt +++ b/doc/forms.txt @@ -1,7 +1,7 @@ *forms.txt* For Vim version 7.3 Last change: 2012 Oct 9 Author: Richard Emberson -Version: 1.19 +Version: 1.20 Title: Forms Library Homepage: TODO @@ -618,6 +618,12 @@ designed to interact with the user (i.e., accept user input). Similar to Text but all lines must be the same length. SelectList ~ A list of selections. + ForestViewer ~ + View one or more Trees. A Tree is a hierarchy of Nodes. + Can be used by itself or with a companion NodeViewer. + NodeViewer ~ + View a given Node. + Can be used by itself or with a companion ForestViewer. PopDownList ~ A pop down list of selections in a menu. HSlider ~ @@ -1056,6 +1062,11 @@ and popup menus. The code is located in 'autoload/forms/menu.vim'. ============================================================================== 12. Release notes *forms-release-notes* +1.20 - Fix: ~ + Forms Label checks that 'text' is String or Number. + Add 'hide' method to SelectList to clear selection item highlight. + Fixed 'Form too big' width message. + Removed Deck __textblock and simply space-out deck prior to each draw. 1.19 - Fix: ~ Added NodeViewer (node viewer). Added ForestViewer/NodeViewer demo.