pashapm / lanterna

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

Character fill is not configurable #66

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
For a text terminal with a minimal UI, a common styling of text input field is 
by periods or underlines rather than borders. 

TextBox and TextArea hard code the space character when calling fillArea. I 
tested using a period instead and this works.

I'm not sure what is the best way to allow this to be configurable. In my 
opinion it should be part of a theme definition, which TextGraphics uses to get 
the fill character. I made the changes and attached a patch for this, 
introducing an optional DefinitionBuilder. Not a minimal change, but hope it 
helps.

Original issue reported on code.google.com by sivan.mo...@gmail.com on 30 Jan 2013 at 12:39

Attachments:

GoogleCodeExporter commented 9 years ago
I'm using the new DefinitionBuilder in my code, but left it out of the patch.

Original comment by sivan.mo...@gmail.com on 30 Jan 2013 at 12:50

Attachments:

GoogleCodeExporter commented 9 years ago
Yes, that's a good point, something to add for the reworked theme system.

Original comment by mab...@gmail.com on 30 Jan 2013 at 12:53

GoogleCodeExporter commented 9 years ago
I just wanted to elaborate a bit. This is actually a serious problem for 
monochrome terminals, which cannot color the input field. They are rendered in 
white over white background--invisible. A similar problem affects focus 
rendering.

I've managed to set the fill character and also set the focus mode to render 
characters in REVERSE, using some elaborate adapter classes. Monochrome screens 
look good now, just wish it was a bit easier.

Original comment by sivan.mo...@gmail.com on 1 Apr 2014 at 6:23

GoogleCodeExporter commented 9 years ago
I understand, yes, it should be easier. I've added a new method to TextBox - 
setFillCharacter - which should make it easier to customize what to do with the 
empty spaces. Also, even though the current theme system isn't very useful, I 
think you should be able to solve the color problem by creating a new theme 
(make a new class extending Theme) and customizing what colors to use for 
TEXTBOX and TEXTBOX_FOCUSED categories.

Original comment by mab...@gmail.com on 13 Apr 2014 at 12:38