tkri 0.9.4 → 0.9.5

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.
Files changed (2) hide show
  1. data/lib/tkri.rb +9 -3
  2. metadata +1 -1
@@ -456,8 +456,9 @@ class Tab < TkFrame
456
456
 
457
457
  # Returns the first class mentioned before the cursor.
458
458
  def get_previous_class cursor
459
- ret = @info.rsearch_with_length(/[A-Z]\w*/, cursor)
460
- return ret[0].empty? ? nil : ret[2]
459
+ # The class (or module) is followed by a '('
460
+ ret = @info.rsearch_with_length(/\s\S+\(/, cursor)
461
+ return ret[0].empty? ? nil : ret[2][1..-2] # skip the first char (a space) and the last (a parentheses)
461
462
  end
462
463
 
463
464
  # Get the "topic" at a certain postion.
@@ -495,10 +496,15 @@ class Tab < TkFrame
495
496
  @info.tag_add('keyword', '%s linestart + %d chars' % [ position, a ],
496
497
  '%s linestart + %d chars' % [ position, a+word.length ])
497
498
  word.strip!
498
-
499
+
499
500
  return nil if word.empty?
500
501
  return nil if word =~ /^-+$/ # A special case: a line of '-----'
501
502
 
503
+ if word =~ /^#/
504
+ # Sometimes there's just "#method".
505
+ word = @topic + word
506
+ end
507
+
502
508
  case get_previous_header(position)
503
509
  when 'Instance methods:'
504
510
  word = topic + '#' + word
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tkri
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mooffie