Re: [fltk.bugs] [HIGH] STR #2761: Force break when wrapping long words

2012-04-21 Thread Fabien Costantini

DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2761
Version: 1.3-current


If possible, that would be great _not_ have a new option for a bug fix.
Is there any downside of of fixing that problem in terms of backward
compability (i.e. would it break 1.1 source compatibility)  without adding
a new mode that fiexs it ?


Link: http://www.fltk.org/str.php?L2761
Version: 1.3-current

___
fltk-bugs mailing list
fltk-bugs@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-bugs


Re: [fltk.bugs] [HIGH] STR #2761: Force break when wrapping long words

2011-12-12 Thread David

DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2761
Version: 1.3-current


I thought fl_choice had the problem too, I could have sworn it cut it off. 
I think I know why, the string had an @ in it and it was cutoff because of
that, when I applied one of the @ fixes, it must have still been limiting
width to the @ sign then not wrapping the rest.  Anyway, you can cause the
problem with the code being attached.  Uncomment the line after applying
the patch to see the fix work.


Link: http://www.fltk.org/str.php?L2761
Version: 1.3-current

___
fltk-bugs mailing list
fltk-bugs@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-bugs


Re: [fltk.bugs] [HIGH] STR #2761: Force break when wrapping long words

2011-12-12 Thread David
DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2761
Version: 1.3-current


Attached file test_v2.cxx...


Link: http://www.fltk.org/str.php?L2761
Version: 1.3-current#include FL/Fl.H
#include FL/Fl_Window.H
#include FL/Fl_Box.H
#include FL/fl_draw.H

int main() {
//fl_force_wrap_breaks=1;
Fl_Window *win = new Fl_Window(410,250);
Fl_Box *box = new Fl_Box(60, 25, 340, 200);
box-align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE|FL_ALIGN_WRAP);
box-label(The path is: 
How/about/a/long/path/that/has/no/spaces/in/it/but/you/want/to/ensure/the/full/path/shows/when/it/is/displayed/on/the/message.);
win-end();
win-show();

return(Fl::run());
}
___
fltk-bugs mailing list
fltk-bugs@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-bugs


Re: [fltk.bugs] [HIGH] STR #2761: Force break when wrapping long words

2011-12-12 Thread Greg Ercolano

DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2761
Version: 1.3-current


Sounds like maybe we need an FL_ALIGN_WRAP_HARD
to hard break lines. This could then be backwards compatible.


Link: http://www.fltk.org/str.php?L2761
Version: 1.3-current

___
fltk-bugs mailing list
fltk-bugs@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-bugs


Re: [fltk.bugs] [HIGH] STR #2761: Force break when wrapping long words

2011-12-12 Thread David

DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2761
Version: 1.3-current


needs to work any time you want to call on fl_measure ( in addition to
fl_draw or fl_expand_text) so would need additional code to handle a new
option.  The current patch is already backwards compatible in that the app
has to set the option on for it to do anything (and doesn't require adding
additional parameters).  I think of it as more a fix than feature, only
making backwards compatible to not break things based off the one that
miscalculated wrapping.


Link: http://www.fltk.org/str.php?L2761
Version: 1.3-current

___
fltk-bugs mailing list
fltk-bugs@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-bugs


Re: [fltk.bugs] [HIGH] STR #2761: Force break when wrapping long words

2011-12-11 Thread Greg Ercolano

DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2761
Version: 1.3-current


Can't replicate with OP's text; try test.cxx attached.


Link: http://www.fltk.org/str.php?L2761
Version: 1.3-current

___
fltk-bugs mailing list
fltk-bugs@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-bugs


Re: [fltk.bugs] [HIGH] STR #2761: Force break when wrapping long words

2011-12-11 Thread Greg Ercolano
DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2761
Version: 1.3-current


Attached file test.cxx...


Link: http://www.fltk.org/str.php?L2761
Version: 1.3-current#include FL/Fl.H
#include FL/fl_ask.H
int main() {
fl_choice(The path is: 
How/about/a/long/path/that/has/no/spaces/in/it/but/you/want/to/ensure/the/full/
  
xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/
  
xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/
  
xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/xxx/yyy/
  path/shows/when/it/is/displayed/on/the/message.,Cancel, OK, 
NULL);
return(Fl::run());
}
___
fltk-bugs mailing list
fltk-bugs@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-bugs


Re: [fltk.bugs] [HIGH] STR #2761: Force break when wrapping long words

2011-12-10 Thread Matthias Melcher

DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2761
Version: 1.3-current


Could you please add a short self-contained test program? Just to verify
that I correctly understand the issue, and so that I can test UTF8.


Link: http://www.fltk.org/str.php?L2761
Version: 1.3-current

___
fltk-bugs mailing list
fltk-bugs@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-bugs


Re: [fltk.bugs] [HIGH] STR #2761: Force break when wrapping long words

2011-12-10 Thread David

DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2761
Version: 1.3-current


Just use fl_choice with a long string with no white space.  

The path is:
How/about/a/long/path/that/has/no/spaces/in/it/but/you/want/to/ensure/the/full/path/shows/when/it/is/displayed/on/the/message.


Link: http://www.fltk.org/str.php?L2761
Version: 1.3-current

___
fltk-bugs mailing list
fltk-bugs@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-bugs


[fltk.bugs] [HIGH] STR #2761: Force break when wrapping long words

2011-11-03 Thread David
DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2761
Version: 1.3-current


This adds an option to force long words to break if they don't fit the
width in fl_expand_text (which is used by the various fl_draw and
fl_measure functions).  This is especially helpful in things like
fl_choice or other situations where all data must show. The option is
enabled by setting fl_force_wrap_breaks=1.  This was lightly tested
against some strings that were causing fl_choice to cut off text. Full
test probably needed, especially against non-printable data ( ' ' or 127)
that is converted to ^X format.


Link: http://www.fltk.org/str.php?L2761
Version: 1.3-currentIndex: FL/fl_draw.H
===
--- FL/fl_draw.H(revision 9166)
+++ FL/fl_draw.H(working copy)
@@ -34,7 +34,9 @@
 
 // Label flags...
 FL_EXPORT extern char fl_draw_shortcut;
+FL_EXPORT extern char fl_force_wrap_breaks; // option set by app and/or widgets
 
+
 /** \addtogroup fl_attributes
 @{
 */
Index: src/fl_draw.cxx
===
--- src/fl_draw.cxx (revision 9166)
+++ src/fl_draw.cxx (working copy)
@@ -32,9 +32,13 @@
 #include ctype.h
 #include math.h
 
+// GCC nor FLTK build environment set NDEBUG on release builds.
+//#include assert.h
+
 #define MAXBUF 1024
 
 char fl_draw_shortcut; // set by fl_labeltypes.cxx
+char fl_force_wrap_breaks; // option set by app and/or widgets
 
 static char* underline_at;
 
@@ -119,11 +123,36 @@
   // test for word-wrap:
   if (word_start  p  wrap) {
double newwidth = w + fl_width(word_end, o-word_end);
-   if (word_end  buf  newwidth  maxw) { // break before this word
+// determine if line too long
+if (newwidth  maxw) {
+  // determine if prior word output that fits
+  if (word_end  buf) {
+// go back to the end of the prior word
  o = word_end;
  p = word_start;
  break;
}
+  // determine if this line has no spaces and is too long
+  else if (word_end == buf  fl_force_wrap_breaks) {
+// truncate to maxw
+while (newwidth  maxw  p  word_start) {
+  // move back to prior char
+  o--;
+  p--;
+  // handle encoded characters in output buffer
+  int tc=*p  255;
+  if (tc  ' ' || tc == 127) {
+o--;
+  }
+  // sanity check in debugging mode
+  //assert(o = buf);
+  // calculate new width again
+  newwidth = w + fl_width(word_end, o-word_end);
+}
+// leave the rest of this long word for the next line
+break;
+  }
+}
word_end = o;
w = newwidth;
   }
___
fltk-bugs mailing list
fltk-bugs@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-bugs