From 6e48eb4581d3ef931e00d15534c1dae216f70a79 Mon Sep 17 00:00:00 2001 From: wmorgan Date: Sat, 27 Oct 2007 22:54:17 +0000 Subject: [PATCH] fix label tab-completion downcase issue git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@631 5c8cc53c-5e98-4d25-b20a-d8db53a31250 --- bin/sup | 2 +- lib/sup/buffer.rb | 2 +- lib/sup/label.rb | 10 ++++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/bin/sup b/bin/sup index be455fa..68d9c73 100644 --- a/bin/sup +++ b/bin/sup @@ -238,7 +238,7 @@ begin when nil, /^\s*$/ bm.spawn_modal("Label list", LabelListMode.new) if user_label && user_label.empty? else - user_label.intern + LabelManager.label_for user_label end case user_label diff --git a/lib/sup/buffer.rb b/lib/sup/buffer.rb index 3a69682..c96232f 100644 --- a/lib/sup/buffer.rb +++ b/lib/sup/buffer.rb @@ -340,7 +340,7 @@ class BufferManager def ask_with_completions domain, question, completions, default=nil ask domain, question, default do |s| - completions.select { |x| x =~ /^#{s}/i }.map { |x| [x.downcase, x] } + completions.select { |x| x =~ /^#{s}/i }.map { |x| [x, x] } end end diff --git a/lib/sup/label.rb b/lib/sup/label.rb index 3288493..ada1710 100644 --- a/lib/sup/label.rb +++ b/lib/sup/label.rb @@ -50,6 +50,16 @@ class LabelManager l.to_s end end + + def label_for s + l = s.intern + l2 = s.downcase.intern + if RESERVED_LABELS.include? l2 + l2 + else + l + end + end def << t t = t.intern unless t.is_a? Symbol -- 2.45.2