>
> Ok - word wrap works, just not in the way I expected.
>
> If there are spaces in a line, then word wrap will break the line at a space 
> (insert a newline at a space). If there are no spaces in a line, however, 
> word wrap will not insert a newline, even if the text length is longer than 
> the visible area of the widget. If there are no spaces int the first line, 
> then, it looks like wrapping is disabled.
>
> It's not exactly a bug, but is this the way word wrapping is expected to work?
>
> Perhaps this has already been discussed, and I need to derive my own class?
>
> DLT
>

I've started a change/patch to r8507 as below, but it is incomplete (it breaks 
the scroll in drawtext or somewhere else). The goal is to wrap long lines of 
unbroken (un-spaced) text in an Fl_Multiline_Input widget.

I'll appreciate knowing if someone else has already been down this road.

DLT

--- ./Fl_Input_.cxx     2011-04-10 21:07:47.583326523 +1100
+++ ./Fl_Input_.cxx-changes     2011-04-10 21:46:39.475609700 +1100
@@ -81,7 +81,8 @@
     }

   } else while (o<e) {
-    if (wrap() && (p >= value_+size_ || isspace(*p & 255))) {
+    if (wrap()) {
+      if (p >= value_+size_ || isspace(*p & 255)) {
       word_wrap = w() - Fl::box_dw(box()) - 2;
       width_to_lastspace += (int)fl_width(lastspace_out, o-lastspace_out);
       if (p > lastspace+1) {
@@ -92,7 +93,11 @@
       }
       lastspace = p;
       lastspace_out = o;
+    } else if ((int)fl_width(buf, o-buf) > w() - Fl::box_dw(box()) - 2) {
+      p--; o--; *o = 0;
+      return p;
     }
+    } //end if wrap

     if (p >= value_+size_) break;
     int c = *p++ & 255;

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to