rbcurse-core 0.0.13 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +10 -0
- data/VERSION +1 -1
- data/lib/rbcurse.rb +1 -1
- data/lib/rbcurse/core/include/bordertitle.rb +3 -1
- data/lib/rbcurse/core/include/chunk.rb +182 -180
- data/lib/rbcurse/core/include/io.rb +445 -443
- data/lib/rbcurse/core/include/listscrollable.rb +257 -254
- data/lib/rbcurse/core/include/vieditable.rb +153 -151
- data/lib/rbcurse/core/system/colormap.rb +146 -143
- data/lib/rbcurse/core/system/ncurses.rb +1 -1
- data/lib/rbcurse/core/util/ansiparser.rb +95 -93
- data/lib/rbcurse/core/util/colorparser.rb +58 -56
- data/lib/rbcurse/core/util/padreader.rb +151 -149
- data/lib/rbcurse/core/widgets/rlist.rb +6 -2
- data/lib/rbcurse/core/widgets/rtabbedwindow.rb +47 -45
- data/lib/rbcurse/core/widgets/textpad.rb +27 -18
- data/rbcurse-core.gemspec +2 -2
- metadata +2 -2
@@ -7,147 +7,148 @@
|
|
7
7
|
# @toprow : set to 0 for starters, top row to be displayed
|
8
8
|
# @pcol (used for horiz scrolling, starts at 0)
|
9
9
|
#
|
10
|
-
module
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
bounds_check
|
44
|
-
end
|
45
|
-
alias :goto_end :goto_bottom
|
46
|
-
def goto_top
|
47
|
-
@oldrow = @current_index
|
48
|
-
@current_index = 0
|
49
|
-
bounds_check
|
50
|
-
end
|
51
|
-
alias :goto_start :goto_top
|
52
|
-
def scroll_backward
|
53
|
-
@oldrow = @current_index
|
54
|
-
h = scrollatrow()
|
55
|
-
m = $multiplier == 0? 1 : $multiplier
|
56
|
-
@current_index -= h * m
|
57
|
-
bounds_check
|
58
|
-
$multiplier = 0
|
59
|
-
end
|
60
|
-
def scroll_forward
|
61
|
-
@oldrow = @current_index
|
62
|
-
h = scrollatrow()
|
63
|
-
rc = row_count
|
64
|
-
m = $multiplier == 0? 1 : $multiplier
|
65
|
-
# more rows than box
|
66
|
-
if h * m < rc
|
67
|
-
# next 2 lines were preventing widget_scrolled from being set to true,
|
68
|
-
# so i've modified it slightly as per scroll_down 2011-11-1
|
69
|
-
#@toprow += h+1 #if @current_index+h < rc
|
70
|
-
#@current_index = @toprow
|
71
|
-
@current_index += h+1
|
72
|
-
else
|
73
|
-
# fewer rows than box
|
10
|
+
module RubyCurses
|
11
|
+
module ListScrollable
|
12
|
+
attr_reader :search_found_ix, :find_offset, :find_offset1
|
13
|
+
attr_accessor :show_caret # 2010-01-23 23:06 our own fake insertion point
|
14
|
+
def previous_row num=(($multiplier.nil? or $multiplier == 0) ? 1 : $multiplier)
|
15
|
+
#return :UNHANDLED if @current_index == 0 # EVIL
|
16
|
+
return :NO_PREVIOUS_ROW if @current_index == 0
|
17
|
+
@oldrow = @current_index
|
18
|
+
# NOTE that putting a multiplier inside, prevents an event from being triggered for each row's
|
19
|
+
# on leave and on enter
|
20
|
+
num.times {
|
21
|
+
@current_index -= 1 if @current_index > 0
|
22
|
+
}
|
23
|
+
bounds_check
|
24
|
+
$multiplier = 0
|
25
|
+
end
|
26
|
+
alias :up :previous_row
|
27
|
+
def next_row num=(($multiplier.nil? or $multiplier == 0) ? 1 : $multiplier)
|
28
|
+
rc = row_count
|
29
|
+
# returning unhandled was clever .. when user hits down arrow on last row the focus goes to
|
30
|
+
# next field. however, in long lists when user scrolls the sudden jumping to next is very annoying.
|
31
|
+
# In combos, if focus was on last row, the combo closed which is not accceptable.
|
32
|
+
#return :UNHANDLED if @current_index == rc-1 # EVIL !!!
|
33
|
+
return :NO_NEXT_ROW if @current_index == rc-1 # changed 2011-10-5 so process can do something
|
34
|
+
@oldrow = @current_index
|
35
|
+
@current_index += 1*num if @current_index < rc
|
36
|
+
bounds_check
|
37
|
+
$multiplier = 0
|
38
|
+
end
|
39
|
+
alias :down :next_row
|
40
|
+
def goto_bottom
|
41
|
+
@oldrow = @current_index
|
42
|
+
rc = row_count
|
74
43
|
@current_index = rc -1
|
44
|
+
bounds_check
|
45
|
+
end
|
46
|
+
alias :goto_end :goto_bottom
|
47
|
+
def goto_top
|
48
|
+
@oldrow = @current_index
|
49
|
+
@current_index = 0
|
50
|
+
bounds_check
|
51
|
+
end
|
52
|
+
alias :goto_start :goto_top
|
53
|
+
def scroll_backward
|
54
|
+
@oldrow = @current_index
|
55
|
+
h = scrollatrow()
|
56
|
+
m = $multiplier == 0? 1 : $multiplier
|
57
|
+
@current_index -= h * m
|
58
|
+
bounds_check
|
59
|
+
$multiplier = 0
|
60
|
+
end
|
61
|
+
def scroll_forward
|
62
|
+
@oldrow = @current_index
|
63
|
+
h = scrollatrow()
|
64
|
+
rc = row_count
|
65
|
+
m = $multiplier == 0? 1 : $multiplier
|
66
|
+
# more rows than box
|
67
|
+
if h * m < rc
|
68
|
+
# next 2 lines were preventing widget_scrolled from being set to true,
|
69
|
+
# so i've modified it slightly as per scroll_down 2011-11-1
|
70
|
+
#@toprow += h+1 #if @current_index+h < rc
|
71
|
+
#@current_index = @toprow
|
72
|
+
@current_index += h+1
|
73
|
+
else
|
74
|
+
# fewer rows than box
|
75
|
+
@current_index = rc -1
|
76
|
+
end
|
77
|
+
#@current_index += h+1 #if @current_index+h < rc
|
78
|
+
bounds_check
|
75
79
|
end
|
76
|
-
#@current_index += h+1 #if @current_index+h < rc
|
77
|
-
bounds_check
|
78
|
-
end
|
79
80
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
81
|
+
##
|
82
|
+
# please set oldrow before calling this. Store current_index as oldrow before changing. NOTE
|
83
|
+
def bounds_check
|
84
|
+
h = scrollatrow()
|
85
|
+
rc = row_count
|
86
|
+
@old_toprow = @toprow
|
86
87
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
@row_changed = false
|
104
|
-
if @oldrow != @current_index
|
105
|
-
on_leave_row @oldrow if respond_to? :on_leave_row # to be defined by widget that has included this
|
106
|
-
on_enter_row @current_index if respond_to? :on_enter_row # to be defined by widget that has included this
|
107
|
-
set_form_row
|
108
|
-
@row_changed = true
|
109
|
-
end
|
110
|
-
#set_form_row # 2011-10-13
|
88
|
+
@_header_adjustment ||= 0
|
89
|
+
@current_index = 0 if @current_index < 0 # not lt 0
|
90
|
+
@current_index = rc-1 if @current_index >= rc && rc>0 # not gt rowcount
|
91
|
+
@toprow = rc-h-1 if rc > h && @toprow > rc - h - 1 # toprow shows full page if possible
|
92
|
+
# curr has gone below table, move toprow forward
|
93
|
+
if @current_index - @toprow > h
|
94
|
+
@toprow = @current_index - h
|
95
|
+
elsif @current_index < @toprow
|
96
|
+
# curr has gone above table, move toprow up
|
97
|
+
# sometimes current row gets hidden below header line
|
98
|
+
@toprow = @current_index - (@_header_adjustment ||0)
|
99
|
+
# prev line can make top row -1, however, if we are going back, lets
|
100
|
+
# put it at start of page, so first or second row is not hidden
|
101
|
+
@toprow = 0 if @toprow < h
|
102
|
+
end
|
111
103
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
@rows_panned ||= 0
|
121
|
-
|
122
|
-
win_row = 0 # 2010-02-07 21:44 now ext offset added by widget
|
104
|
+
@row_changed = false
|
105
|
+
if @oldrow != @current_index
|
106
|
+
on_leave_row @oldrow if respond_to? :on_leave_row # to be defined by widget that has included this
|
107
|
+
on_enter_row @current_index if respond_to? :on_enter_row # to be defined by widget that has included this
|
108
|
+
set_form_row
|
109
|
+
@row_changed = true
|
110
|
+
end
|
111
|
+
#set_form_row # 2011-10-13
|
123
112
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
@current_index = @toprow # ??? only if toprow 2010-10-19 12:56
|
113
|
+
if @old_toprow != @toprow # only if scrolling has happened should we repaint
|
114
|
+
@repaint_required = true #if @old_toprow != @toprow # only if scrolling has happened should we repaint
|
115
|
+
@widget_scrolled = true
|
116
|
+
end
|
129
117
|
end
|
118
|
+
# the cursor should be appropriately positioned
|
119
|
+
def set_form_row
|
120
|
+
r,c = rowcol
|
121
|
+
@rows_panned ||= 0
|
130
122
|
|
131
|
-
|
132
|
-
|
133
|
-
|
123
|
+
win_row = 0 # 2010-02-07 21:44 now ext offset added by widget
|
124
|
+
|
125
|
+
# when the toprow is set externally then cursor can be mispositioned since
|
126
|
+
# bounds_check has not been called
|
127
|
+
if @current_index < @toprow
|
128
|
+
# cursor is outside table
|
129
|
+
@current_index = @toprow # ??? only if toprow 2010-10-19 12:56
|
130
|
+
end
|
131
|
+
|
132
|
+
row = win_row + r + (@current_index-@toprow) + @rows_panned
|
133
|
+
#$log.debug " #{@name} set_form_row #{row} = ci #{@current_index} + r #{r} + winrow: #{win_row} - tr:#{@toprow} #{@toprow} + rowsp #{@rows_panned} "
|
134
|
+
# row should not be < r or greater than r+height TODO FIXME
|
134
135
|
|
135
|
-
|
136
|
-
|
137
|
-
setrowcol row, nil
|
138
|
-
#show_caret_func
|
139
|
-
end
|
140
|
-
## In many situations like placing a textarea or textview inside a splitpane
|
141
|
-
##+ or scrollpane there have been issues getting the cursor at the right point,
|
142
|
-
##+ since there are multiple buffers. Finally in tabbedpanes, i am pretty
|
143
|
-
##+ lost getting the correct position, and i feel we should set the cursor
|
144
|
-
##+ internally once and for all. So here's an attempt
|
145
136
|
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
137
|
+
|
138
|
+
setrowcol row, nil
|
139
|
+
#show_caret_func
|
140
|
+
end
|
141
|
+
## In many situations like placing a textarea or textview inside a splitpane
|
142
|
+
##+ or scrollpane there have been issues getting the cursor at the right point,
|
143
|
+
##+ since there are multiple buffers. Finally in tabbedpanes, i am pretty
|
144
|
+
##+ lost getting the correct position, and i feel we should set the cursor
|
145
|
+
##+ internally once and for all. So here's an attempt
|
146
|
+
|
147
|
+
# paint the cursor ourselves on the widget, rather than rely on getting to the top window with
|
148
|
+
# the correct coordinates. I do need to erase cursor too. Can be dicey, but is worth the attempt.
|
149
|
+
# This works perfectly, except for when placed in a Tabbedpane since that prints the form with a row offset
|
150
|
+
#+ of 2 and the widget does not know of the offset. cursor gets it correct since the form has an add_row.
|
151
|
+
def show_caret_func
|
151
152
|
return unless @show_caret
|
152
153
|
# trying highlighting cursor 2010-01-23 19:07 TABBEDPANE TRYING
|
153
154
|
# TODO take into account rows_panned etc ? I don't think so.
|
@@ -164,107 +165,107 @@ module ListScrollable
|
|
164
165
|
|
165
166
|
$log.debug " #{@name} printing CARET at #{yy},#{xx}: fwt:- #{@win_top} r:#{@row} tr:-#{@toprow}+ci:#{@current_index},+r #{r} "
|
166
167
|
if !@oldcursorrow.nil?
|
167
|
-
|
168
|
+
@graphic.mvchgat(y=@oldcursorrow, x=@oldcursorcol, 1, Ncurses::A_NORMAL, $datacolor, NIL)
|
168
169
|
end
|
169
170
|
@oldcursorrow = yy
|
170
171
|
@oldcursorcol = xx
|
171
172
|
@graphic.mvchgat(y=yy, x=xx, 1, Ncurses::A_NORMAL, $reversecolor, nil)
|
172
173
|
@buffer_modified = true
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
end
|
188
|
-
@repaint_required = true
|
189
|
-
end
|
190
|
-
def scroll_left
|
191
|
-
hscrollcols = $multiplier > 0 ? $multiplier : @width/2
|
192
|
-
@pcol -= hscrollcols if @pcol > 0
|
193
|
-
@pcol = 0 if @pcol < 0
|
194
|
-
@repaint_required = true
|
195
|
-
end
|
196
|
-
## returns cursor to last row (if moving columns in same row, won't work)
|
197
|
-
# Useful after a large move such as 12j, 20 C-n etc, Mapped to '' in textview
|
198
|
-
def goto_last_position
|
199
|
-
return unless @oldrow
|
200
|
-
@current_index = @oldrow
|
201
|
-
bounds_check
|
202
|
-
end
|
203
|
-
# not that saving content_rows is buggy since we add rows.
|
204
|
-
##
|
205
|
-
# caution, this now uses winrow not prow
|
206
|
-
## for user to know which row is being focussed on
|
207
|
-
def focussed_index
|
208
|
-
@current_index # 2009-01-07 14:35
|
209
|
-
end
|
210
|
-
# only to be used in single selection cases as focussed item FIXME.
|
211
|
-
# best not to use, as can be implementation dep, use current_index
|
212
|
-
def selected_item
|
213
|
-
get_content()[focussed_index()]
|
214
|
-
end
|
215
|
-
#alias :current_index :focussed_index
|
216
|
-
alias :selected_index :focussed_index
|
217
|
-
|
218
|
-
# finds the next match for the char pressed
|
219
|
-
# returning the index
|
220
|
-
# If we are only checking first char, then why chomp ?
|
221
|
-
# Please note that this is used now by tree, and list can have non-strings, so use to_s
|
222
|
-
def next_match char
|
223
|
-
data = get_content
|
224
|
-
row = focussed_index + 1
|
225
|
-
row.upto(data.length-1) do |ix|
|
226
|
-
#val = data[ix].chomp rescue return # 2010-01-05 15:28 crashed on trueclass
|
227
|
-
val = data[ix].to_s rescue return # 2010-01-05 15:28 crashed on trueclass
|
228
|
-
#if val[0,1] == char #and val != currval
|
229
|
-
if val[0,1].casecmp(char) == 0 #AND VAL != CURRval
|
230
|
-
return ix
|
174
|
+
end
|
175
|
+
def scroll_right
|
176
|
+
$log.debug " inside scroll_right "
|
177
|
+
hscrollcols = $multiplier > 0 ? $multiplier : @width/2
|
178
|
+
#hscrollcols = $multiplier > 0 ? $multiplier : 1 # for testing out
|
179
|
+
$log.debug " scroll_right mult:#{$multiplier} , hscrollcols #{hscrollcols}, pcol #{@pcol} w: #{@width} ll:#{@longest_line} "
|
180
|
+
#blen = @buffer.rstrip.length
|
181
|
+
blen = @longest_line
|
182
|
+
if @pcol + @width < blen
|
183
|
+
@pcol += hscrollcols if @pcol + @width < blen
|
184
|
+
else
|
185
|
+
# due to some change somewhere, sometimes width = longest which is not true
|
186
|
+
hscrollcols = $multiplier > 0 ? $multiplier : 1
|
187
|
+
@pcol += hscrollcols
|
231
188
|
end
|
189
|
+
@repaint_required = true
|
190
|
+
end
|
191
|
+
def scroll_left
|
192
|
+
hscrollcols = $multiplier > 0 ? $multiplier : @width/2
|
193
|
+
@pcol -= hscrollcols if @pcol > 0
|
194
|
+
@pcol = 0 if @pcol < 0
|
195
|
+
@repaint_required = true
|
196
|
+
end
|
197
|
+
## returns cursor to last row (if moving columns in same row, won't work)
|
198
|
+
# Useful after a large move such as 12j, 20 C-n etc, Mapped to '' in textview
|
199
|
+
def goto_last_position
|
200
|
+
return unless @oldrow
|
201
|
+
@current_index = @oldrow
|
202
|
+
bounds_check
|
232
203
|
end
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
204
|
+
# not that saving content_rows is buggy since we add rows.
|
205
|
+
##
|
206
|
+
# caution, this now uses winrow not prow
|
207
|
+
## for user to know which row is being focussed on
|
208
|
+
def focussed_index
|
209
|
+
@current_index # 2009-01-07 14:35
|
210
|
+
end
|
211
|
+
# only to be used in single selection cases as focussed item FIXME.
|
212
|
+
# best not to use, as can be implementation dep, use current_index
|
213
|
+
def selected_item
|
214
|
+
get_content()[focussed_index()]
|
215
|
+
end
|
216
|
+
#alias :current_index :focussed_index
|
217
|
+
alias :selected_index :focussed_index
|
218
|
+
|
219
|
+
# finds the next match for the char pressed
|
220
|
+
# returning the index
|
221
|
+
# If we are only checking first char, then why chomp ?
|
222
|
+
# Please note that this is used now by tree, and list can have non-strings, so use to_s
|
223
|
+
def next_match char
|
224
|
+
data = get_content
|
225
|
+
row = focussed_index + 1
|
226
|
+
row.upto(data.length-1) do |ix|
|
227
|
+
#val = data[ix].chomp rescue return # 2010-01-05 15:28 crashed on trueclass
|
228
|
+
val = data[ix].to_s rescue return # 2010-01-05 15:28 crashed on trueclass
|
229
|
+
#if val[0,1] == char #and val != currval
|
230
|
+
if val[0,1].casecmp(char) == 0 #AND VAL != CURRval
|
231
|
+
return ix
|
232
|
+
end
|
240
233
|
end
|
234
|
+
row = focussed_index - 1
|
235
|
+
0.upto(row) do |ix|
|
236
|
+
#val = data[ix].chomp
|
237
|
+
val = data[ix].to_s
|
238
|
+
#if val[0,1] == char #and val != currval
|
239
|
+
if val[0,1].casecmp(char) == 0 #and val != currval
|
240
|
+
return ix
|
241
|
+
end
|
242
|
+
end
|
243
|
+
return -1
|
244
|
+
end
|
245
|
+
## 2008-12-18 18:03
|
246
|
+
# sets the selection to the next row starting with char
|
247
|
+
def set_selection_for_char char
|
248
|
+
@oldrow = @current_index
|
249
|
+
@last_regex = "^#{char}"
|
250
|
+
ix = next_match char
|
251
|
+
@current_index = ix if ix && ix != -1
|
252
|
+
@search_found_ix = @current_index
|
253
|
+
bounds_check
|
254
|
+
return ix
|
241
255
|
end
|
242
|
-
return -1
|
243
|
-
end
|
244
|
-
## 2008-12-18 18:03
|
245
|
-
# sets the selection to the next row starting with char
|
246
|
-
def set_selection_for_char char
|
247
|
-
@oldrow = @current_index
|
248
|
-
@last_regex = "^#{char}"
|
249
|
-
ix = next_match char
|
250
|
-
@current_index = ix if ix && ix != -1
|
251
|
-
@search_found_ix = @current_index
|
252
|
-
bounds_check
|
253
|
-
return ix
|
254
|
-
end
|
255
256
|
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
257
|
+
##
|
258
|
+
# ensures that the given row is focussed
|
259
|
+
# new version of older one that was not perfect.
|
260
|
+
# 2009-01-17 13:25
|
261
|
+
def set_focus_on arow
|
262
|
+
@oldrow = @current_index
|
263
|
+
# the next line fixed cursor positioning, but when wraparound then it messed up
|
264
|
+
# matching line would get hidden
|
265
|
+
@current_index = arow
|
266
|
+
bounds_check if @oldrow != @current_index
|
267
|
+
end
|
268
|
+
##
|
268
269
|
def install_keys
|
269
270
|
=begin
|
270
271
|
@KEY_ASK_FIND_FORWARD ||= ?\M-f.getbyte(0)
|
@@ -385,30 +386,30 @@ module ListScrollable
|
|
385
386
|
alert("No previous search. Search first.")
|
386
387
|
return
|
387
388
|
end
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
389
|
+
ix = _find_next
|
390
|
+
regex = @last_regex
|
391
|
+
if ix.nil?
|
392
|
+
alert("No more matching data for: #{regex}")
|
393
|
+
else
|
394
|
+
set_focus_on(ix)
|
395
|
+
set_form_col @find_offset1
|
395
396
|
@cell_editor.component.curpos = (@find_offset||0) if @cell_editing_allowed
|
396
|
-
|
397
|
+
end
|
397
398
|
end
|
398
399
|
def find_prev
|
399
400
|
unless @last_regex
|
400
401
|
alert("No previous search. Search first.")
|
401
402
|
return
|
402
403
|
end
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
404
|
+
ix = _find_prev
|
405
|
+
regex = @last_regex
|
406
|
+
if ix.nil?
|
407
|
+
alert("No previous matching data for: #{regex}")
|
408
|
+
else
|
409
|
+
set_focus_on(ix)
|
410
|
+
set_form_col @find_offset
|
411
|
+
@cell_editor.component.curpos = (@find_offset||0) if @cell_editing_allowed
|
412
|
+
end
|
412
413
|
end
|
413
414
|
##
|
414
415
|
# find backwards
|
@@ -419,22 +420,22 @@ module ListScrollable
|
|
419
420
|
warn "No previous search" and return if regex.nil?
|
420
421
|
#$log.debug " _find_prev #{@search_found_ix} : #{@current_index}"
|
421
422
|
if start != 0
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
423
|
+
start -= 1 unless start == 0
|
424
|
+
@last_regex = regex
|
425
|
+
@search_start_ix = start
|
426
|
+
regex = Regexp.new(regex, Regexp::IGNORECASE) if @search_case
|
427
|
+
start.downto(0) do |ix|
|
428
|
+
row = @list[ix].to_s
|
429
|
+
m=row.match(regex)
|
430
|
+
if !m.nil?
|
431
|
+
@find_offset = m.offset(0)[0]
|
432
|
+
@find_offset1 = m.offset(0)[1]
|
433
|
+
ix += (@_header_adjustment || 0)
|
434
|
+
@search_found_ix = ix
|
435
|
+
return ix
|
436
|
+
end
|
435
437
|
end
|
436
438
|
end
|
437
|
-
end
|
438
439
|
fend = start-1
|
439
440
|
start = @list.size-1
|
440
441
|
if @search_wrap
|
@@ -642,6 +643,7 @@ module ListScrollable
|
|
642
643
|
ix = @current_index
|
643
644
|
return if is_row_selected ix
|
644
645
|
r = _convert_index_to_printable_row() unless r
|
646
|
+
return unless r # row is not longer visible 2013-04-10 - 16:37
|
645
647
|
attrib = @focussed_attrib || 'bold'
|
646
648
|
|
647
649
|
when :UNFOCUSSED
|
@@ -660,6 +662,7 @@ module ListScrollable
|
|
660
662
|
att = get_attrib(attrib) #if @focussed_attrib
|
661
663
|
@graphic.mvchgat(y=r, x=c, @width-@internal_width, att , acolor , nil)
|
662
664
|
end
|
663
|
-
|
664
665
|
|
666
|
+
|
667
|
+
end
|
665
668
|
end
|