Permalink
Browse files

added support of setting popup lists position (and its underlying sel…

…ect list's position)
  • Loading branch information...
1 parent 07301a5 commit a632bc80e3b3bc60303097edb05430bf2cec10da megaannum committed Sep 25, 2012
Showing with 32 additions and 5 deletions.
  1. +28 −4 autoload/forms.vim
  2. +4 −1 doc/forms.txt
View
@@ -6,7 +6,7 @@
" Summary: Vim Form Library
" Author: Richard Emberson <richard.n.embersonATgmailDOTcom>
" Last Modified: 08/30/2012
-" Version: 1.8
+" Version: 1.9
" Modifications:
" 1.0 : initial public release.
"
@@ -5413,7 +5413,10 @@ endif
call self.flash()
else
let self.__pos += 1
- call forms#ViewerRedrawListAdd(self)
+ if self.__mode == 'mandatory_on_move_single'
+ call self.handleSelection()
+ endif
+ call forms#ViewerRedrawListAdd(self)
endif
let handled = 1
@@ -5453,6 +5456,7 @@ endif
let handled = 1
elseif c == "\<CR>" || c == "\<Space>"
+"call forms#logforce("g:forms#SelectList.handleChar: <CR>")
call self.handleSelection()
let handled = 1
endif
@@ -5701,8 +5705,6 @@ endif
let [idx, sid] = selections[0]
call ClearSelectionId(sid)
- " seems to work with pos, needed for colorschemer
- let idx = pos
if idx >= min_idx && idx < max_idx
let sid = GetSelectionId({
\ 'line': a.line+idx-win_start,
@@ -5932,6 +5934,28 @@ function! forms#loadPopDownListPrototype()
endfunction
let g:forms#PopDownList.handleChar = function("FORMS_POP_DOWN_LIST_handleChar")
+ function! FORMS_POP_DOWN_LIST_setSelectionPos(pos) dict
+ let pos = a:pos
+ let nchoices = len(self.__choices)
+ if pos >= 0 && pos <= nchoices-1 && pos != self.__pos
+ let self.__pos = pos
+ let slist = self.__slist
+ let slist.__pos = pos
+ call slist.adjustWinStart()
+
+ let [idx, sid] = slist.__selections[0]
+ if idx != pos
+ call ClearSelectionId(sid)
+ let slist.__selections = [[pos, -1]]
+ endif
+
+ call self.__on_selection_action.execute(pos)
+ call forms#ViewerRedrawListAdd(self)
+
+ endif
+ endfunction
+ let g:forms#PopDownList.setSelectionPos = function("FORMS_POP_DOWN_LIST_setSelectionPos")
+
function! FORMS_POP_DOWN_LIST_handleSelection() dict
let pos = self.__pos
let a = self.__allocation
View
@@ -1,7 +1,7 @@
*forms.txt* For Vim version 7.3 Last change: 2012 July 19
Author: Richard Emberson
-Version: 1.8
+Version: 1.9
Title: Forms Library
Homepage: TODO
@@ -1058,6 +1058,9 @@ and popup menus. The code is located in 'autoload/forms/menu.vim'.
==============================================================================
12. Release notes *forms-release-notes*
+1.9 - Fix: ~
+ Added method to PopupList to support setting its postion (and the
+ underlying selectlist's position.
1.8 - Fix: ~
Added arrow drawing ASCII and UTF-8 characters
The glyph highlighting methods now have guards to make sure that

0 comments on commit a632bc8

Please sign in to comment.