wxruby3 0.9.0.pre.beta.8 → 0.9.0.pre.beta.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d5dbc9b814f9b51ac36a537fad27a58595d41536f68eafb17b7250b70b510d2f
4
- data.tar.gz: bd80ce942bd3e37ee334d5562a7fcc4462e640ced3b49449e68e7c9e12f7c784
3
+ metadata.gz: ce9e7bb6763fb08e50024b77b709a9cc94032933960dbdaee1b3a5f90acad71d
4
+ data.tar.gz: 3d39f6499828d222e038a1bd4880af58befe24f887d2d73534213107f024bf46
5
5
  SHA512:
6
- metadata.gz: 640e90f61107db26bf3f73e76fd5cc05843cc714621773bb807c6f14a4e93b911bb3a92e54f430644843d9c0d986cf8041d9b9ab7750f09f69dbb4517ea8a982
7
- data.tar.gz: 5ce36f28a19449a0fd3f20ed5a8133b490335e359f13bb118c325c5592a65f75881f02970a2270699af7d64338d0f06d409d01bd26d4a67c61ed3685d9b71f92
6
+ metadata.gz: a2a56a03af8da3b6fe6dc57192cf151218cd6f6bf2dca613cdfccae1851451fc7ecb75080cb530050e30f438bee6c8990106795218e6cc5601a033517b92b445
7
+ data.tar.gz: 02b8069fda0d2c3a0237747650f081b1824787d72c9aaad98ce8ef78cbd6cb5a1752bda5e98539ba092bc786854b86e26141fa935c3cd58817290931d0f7c836
data/lib/wx/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Wx
2
- WXRUBY_VERSION = '0.9.0-beta.8'
2
+ WXRUBY_VERSION = '0.9.0-beta.9'
3
3
  end
@@ -175,6 +175,19 @@ module WxRuby
175
175
  @editors.each { |e| e.find_close }
176
176
  end
177
177
 
178
+ def goto
179
+ res = Wx.get_number_from_user('Enter line number to go to.',
180
+ 'Line:',
181
+ 'Goto Line',
182
+ @editors[@edt_book.selection].current_line+1,
183
+ 1,
184
+ @editors[@edt_book.selection].line_count,
185
+ @frame)
186
+ if res >= 1
187
+ @editors[@edt_book.selection].goto_line(res-1)
188
+ end
189
+ end
190
+
178
191
  def page_from_id(id)
179
192
  if id >= ID::EDT_MIN_ID && id < (ID::EDT_MIN_ID+@edt_book.page_count)
180
193
  id - ID::EDT_MIN_ID
@@ -231,6 +244,7 @@ module WxRuby
231
244
  FIND_NEXT = Wx::ID_FORWARD
232
245
  FIND_PREV = Wx::ID_BACKWARD
233
246
  REPLACE = Wx::ID_REPLACE
247
+ GOTO = Wx::ID_JUMP_TO
234
248
  %i[
235
249
  RUN
236
250
  TOGGLE_THEME
@@ -268,6 +282,8 @@ module WxRuby
268
282
  menuEdit.append(ID::FIND_NEXT, "Find Next\tF3", 'Find next occurrence of the search phrase')
269
283
  menuEdit.append(ID::FIND_PREV, "Find Previous\tShift-F3", 'Find previous occurrence of the search phrase')
270
284
  menuEdit.append(ID::REPLACE, "Replace...\tCtrl-R", 'Show Replace Dialog')
285
+ menuEdit.append_separator
286
+ menuEdit.append(ID::GOTO, "Got to line...\tCtrl-G", 'Move to line number')
271
287
 
272
288
  menuView = Wx::Menu.new
273
289
  menuView.append(ID::TOGGLE_THEME, 'Display dark theme', 'Display dark theme', Wx::ITEM_CHECK)
@@ -354,6 +370,8 @@ module WxRuby
354
370
  evt_menu(ID::FIND_NEXT, :on_find_next)
355
371
  evt_menu(ID::FIND_PREV, :on_find_prev)
356
372
 
373
+ evt_menu(ID::GOTO, :on_goto)
374
+
357
375
  layout
358
376
  end
359
377
 
@@ -555,6 +573,10 @@ module WxRuby
555
573
  set_status_text('')
556
574
  end
557
575
 
576
+ def on_goto(_evt)
577
+ @editors.goto
578
+ end
579
+
558
580
  end
559
581
 
560
582
  end
@@ -133,17 +133,18 @@ module WxRuby
133
133
  style_set_foreground(SCE_RB_CHARACTER, Wx::RED)
134
134
  style_set_foreground(SCE_RB_SYMBOL, Wx::Colour.new('DARKBLUE'))
135
135
  style_set_bold(SCE_RB_SYMBOL, true)
136
- # current wxWidgets Scintilla (Ruby lexer) version does not support these correctly
137
- # style_set_foreground(SCE_RB_HERE_DELIM, Wx::BLACK)
138
- # style_set_bold(SCE_RB_HERE_DELIM, true)
139
- # style_set_foreground(SCE_RB_HERE_Q, c_maroon)
140
- # style_set_foreground(SCE_RB_HERE_QQ, c_maroon)
141
- # style_set_foreground(SCE_RB_HERE_QX, c_maroon)
142
- # style_set_foreground(SCE_RB_STRING_Q, c_maroon)
143
- # style_set_foreground(SCE_RB_STRING_QQ, c_maroon)
144
- # style_set_foreground(SCE_RB_STRING_QX, c_maroon)
145
- # style_set_foreground(SCE_RB_STRING_QR, c_maroon)
146
- # style_set_foreground(SCE_RB_STRING_QW, c_maroon)
136
+ if Wx::WXWIDGETS_VERSION >= '3.3.0'
137
+ style_set_foreground(SCE_RB_HERE_DELIM, Wx::BLACK)
138
+ style_set_bold(SCE_RB_HERE_DELIM, true)
139
+ style_set_foreground(SCE_RB_HERE_Q, c_maroon)
140
+ style_set_foreground(SCE_RB_HERE_QQ, c_maroon)
141
+ style_set_foreground(SCE_RB_HERE_QX, c_maroon)
142
+ style_set_foreground(SCE_RB_STRING_Q, c_maroon)
143
+ style_set_foreground(SCE_RB_STRING_QQ, c_maroon)
144
+ style_set_foreground(SCE_RB_STRING_QX, c_maroon)
145
+ style_set_foreground(SCE_RB_STRING_QR, c_maroon)
146
+ style_set_foreground(SCE_RB_STRING_QW, c_maroon)
147
+ end
147
148
  bg = Wx::Colour.new('LightGray')
148
149
  fg = Wx::Colour.new('DarkCyan')
149
150
  set_fold_margin_colour(true, bg)
@@ -156,6 +157,7 @@ module WxRuby
156
157
 
157
158
  def dark_theme
158
159
  bg = Wx::Colour.new('DarkSlateGray')
160
+ c_str = Wx::Colour.new('LimeGreen')
159
161
  style_set_background(Wx::STC::STC_STYLE_DEFAULT, bg)
160
162
  style_set_foreground(Wx::STC::STC_STYLE_DEFAULT, Wx::WHITE)
161
163
  style_clear_all
@@ -177,24 +179,25 @@ module WxRuby
177
179
  style_set_background(SCE_RB_POD, bg)
178
180
  style_set_foreground(SCE_RB_NUMBER, Wx::Colour.new('DeepSkyBlue'))
179
181
  style_set_background(SCE_RB_NUMBER, bg)
180
- style_set_foreground(SCE_RB_STRING, Wx::Colour.new('LimeGreen'))
182
+ style_set_foreground(SCE_RB_STRING, c_str)
181
183
  style_set_background(SCE_RB_STRING, bg)
182
184
  style_set_foreground(SCE_RB_CHARACTER, Wx::Colour.new('YellowGreen'))
183
185
  style_set_background(SCE_RB_CHARACTER, bg)
184
186
  style_set_foreground(SCE_RB_SYMBOL, Wx::Colour.new('Gold'))
185
187
  style_set_background(SCE_RB_SYMBOL, bg)
186
188
  style_set_bold(SCE_RB_SYMBOL, true)
187
- # current wxWidgets Scintilla (Ruby lexer) version does not support these correctly
188
- # style_set_foreground(SCE_RB_HERE_DELIM, Wx::BLACK)
189
- # style_set_bold(SCE_RB_HERE_DELIM, true)
190
- # style_set_foreground(SCE_RB_HERE_Q, c_maroon)
191
- # style_set_foreground(SCE_RB_HERE_QQ, c_maroon)
192
- # style_set_foreground(SCE_RB_HERE_QX, c_maroon)
193
- # style_set_foreground(SCE_RB_STRING_Q, c_maroon)
194
- # style_set_foreground(SCE_RB_STRING_QQ, c_maroon)
195
- # style_set_foreground(SCE_RB_STRING_QX, c_maroon)
196
- # style_set_foreground(SCE_RB_STRING_QR, c_maroon)
197
- # style_set_foreground(SCE_RB_STRING_QW, c_maroon)
189
+ if Wx::WXWIDGETS_VERSION >= '3.3.0'
190
+ style_set_foreground(SCE_RB_HERE_DELIM, Wx::Colour.new('Chocolate'))
191
+ style_set_bold(SCE_RB_HERE_DELIM, true)
192
+ style_set_foreground(SCE_RB_HERE_Q, c_str)
193
+ style_set_foreground(SCE_RB_HERE_QQ, c_str)
194
+ style_set_foreground(SCE_RB_HERE_QX, c_str)
195
+ style_set_foreground(SCE_RB_STRING_Q, c_str)
196
+ style_set_foreground(SCE_RB_STRING_QQ, c_str)
197
+ style_set_foreground(SCE_RB_STRING_QX, c_str)
198
+ style_set_foreground(SCE_RB_STRING_QR, c_str)
199
+ style_set_foreground(SCE_RB_STRING_QW, c_str)
200
+ end
198
201
  bg = Wx::Colour.new('CadetBlue')
199
202
  fg = Wx::Colour.new('Chocolate')
200
203
  set_fold_margin_colour(true, bg)
@@ -212,7 +215,7 @@ module WxRuby
212
215
  start_pos = current_pos
213
216
  end_pos = length-1
214
217
  else
215
- start_pos = current_pos
218
+ start_pos = [0, current_pos - (@search_indicator ? @search_indicator.last : 0)].max
216
219
  end_pos = 0
217
220
  end
218
221
  pos, end_pos = find_text(start_pos, end_pos, txt, flags)
@@ -45,6 +45,24 @@ module WxRuby
45
45
  clear
46
46
  end
47
47
 
48
+ def get_line_count
49
+ number_of_lines
50
+ end
51
+ alias :line_count :get_line_count
52
+
53
+ def get_current_line
54
+ pos = insertion_point
55
+ _, line = position_to_xy(pos)
56
+ line
57
+ end
58
+ alias :current_line :get_current_line
59
+
60
+ def goto_line(line)
61
+ pos = xy_to_position(0, line)
62
+ self.show_position(pos)
63
+ self.insertion_point = pos
64
+ end
65
+
48
66
  def do_find(txt, forward, whole_word, match_case)
49
67
  options = (match_case ? 0 : Regexp::IGNORECASE)
50
68
  pattern = if whole_word
@@ -52,7 +70,12 @@ module WxRuby
52
70
  else
53
71
  ::Regexp.new(txt, options)
54
72
  end
55
- forward ? self.value.index(pattern, self.insertion_point) : self.value.rindex(pattern, self.insertion_point)
73
+ if forward
74
+ self.value.index(pattern, insertion_point)
75
+ else
76
+ start_pos = [0, insertion_point - (@search_indicator ? @search_indicator.last+1 : 0)].max
77
+ self.value.rindex(pattern, start_pos)
78
+ end
56
79
  end
57
80
 
58
81
  def indicator_clear_range(pos, len)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wxruby3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0.pre.beta.8
4
+ version: 0.9.0.pre.beta.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Corino
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-27 00:00:00.000000000 Z
11
+ date: 2023-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri