Empyreus / lanterna

Automatically exported from code.google.com/p/lanterna
GNU Lesser General Public License v3.0
0 stars 0 forks source link

TextBox can't be used without specifying forceWidth #19

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
While testing some components in a small demo-application i tried to use the 
TextBox,i tried using the constructor:

    TextBox(String initialContent)

that is provided in the library,but i find out it cant be used without using 
the constructor:

    TextBox(int forceWidth,String initialContent) 

or it gives a "Exception in thread "main" java.lang.IllegalArgumentException: 
TerminalSize.columns cannot be less than 0! [...]"

To temporally fix the problem i used the other constructor,the one with "int 
forceWidth" specified and it seems to work.

    public TextBox(String initialContent)
    {
        this(-1, initialContent); //this -1 seems to cause the problem
    }

To fix it in a definitive way i took the lanterna sources and modified the line 
(TextBox.java,line 47) and modified the -1 to 0. I hope this may help someone 
:) 
I still not sure it was the right solution,maybe there is something more 
intelligent to do :P !

Original issue reported on code.google.com by zer0.c...@gmail.com on 14 Jul 2012 at 6:02

GoogleCodeExporter commented 9 years ago
Ah, yeah, that's a bug! Thank you, I'll fix that today.

Original comment by mab...@gmail.com on 15 Jul 2012 at 1:21

GoogleCodeExporter commented 9 years ago
Fixed on 2.0.x branch and default

Original comment by mab...@gmail.com on 15 Jul 2012 at 2:48