command-t 1.9.1 → 1.10

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 (46) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.txt +241 -101
  4. data/doc/command-t.txt +241 -101
  5. data/doc/tags +11 -0
  6. data/plugin/command-t.vim +2 -22
  7. data/ruby/command-t/Makefile +21 -22
  8. data/ruby/command-t/controller.rb +49 -28
  9. data/ruby/command-t/depend +2 -22
  10. data/ruby/command-t/ext.bundle +0 -0
  11. data/ruby/command-t/ext.c +2 -22
  12. data/ruby/command-t/ext.h +2 -22
  13. data/ruby/command-t/extconf.rb +2 -22
  14. data/ruby/command-t/finder.rb +2 -22
  15. data/ruby/command-t/finder/buffer_finder.rb +2 -22
  16. data/ruby/command-t/finder/file_finder.rb +2 -22
  17. data/ruby/command-t/finder/jump_finder.rb +2 -22
  18. data/ruby/command-t/finder/mru_buffer_finder.rb +2 -22
  19. data/ruby/command-t/finder/tag_finder.rb +6 -22
  20. data/ruby/command-t/match.c +6 -23
  21. data/ruby/command-t/match.h +3 -22
  22. data/ruby/command-t/match_window.rb +8 -27
  23. data/ruby/command-t/matcher.c +11 -25
  24. data/ruby/command-t/matcher.h +2 -22
  25. data/ruby/command-t/mru.rb +2 -22
  26. data/ruby/command-t/prompt.rb +18 -22
  27. data/ruby/command-t/ruby_compat.h +2 -22
  28. data/ruby/command-t/scanner.rb +2 -22
  29. data/ruby/command-t/scanner/buffer_scanner.rb +2 -22
  30. data/ruby/command-t/scanner/file_scanner.rb +2 -22
  31. data/ruby/command-t/scanner/file_scanner/find_file_scanner.rb +2 -22
  32. data/ruby/command-t/scanner/file_scanner/ruby_file_scanner.rb +2 -22
  33. data/ruby/command-t/scanner/file_scanner/watchman_file_scanner.rb +2 -22
  34. data/ruby/command-t/scanner/jump_scanner.rb +2 -22
  35. data/ruby/command-t/scanner/mru_buffer_scanner.rb +2 -22
  36. data/ruby/command-t/scanner/tag_scanner.rb +8 -23
  37. data/ruby/command-t/settings.rb +2 -22
  38. data/ruby/command-t/stub.rb +2 -22
  39. data/ruby/command-t/util.rb +2 -22
  40. data/ruby/command-t/vim.rb +2 -22
  41. data/ruby/command-t/vim/path_utilities.rb +2 -22
  42. data/ruby/command-t/vim/screen.rb +2 -22
  43. data/ruby/command-t/vim/window.rb +2 -22
  44. data/ruby/command-t/watchman.c +2 -22
  45. data/ruby/command-t/watchman.h +2 -22
  46. metadata +17 -17
@@ -1,25 +1,5 @@
1
- # Copyright 2010-2011 Wincent Colaiuta. All rights reserved.
2
- #
3
- # Redistribution and use in source and binary forms, with or without
4
- # modification, are permitted provided that the following conditions are met:
5
- #
6
- # 1. Redistributions of source code must retain the above copyright notice,
7
- # this list of conditions and the following disclaimer.
8
- # 2. Redistributions in binary form must reproduce the above copyright notice,
9
- # this list of conditions and the following disclaimer in the documentation
10
- # and/or other materials provided with the distribution.
11
- #
12
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
13
- # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14
- # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15
- # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
16
- # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
17
- # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
18
- # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
19
- # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
20
- # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21
- # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
22
- # POSSIBILITY OF SUCH DAMAGE.
1
+ # Copyright 2010-2014 Greg Hurrell. All rights reserved.
2
+ # Licensed under the terms of the BSD 2-clause license.
23
3
 
24
4
  require 'command-t/ext' # CommandT::Matcher
25
5
  require 'command-t/scanner/buffer_scanner'
@@ -1,25 +1,5 @@
1
- # Copyright 2010-2014 Wincent Colaiuta. All rights reserved.
2
- #
3
- # Redistribution and use in source and binary forms, with or without
4
- # modification, are permitted provided that the following conditions are met:
5
- #
6
- # 1. Redistributions of source code must retain the above copyright notice,
7
- # this list of conditions and the following disclaimer.
8
- # 2. Redistributions in binary form must reproduce the above copyright notice,
9
- # this list of conditions and the following disclaimer in the documentation
10
- # and/or other materials provided with the distribution.
11
- #
12
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
13
- # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14
- # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15
- # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
16
- # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
17
- # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
18
- # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
19
- # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
20
- # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21
- # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
22
- # POSSIBILITY OF SUCH DAMAGE.
1
+ # Copyright 2010-2014 Greg Hurrell. All rights reserved.
2
+ # Licensed under the terms of the BSD 2-clause license.
23
3
 
24
4
  require 'command-t/ext' # CommandT::Matcher
25
5
  require 'command-t/finder'
@@ -1,25 +1,5 @@
1
- # Copyright 2011 Wincent Colaiuta. All rights reserved.
2
- #
3
- # Redistribution and use in source and binary forms, with or without
4
- # modification, are permitted provided that the following conditions are met:
5
- #
6
- # 1. Redistributions of source code must retain the above copyright notice,
7
- # this list of conditions and the following disclaimer.
8
- # 2. Redistributions in binary form must reproduce the above copyright notice,
9
- # this list of conditions and the following disclaimer in the documentation
10
- # and/or other materials provided with the distribution.
11
- #
12
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
13
- # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14
- # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15
- # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
16
- # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
17
- # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
18
- # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
19
- # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
20
- # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21
- # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
22
- # POSSIBILITY OF SUCH DAMAGE.
1
+ # Copyright 2011-2014 Greg Hurrell. All rights reserved.
2
+ # Licensed under the terms of the BSD 2-clause license.
23
3
 
24
4
  require 'command-t/ext' # CommandT::Matcher
25
5
  require 'command-t/scanner/jump_scanner'
@@ -1,25 +1,5 @@
1
- # Copyright 2014 Wincent Colaiuta. All rights reserved.
2
- #
3
- # Redistribution and use in source and binary forms, with or without
4
- # modification, are permitted provided that the following conditions are met:
5
- #
6
- # 1. Redistributions of source code must retain the above copyright notice,
7
- # this list of conditions and the following disclaimer.
8
- # 2. Redistributions in binary form must reproduce the above copyright notice,
9
- # this list of conditions and the following disclaimer in the documentation
10
- # and/or other materials provided with the distribution.
11
- #
12
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
13
- # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14
- # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15
- # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
16
- # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
17
- # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
18
- # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
19
- # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
20
- # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21
- # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
22
- # POSSIBILITY OF SUCH DAMAGE.
1
+ # Copyright 2014 Greg Hurrell. All rights reserved.
2
+ # Licensed under the terms of the BSD 2-clause license.
23
3
 
24
4
  require 'command-t/ext' # CommandT::Matcher
25
5
  require 'command-t/scanner/mru_buffer_scanner'
@@ -1,25 +1,5 @@
1
- # Copyright 2011-2012 Wincent Colaiuta. All rights reserved.
2
- #
3
- # Redistribution and use in source and binary forms, with or without
4
- # modification, are permitted provided that the following conditions are met:
5
- #
6
- # 1. Redistributions of source code must retain the above copyright notice,
7
- # this list of conditions and the following disclaimer.
8
- # 2. Redistributions in binary form must reproduce the above copyright notice,
9
- # this list of conditions and the following disclaimer in the documentation
10
- # and/or other materials provided with the distribution.
11
- #
12
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
13
- # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14
- # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15
- # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
16
- # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
17
- # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
18
- # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
19
- # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
20
- # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21
- # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
22
- # POSSIBILITY OF SUCH DAMAGE.
1
+ # Copyright 2011-2014 Greg Hurrell. All rights reserved.
2
+ # Licensed under the terms of the BSD 2-clause license.
23
3
 
24
4
  require 'command-t/ext' # CommandT::Matcher
25
5
  require 'command-t/scanner/tag_scanner'
@@ -40,5 +20,9 @@ module CommandT
40
20
  # open the tag and center the screen on it
41
21
  ::VIM::command "silent! tag #{selection} | :normal zz"
42
22
  end
23
+
24
+ def flush
25
+ @scanner.flush
26
+ end
43
27
  end # class TagFinder
44
28
  end # module CommandT
@@ -1,25 +1,5 @@
1
- // Copyright 2010-2014 Wincent Colaiuta. All rights reserved.
2
- //
3
- // Redistribution and use in source and binary forms, with or without
4
- // modification, are permitted provided that the following conditions are met:
5
- //
6
- // 1. Redistributions of source code must retain the above copyright notice,
7
- // this list of conditions and the following disclaimer.
8
- // 2. Redistributions in binary form must reproduce the above copyright notice,
9
- // this list of conditions and the following disclaimer in the documentation
10
- // and/or other materials provided with the distribution.
11
- //
12
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
13
- // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14
- // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15
- // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
16
- // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
17
- // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
18
- // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
19
- // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
20
- // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21
- // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
22
- // POSSIBILITY OF SUCH DAMAGE.
1
+ // Copyright 2010-2014 Greg Hurrell. All rights reserved.
2
+ // Licensed under the terms of the BSD 2-clause license.
23
3
 
24
4
  #include <float.h> /* for DBL_MAX */
25
5
  #include "match.h"
@@ -36,6 +16,7 @@ typedef struct {
36
16
  int dot_file; // boolean: true if str is a dot-file
37
17
  int always_show_dot_files; // boolean
38
18
  int never_show_dot_files; // boolean
19
+ int case_sensitive; // boolean
39
20
  double *memo; // memoization
40
21
  } matchinfo_t;
41
22
 
@@ -82,7 +63,7 @@ double recursive_match(matchinfo_t *m, // sharable meta-data
82
63
  if (dot_search) // and we are searching for a dot
83
64
  dot_file_match = 1; // so this must be a match
84
65
  }
85
- } else if (d >= 'A' && d <= 'Z') {
66
+ } else if (d >= 'A' && d <= 'Z' && !m->case_sensitive) {
86
67
  d += 'a' - 'A'; // add 32 to downcase
87
68
  }
88
69
 
@@ -151,6 +132,7 @@ memoize:
151
132
 
152
133
  void calculate_match(VALUE str,
153
134
  VALUE needle,
135
+ VALUE case_sensitive,
154
136
  VALUE always_show_dot_files,
155
137
  VALUE never_show_dot_files,
156
138
  match_t *out)
@@ -166,6 +148,7 @@ void calculate_match(VALUE str,
166
148
  m.dot_file = 0;
167
149
  m.always_show_dot_files = always_show_dot_files == Qtrue;
168
150
  m.never_show_dot_files = never_show_dot_files == Qtrue;
151
+ m.case_sensitive = case_sensitive;
169
152
 
170
153
  // calculate score
171
154
  score = 1.0;
@@ -1,25 +1,5 @@
1
- // Copyright 2010-2013 Wincent Colaiuta. All rights reserved.
2
- //
3
- // Redistribution and use in source and binary forms, with or without
4
- // modification, are permitted provided that the following conditions are met:
5
- //
6
- // 1. Redistributions of source code must retain the above copyright notice,
7
- // this list of conditions and the following disclaimer.
8
- // 2. Redistributions in binary form must reproduce the above copyright notice,
9
- // this list of conditions and the following disclaimer in the documentation
10
- // and/or other materials provided with the distribution.
11
- //
12
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
13
- // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14
- // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15
- // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
16
- // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
17
- // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
18
- // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
19
- // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
20
- // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21
- // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
22
- // POSSIBILITY OF SUCH DAMAGE.
1
+ // Copyright 2010-2014 Greg Hurrell. All rights reserved.
2
+ // Licensed under the terms of the BSD 2-clause license.
23
3
 
24
4
  #include <ruby.h>
25
5
 
@@ -31,6 +11,7 @@ typedef struct {
31
11
 
32
12
  extern void calculate_match(VALUE str,
33
13
  VALUE needle,
14
+ VALUE case_sensitive,
34
15
  VALUE always_show_dot_files,
35
16
  VALUE never_show_dot_files,
36
17
  match_t *out);
@@ -1,25 +1,5 @@
1
- # Copyright 2010-2014 Wincent Colaiuta. All rights reserved.
2
- #
3
- # Redistribution and use in source and binary forms, with or without
4
- # modification, are permitted provided that the following conditions are met:
5
- #
6
- # 1. Redistributions of source code must retain the above copyright notice,
7
- # this list of conditions and the following disclaimer.
8
- # 2. Redistributions in binary form must reproduce the above copyright notice,
9
- # this list of conditions and the following disclaimer in the documentation
10
- # and/or other materials provided with the distribution.
11
- #
12
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
13
- # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14
- # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15
- # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
16
- # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
17
- # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
18
- # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
19
- # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
20
- # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21
- # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
22
- # POSSIBILITY OF SUCH DAMAGE.
1
+ # Copyright 2010-2014 Greg Hurrell. All rights reserved.
2
+ # Licensed under the terms of the BSD 2-clause license.
23
3
 
24
4
  require 'ostruct'
25
5
  require 'command-t/settings'
@@ -40,11 +20,12 @@ module CommandT
40
20
  @reverse_list = options[:match_window_reverse]
41
21
 
42
22
  # save existing window dimensions so we can restore them later
43
- @windows = []
44
- (0..(::VIM::Window.count - 1)).each do |i|
45
- @windows << OpenStruct.new(:index => i,
46
- :height => ::VIM::Window[i].height,
47
- :width => ::VIM::Window[i].width)
23
+ @windows = (0..(::VIM::Window.count - 1)).map do |i|
24
+ OpenStruct.new(
25
+ :index => i,
26
+ :height => ::VIM::Window[i].height,
27
+ :width => ::VIM::Window[i].width
28
+ )
48
29
  end
49
30
 
50
31
  set 'timeout', true # ensure mappings timeout
@@ -1,25 +1,5 @@
1
- // Copyright 2010-2014 Wincent Colaiuta. All rights reserved.
2
- //
3
- // Redistribution and use in source and binary forms, with or without
4
- // modification, are permitted provided that the following conditions are met:
5
- //
6
- // 1. Redistributions of source code must retain the above copyright notice,
7
- // this list of conditions and the following disclaimer.
8
- // 2. Redistributions in binary form must reproduce the above copyright notice,
9
- // this list of conditions and the following disclaimer in the documentation
10
- // and/or other materials provided with the distribution.
11
- //
12
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
13
- // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14
- // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15
- // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
16
- // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
17
- // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
18
- // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
19
- // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
20
- // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21
- // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
22
- // POSSIBILITY OF SUCH DAMAGE.
1
+ // Copyright 2010-2014 Greg Hurrell. All rights reserved.
2
+ // Licensed under the terms of the BSD 2-clause license.
23
3
 
24
4
  #include <stdlib.h> /* for qsort() */
25
5
  #include <string.h> /* for strncmp() */
@@ -103,6 +83,7 @@ VALUE CommandTMatcher_initialize(int argc, VALUE *argv, VALUE self)
103
83
  typedef struct {
104
84
  int thread_count;
105
85
  int thread_index;
86
+ int case_sensitive;
106
87
  match_t *matches;
107
88
  long path_count;
108
89
  VALUE paths;
@@ -119,6 +100,7 @@ void *match_thread(void *thread_args)
119
100
  VALUE path = RARRAY_PTR(args->paths)[i];
120
101
  calculate_match(path,
121
102
  args->abbrev,
103
+ args->case_sensitive,
122
104
  args->always_show_dot_files,
123
105
  args->never_show_dot_files,
124
106
  &args->matches[i]);
@@ -137,6 +119,7 @@ VALUE CommandTMatcher_sorted_matches_for(int argc, VALUE *argv, VALUE self)
137
119
  match_t *matches;
138
120
  thread_args_t *thread_args;
139
121
  VALUE abbrev;
122
+ VALUE case_sensitive;
140
123
  VALUE always_show_dot_files;
141
124
  VALUE limit_option;
142
125
  VALUE never_show_dot_files;
@@ -153,14 +136,16 @@ VALUE CommandTMatcher_sorted_matches_for(int argc, VALUE *argv, VALUE self)
153
136
  if (NIL_P(abbrev))
154
137
  rb_raise(rb_eArgError, "nil abbrev");
155
138
 
156
- abbrev = StringValue(abbrev);
157
- abbrev = rb_funcall(abbrev, rb_intern("downcase"), 0);
158
-
159
139
  // check optional options has for overrides
140
+ case_sensitive = CommandT_option_from_hash("case_sensitive", options);
160
141
  limit_option = CommandT_option_from_hash("limit", options);
161
142
  threads_option = CommandT_option_from_hash("threads", options);
162
143
  sort_option = CommandT_option_from_hash("sort", options);
163
144
 
145
+ abbrev = StringValue(abbrev);
146
+ if (case_sensitive != Qtrue)
147
+ abbrev = rb_funcall(abbrev, rb_intern("downcase"), 0);
148
+
164
149
  // get unsorted matches
165
150
  scanner = rb_iv_get(self, "@scanner");
166
151
  paths = rb_funcall(scanner, rb_intern("paths"), 0);
@@ -189,6 +174,7 @@ VALUE CommandTMatcher_sorted_matches_for(int argc, VALUE *argv, VALUE self)
189
174
  for (i = 0; i < thread_count; i++) {
190
175
  thread_args[i].thread_count = thread_count;
191
176
  thread_args[i].thread_index = i;
177
+ thread_args[i].case_sensitive = case_sensitive == Qtrue;
192
178
  thread_args[i].matches = matches;
193
179
  thread_args[i].path_count = path_count;
194
180
  thread_args[i].paths = paths;
@@ -1,25 +1,5 @@
1
- // Copyright 2010-2013 Wincent Colaiuta. All rights reserved.
2
- //
3
- // Redistribution and use in source and binary forms, with or without
4
- // modification, are permitted provided that the following conditions are met:
5
- //
6
- // 1. Redistributions of source code must retain the above copyright notice,
7
- // this list of conditions and the following disclaimer.
8
- // 2. Redistributions in binary form must reproduce the above copyright notice,
9
- // this list of conditions and the following disclaimer in the documentation
10
- // and/or other materials provided with the distribution.
11
- //
12
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
13
- // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14
- // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15
- // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
16
- // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
17
- // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
18
- // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
19
- // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
20
- // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21
- // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
22
- // POSSIBILITY OF SUCH DAMAGE.
1
+ // Copyright 2010-2014 Greg Hurrell. All rights reserved.
2
+ // Licensed under the terms of the BSD 2-clause license.
23
3
 
24
4
  #include <ruby.h>
25
5
 
@@ -1,25 +1,5 @@
1
- # Copyright 2014 Wincent Colaiuta. All rights reserved.
2
- #
3
- # Redistribution and use in source and binary forms, with or without
4
- # modification, are permitted provided that the following conditions are met:
5
- #
6
- # 1. Redistributions of source code must retain the above copyright notice,
7
- # this list of conditions and the following disclaimer.
8
- # 2. Redistributions in binary form must reproduce the above copyright notice,
9
- # this list of conditions and the following disclaimer in the documentation
10
- # and/or other materials provided with the distribution.
11
- #
12
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
13
- # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14
- # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15
- # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
16
- # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
17
- # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
18
- # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
19
- # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
20
- # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21
- # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
22
- # POSSIBILITY OF SUCH DAMAGE.
1
+ # Copyright 2014 Greg Hurrell. All rights reserved.
2
+ # Licensed under the terms of the BSD 2-clause license.
23
3
 
24
4
  module CommandT
25
5
  # Maintains a stack of seen buffers in MRU (most recently used) order.
@@ -1,25 +1,5 @@
1
- # Copyright 2010 Wincent Colaiuta. All rights reserved.
2
- #
3
- # Redistribution and use in source and binary forms, with or without
4
- # modification, are permitted provided that the following conditions are met:
5
- #
6
- # 1. Redistributions of source code must retain the above copyright notice,
7
- # this list of conditions and the following disclaimer.
8
- # 2. Redistributions in binary form must reproduce the above copyright notice,
9
- # this list of conditions and the following disclaimer in the documentation
10
- # and/or other materials provided with the distribution.
11
- #
12
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
13
- # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14
- # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15
- # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
16
- # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
17
- # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
18
- # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
19
- # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
20
- # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21
- # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
22
- # POSSIBILITY OF SUCH DAMAGE.
1
+ # Copyright 2010-2014 Greg Hurrell. All rights reserved.
2
+ # Licensed under the terms of the BSD 2-clause license.
23
3
 
24
4
  module CommandT
25
5
  # Abuse the status line as a prompt.
@@ -46,6 +26,22 @@ module CommandT
46
26
  redraw
47
27
  end
48
28
 
29
+ # Remove word before cursor
30
+ def clear_prev_word!
31
+ suffix_length = @abbrev.length - @col
32
+ @abbrev.match(
33
+ %r{
34
+ (.*?) # prefix
35
+ \w*\s* # word to clear
36
+ (.{#{suffix_length}}) # suffix
37
+ \z
38
+ }x
39
+ )
40
+ @abbrev = $~[1] + $~[2]
41
+ @col = @abbrev.length - suffix_length
42
+ redraw
43
+ end
44
+
49
45
  # Insert a character at (before) the current cursor position.
50
46
  def add! char
51
47
  left, cursor, right = abbrev_segments