Showing 2 changed files with 14 additions and 3 deletions
+13 -3
Nasal/knobs.nas
... ...
@@ -133,6 +133,7 @@ var knobsClass = {
133 133
         # id: the id of the window
134 134
         var (id, selected) = split('-', me.device.windows.selected);
135 135
         var state = me.device.windows.state[id];
136
+        d *= state.scroll.rows;
136 137
         selected += state.scroll.offset;
137 138
         # foreach object, beginning at the selected object, offset applied
138 139
         for (var i = selected + d; i >= 0 and i < size(state.objects); i += d) {
... ...
@@ -166,9 +167,11 @@ var knobsClass = {
166 167
     },
167 168
 
168 169
     _navigatemenu_scrolldown : func (state, id, i) {
169
-        state.scroll.upper = state.objects[i].scrollgroup - state.scroll.lines + 1;
170
+        state.scroll.upper = state.objects[i].scrollgroup - state.scroll.lines + state.scroll.rows;
170 171
         state.scroll.lower = state.objects[i].scrollgroup;
171 172
         state.scroll.offset = state.scroll.upper * state.scroll.columns;
173
+        if (state.scroll.rows > 1 and i - state.scroll.offset > state.scroll.lines * state.scroll.columns * state.scroll.rows)
174
+            state.scroll.offset = i - state.scroll.lines * state.scroll.columns * state.scroll.rows;
172 175
 
173 176
         # foreach canvas object in the scrolling area
174 177
         for (var l = state.scroll.begin; l <= state.scroll.end; l += 1) {
... ...
@@ -180,8 +183,15 @@ var knobsClass = {
180 183
 
181 184
     _navigatemenu_scrollup : func (state, id, i) {
182 185
         state.scroll.upper = state.objects[i].scrollgroup;
183
-        state.scroll.lower = state.objects[i].scrollgroup + state.scroll.lines - 1;
184
-        state.scroll.offset = state.scroll.upper * state.scroll.columns;
186
+        state.scroll.lower = state.objects[i].scrollgroup + state.scroll.lines - state.scroll.rows;
187
+        state.scroll.offset = state.scroll.upper * state.scroll.columns * state.scroll.rows;
188
+        if (state.scroll.rows > 1 and i == state.scroll.offset) {
189
+            state.scroll.offset -= state.scroll.columns * state.scroll.rows;
190
+            if (state.scroll.offset < state.scroll.begin) {
191
+                state.scroll.offset = state.scroll.begin;
192
+                return;
193
+            }
194
+        }
185 195
 
186 196
         # foreach canvas object in the scrolling area
187 197
         for (var l = state.scroll.begin; l <= state.scroll.end; l += 1) {
+1
Nasal/menu.nas
... ...
@@ -90,6 +90,7 @@ var pageClass = {
90 90
             lower: 9999,          # group printed at the bottom of the scrolling area
91 91
             lines : scroll != nil ? scroll.lines : 0, # number of lines for the scrolling area
92 92
             columns : scroll != nil ? scroll.columns : 0, # number of objects on each scrolling lines
93
+            rows : scroll != nil and contains(scroll, 'rows') ? scroll.rows : 1,
93 94
         };
94 95
         var scrollgroup = {};
95 96
         forindex (var line; state.objects) {