[1.3b64] <textarea> wrapping

Confirmed bugs should get a single post here. Check the READ ME FIRST sticky thread for the format.

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice, MapTool BugReport Manager

Forum rules
Posts that do not conform to the READ ME FIRST sticky thread are subject to deletion.
Post Reply
kkragenbrink
Cave Troll
Posts: 33
Joined: Mon May 03, 2010 3:03 am
Location: Los Angeles, CA

[1.3b64] <textarea> wrapping

Post by kkragenbrink »

Originally posted here and marked as resolved; however, this problem still exists:
1) The wrap option of this object does not seem to do anything. I have tried wrap=on, wrap=hard, wrap=soft, nothing seems to enable the word wrapping.

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: [1.3b64] <textarea> wrapping

Post by Azhrei »

If I can I'll look into this. No promises for b65 though. If Trevor thought it was fixed, I'm not sure that I'll be able to do any better. It may simply be that the Swing library doesn't implement that attribute...

kkragenbrink
Cave Troll
Posts: 33
Joined: Mon May 03, 2010 3:03 am
Location: Los Angeles, CA

Re: [1.3b64] <textarea> wrapping

Post by kkragenbrink »

I haven't touched Java in a long long time, but it looks like there's a setLineWrap(boolean) and a setWrapStyleWord(boolean) which might do the trick. Even if you can't support SOFT and HARD, just a simple wrap=OFF -- setLineWrap(false) and wrap=ON -- setLineWrap(false) might be useful.

Off topic, are there instructions for contributing patches? I could actually probably look into this myself, but lacking a surefire way for how to get patches in I didn't want to go through the work if I couldn't put it somewhere useful.

kkragenbrink
Cave Troll
Posts: 33
Joined: Mon May 03, 2010 3:03 am
Location: Los Angeles, CA

Re: [1.3b64] <textarea> wrapping

Post by kkragenbrink »

And then I find the answer myself on the FAQ. I'll look into this bug myself. :) You focus on more interesting features, mebbe. :D

kkragenbrink
Cave Troll
Posts: 33
Joined: Mon May 03, 2010 3:03 am
Location: Los Angeles, CA

Re: [1.3b64] <textarea> wrapping

Post by kkragenbrink »

Update: I've got it wrapping ALL the time, now. The problem is with the implementation of createComponent() in javax.swing.text.html.FormView. A very small override fixes that.

HOWEVER. Ideally we would like to have the WRAP attribute read properly. Problem: the wrap property does not exist in javax.swing.text.text.StyleConstants, therefore I do not know how to get the 'uncommon' attribute.

I'll keep plugging at it, but if someone knows how to pull the attribute from the element, that'd be great.

User avatar
Raoden
Dragon
Posts: 381
Joined: Fri Dec 18, 2009 2:33 am
Location: San Diego

Re: [1.3b64] <textarea> wrapping

Post by Raoden »

FWIW, I think "always wrapping" is much nicer than "never wrapping."
"Fairy tales do not tell children the dragons exist. Children already know that dragons exist. Fairy tales tell children the dragons can be killed."
- G. K. Chesterton

Wonderful HTML/CSS reference * Color Manager * Token Manager 2.0

User avatar
Rumble
Deity
Posts: 6235
Joined: Tue Jul 01, 2008 7:48 pm

Re: [1.3b64] <textarea> wrapping

Post by Rumble »

Raoden wrote:FWIW, I think "always wrapping" is much nicer than "never wrapping."
Ditto.

kkragenbrink
Cave Troll
Posts: 33
Joined: Mon May 03, 2010 3:03 am
Location: Los Angeles, CA

Re: [1.3b64] <textarea> wrapping

Post by kkragenbrink »

Yeah, that's what I have right now. I'm pretty sure that without an override to javax.swing.text.HTML.Attributes, "optional" won't happen. I'm going to make the override to that in my local copy, but I don't know how interested TPTB will be in including that override in the main core.

FWIW, the following patch sets it to 'always overridde':
http://src.writh.net/textwrap.patch

I'd love it if someone would test it to make sure I didn't screw up; I'm /really/ rusty in Java.

kkragenbrink
Cave Troll
Posts: 33
Joined: Mon May 03, 2010 3:03 am
Location: Los Angeles, CA

Re: [1.3b64] <textarea> wrapping

Post by kkragenbrink »

Double post to add: Did I mention javax.swing.text.HTML is final? Yeah. It's not fun. :(

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: [1.3b64] <textarea> wrapping

Post by Azhrei »

Yeah, there's a bunch of stupid stuff in the internals of Java. Like a bunch of nested classes inside BasicUI classes that are private. :( Until Java 6 a bunch of the drag-n-drop support was implemented that way.

I looked at the patch and it looks fine (out of context) but with word wraping turned on you should probably change JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED to HORIZ_NEVER (or whatever the proper name is). With word wrapping there is never a need for horizontal scrollbars, but I understand you likely left it there in case someone figures out how to do it without hard-coding it. :)

kkragenbrink
Cave Troll
Posts: 33
Joined: Mon May 03, 2010 3:03 am
Location: Los Angeles, CA

Re: [1.3b64] <textarea> wrapping

Post by kkragenbrink »

Yeah, and that actually was a change anyways, since the main code has HORIZ_ALWAYS (and VERTICAL_ALWAYS). But yes, I left it in there just in case we happen to figure out how to fix this properly. Trying to think ahead.

So should I email this patch to trevor, or is here good enough?

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: [1.3b64] <textarea> wrapping

Post by Azhrei »

I guess you sent it to him 'cuz he forwarded it to me. ;) He said he had a bunch of stuff for me so we'll see how much of it makes it into my inbox. 8)

Attaching a patch here is usually good enough and it let's others who are playing with the source code try it out as well, if they wish. So I recommend leaving it here.

If I don't post in the thread then it's a good idea to PM me with a link to the post that has the attachment. In general if I see some code posted I download it and squirrel it away in my "MapTool Patches" directory for future review, unless the author makes it clear that it's not ready for prime time because they want to get some feedback and then make some changes...

nirkedar
Cave Troll
Posts: 52
Joined: Tue Sep 21, 2010 3:13 pm

Re: [1.3b64] <textarea> wrapping

Post by nirkedar »

Did this issue ever get resolved?
I just want to know how to have my textarea control wrap.

Post Reply

Return to “Bug Reports”