Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
* [PATCHES] more utf + whitespace
@ 2010-11-09 10:19 Gaute Hope
  2010-11-15  4:16 ` [sup-devel] " Rich Lane
  0 siblings, 1 reply; 2+ messages in thread
From: Gaute Hope @ 2010-11-09 10:19 UTC (permalink / raw)
  To: sup-devel

[-- Attachment #1: Type: text/plain, Size: 261 bytes --]

Hi,

attached is another patch fixing a crash first tab completing an UTF-8
contact; then an ASCII contact.

Also some whitespace corrections for lib/sup/buffer.rb

Also available on:
http://git.gitorious.org/~gauteh/sup/gautehs-mainline.git (master)


- gaute

[-- Attachment #2: 0001-Fix-Whitespace-errors-in-buffer.rb.patch --]
[-- Type: application/octet-stream, Size: 2393 bytes --]

From 7c5bcb6d41698a565f99c1ea3e25e170402e7ba6 Mon Sep 17 00:00:00 2001
From: Gaute Hope <eg@gaute.vetsj.com>
Date: Tue, 9 Nov 2010 11:05:10 +0100
Subject: [PATCH 1/2] Fix Whitespace errors in buffer.rb

---
 lib/sup/buffer.rb |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/lib/sup/buffer.rb b/lib/sup/buffer.rb
index c36ca56..ee32f1e 100644
--- a/lib/sup/buffer.rb
+++ b/lib/sup/buffer.rb
@@ -100,7 +100,7 @@ class Buffer
 
   def redraw status
     if @dirty
-      draw status 
+      draw status
     else
       draw_status status
     end
@@ -226,7 +226,7 @@ EOS
 
   def focus_on buf
     return unless @buffers.member? buf
-    return if buf == @focus_buf 
+    return if buf == @focus_buf
     @focus_buf.blur if @focus_buf
     @focus_buf = buf
     @focus_buf.focus
@@ -352,7 +352,7 @@ EOS
   ## creates a new buffer. returns two things: the buffer, and a boolean
   ## indicating whether it's a new buffer or not.
   def spawn_unless_exists title, opts={}
-    new = 
+    new =
       if @name_map.member? title
         raise_to_front @name_map[title] unless opts[:hidden]
         false
@@ -460,7 +460,7 @@ EOS
 
   def ask_many_with_completions domain, question, completions, default=nil
     ask domain, question, default do |partial|
-      prefix, target = 
+      prefix, target =
         case partial
         when /^\s*$/
           ["", ""]
@@ -595,7 +595,7 @@ EOS
 
       if tf.new_completions?
         kill_buffer completion_buf if completion_buf
-        
+
         shorts = tf.completions.map { |full, short| short }
         prefix_len = shorts.shared_prefix.length
 
@@ -612,7 +612,7 @@ EOS
 
       Ncurses.sync { Ncurses.refresh }
     end
-    
+
     kill_buffer completion_buf if completion_buf
 
     @dirty = true
@@ -693,12 +693,12 @@ EOS
 
   def minibuf_lines
     @minibuf_mutex.synchronize do
-      [(@flash ? 1 : 0) + 
+      [(@flash ? 1 : 0) +
        (@asking ? 1 : 0) +
        @minibuf_stack.compact.size, 1].max
     end
   end
-  
+
   def draw_minibuf opts={}
     m = nil
     @minibuf_mutex.synchronize do
@@ -800,7 +800,7 @@ private
 
     statusbar_text = HookManager.run("status-bar-text", opts) || default_status_bar(buf)
     term_title_text = HookManager.run("terminal-title-text", opts) || default_terminal_title(buf)
-    
+
     [statusbar_text, term_title_text]
   end
 
-- 
1.7.3.2


[-- Attachment #3: 0002-UTF-8-Force-UTF-8-in-ask_many_emails.patch --]
[-- Type: application/octet-stream, Size: 1199 bytes --]

From 4f552d9ac51fe200c5cbef3f8a5a3cf875a563af Mon Sep 17 00:00:00 2001
From: Gaute Hope <eg@gaute.vetsj.com>
Date: Tue, 9 Nov 2010 11:06:04 +0100
Subject: [PATCH 2/2] [UTF-8] Force UTF-8 in ask_many_emails..

A mix-up occurs when you first tab complete a UTF-8 contact, then try to
complete an ASCII encoded contact.

They are all stored as UTF-8 in file and when loaded - but will
apparently be converted to ASCII if possible when a Person object is
created.
---
 lib/sup/buffer.rb |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/lib/sup/buffer.rb b/lib/sup/buffer.rb
index ee32f1e..d1fef5a 100644
--- a/lib/sup/buffer.rb
+++ b/lib/sup/buffer.rb
@@ -481,7 +481,10 @@ EOS
       prefix, target = partial.split_on_commas_with_remainder
       target ||= prefix.pop || ""
       target.force_encoding 'UTF-8' if target.methods.include?(:encoding)
+
       prefix = prefix.join(", ") + (prefix.empty? ? "" : ", ")
+      prefix.force_encoding 'UTF-8' if prefix.methods.include?(:encoding)
+
       completions.select { |x| x =~ /^#{Regexp::escape target}/i }.sort_by { |c| [ContactManager.contact_for(c) ? 0 : 1, c] }.map { |x| [prefix + x, x] }
     end
   end
-- 
1.7.3.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [sup-devel] [PATCHES] more utf + whitespace
  2010-11-09 10:19 [PATCHES] more utf + whitespace Gaute Hope
@ 2010-11-15  4:16 ` Rich Lane
  0 siblings, 0 replies; 2+ messages in thread
From: Rich Lane @ 2010-11-15  4:16 UTC (permalink / raw)
  To: Gaute Hope; +Cc: sup-devel

Applied to master.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-11-15  4:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-09 10:19 [PATCHES] more utf + whitespace Gaute Hope
2010-11-15  4:16 ` [sup-devel] " Rich Lane

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox