sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit a0f3184058d499fe767425e44269319dcf9ff600
parent 3b17d520ae6303a53533381633fe26eecbabec69
Author: Sascha Silbe <sascha-pgp@silbe.org>
Date:   Tue, 18 Jan 2011 19:26:37 +0100

buffer: throw "friendly" exception if question is too long

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 

Diffstat:
M lib/sup/buffer.rb | 1 +
1 file changed, 1 insertion(+), 0 deletions(-)
diff --git 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