From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 10.213.13.12 with SMTP id z12cs1155336ebz; Sun, 3 Jan 2010 07:24:29 -0800 (PST) Received: by 10.224.60.9 with SMTP id n9mr10743025qah.31.1262532268540; Sun, 03 Jan 2010 07:24:28 -0800 (PST) Return-Path: Received: from rubyforge.org (rubyforge.org [205.234.109.19]) by mx.google.com with ESMTP id 31si22629886qyk.121.2010.01.03.07.24.28; Sun, 03 Jan 2010 07:24:28 -0800 (PST) Received-SPF: pass (google.com: domain of sup-devel-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) client-ip=205.234.109.19; Authentication-Results: mx.google.com; spf=pass (google.com: domain of sup-devel-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) smtp.mail=sup-devel-bounces@rubyforge.org Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 17DB618582CB; Sun, 3 Jan 2010 10:24:27 -0500 (EST) Received: from magnesium.club.cc.cmu.edu (MAGNESIUM.CLUB.CC.cmu.edu [128.237.157.15]) by rubyforge.org (Postfix) with ESMTP id AC2B51858282 for ; Sun, 3 Jan 2010 10:24:23 -0500 (EST) Received: (qmail 25678 invoked from network); 3 Jan 2010 15:24:23 -0000 Received: from pion.club.cc.cmu.edu (HELO localhost.localdomain) (128.237.157.88) by magnesium.club.cc.cmu.edu with SMTP; 3 Jan 2010 15:24:23 -0000 From: Rich Lane To: sup-devel@rubyforge.org Date: Sun, 3 Jan 2010 07:24:20 -0800 Message-Id: <1262532260-18353-3-git-send-email-rlane@club.cc.cmu.edu> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1262532260-18353-2-git-send-email-rlane@club.cc.cmu.edu> References: <1262532260-18353-1-git-send-email-rlane@club.cc.cmu.edu> <1262532260-18353-2-git-send-email-rlane@club.cc.cmu.edu> Subject: [sup-devel] [PATCH 3/3] add keybinding 'Oc' to reload colors X-BeenThere: sup-devel@rubyforge.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: Sup developer discussion List-Id: Sup developer discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: sup-devel-bounces@rubyforge.org Errors-To: sup-devel-bounces@rubyforge.org --- bin/sup | 10 ++++++++++ lib/sup/colormap.rb | 6 +++++- 2 files changed, 15 insertions(+), 1 deletions(-) diff --git a/bin/sup b/bin/sup index 5571598..0716e55 100755 --- a/bin/sup +++ b/bin/sup @@ -96,6 +96,11 @@ global_keymap = Keymap.new do |k| k.add :recall_draft, "Edit most recent draft message", 'R' k.add :show_inbox, "Show the Inbox buffer", 'I' k.add :show_console, "Show the Console buffer", '~' + + ## Submap for less often used keybindings + k.add_multi "reload (c)olors", 'O' do |kk| + kk.add :reload_colors, "Reload colors", 'c' + end end ## the following magic enables wide characters when used with a ruby @@ -326,6 +331,11 @@ begin when :show_console b, new = bm.spawn_unless_exists("Console", :system => true) { ConsoleMode.new } b.mode.run + when :reload_colors + Colormap.reset + Colormap.populate_colormap + bm.completely_redraw_screen + bm.flash "reloaded colors" when :nothing, InputSequenceAborted when :redraw bm.completely_redraw_screen diff --git a/lib/sup/colormap.rb b/lib/sup/colormap.rb index d28c550..6f21f9a 100644 --- a/lib/sup/colormap.rb +++ b/lib/sup/colormap.rb @@ -68,11 +68,15 @@ class Colormap def initialize raise "only one instance can be created" if @@instance @@instance = self - @entries = {} @color_pairs = {[Curses::COLOR_WHITE, Curses::COLOR_BLACK] => 0} @users = [] @next_id = 0 + reset yield self if block_given? + end + + def reset + @entries = {} @entries[highlight_sym(:none)] = highlight_for(Curses::COLOR_WHITE, Curses::COLOR_BLACK, []) + [nil] -- 1.6.3.3 _______________________________________________ Sup-devel mailing list Sup-devel@rubyforge.org http://rubyforge.org/mailman/listinfo/sup-devel