Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
* [sup-devel] [PATCH] buffer: throw "friendly" exception if question is too long
@ 2011-01-18 18:26 Sascha Silbe
  2011-01-19  3:41 ` Rich Lane
  0 siblings, 1 reply; 2+ messages in thread
From: Sascha Silbe @ 2011-01-18 18:26 UTC (permalink / raw)
  To: sup-devel

If a question is too long to fit on screen, the buffer manager currently
throws a hard-to-understand exception deep down in the buffer logic.
Explicitly checking for this condition and throwing a descriptive exception
makes life easier for hook authors.

Signed-off-by: Sascha Silbe <sascha-pgp@silbe.org>
---
 lib/sup/buffer.rb |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/lib/sup/buffer.rb b/lib/sup/buffer.rb
index d1fef5a..25ea132 100644
--- a/lib/sup/buffer.rb
+++ b/lib/sup/buffer.rb
@@ -575,6 +575,7 @@ EOS
   ## screen
   def ask domain, question, default=nil, &block
     raise "impossible!" if @asking
+    raise "Question too long" if Ncurses.cols <= question.length
     @asking = true
 
     @textfields[domain] ||= TextField.new
-- 
1.7.2.3

_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel


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

end of thread, other threads:[~2011-01-19  5:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-18 18:26 [sup-devel] [PATCH] buffer: throw "friendly" exception if question is too long Sascha Silbe
2011-01-19  3:41 ` Rich Lane

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