Fix: Wrapped Multiline Input/Output scrolls horizontally at the edges (#1414)
Build and Test / build-linux (push) Has been cancelled
Build and Test / build-wayland (push) Has been cancelled
Build and Test / build-macos (push) Has been cancelled
Build and Test / build-windows (push) Has been cancelled

This commit is contained in:
ManoloFLTK
2026-04-20 13:03:51 +02:00
parent d8c7c72899
commit de5eed9847
+5 -5
View File
@@ -139,7 +139,7 @@ const char* Fl_Input_::expand(const char* p, char* buf) const {
char* e = buf+(MAXBUF-4);
const char* lastspace = p;
char* lastspace_out = o;
int width_to_lastspace = 0;
double width_to_lastspace = 0;
int word_count = 0;
int word_wrap;
// const char *pe = p + strlen(p);
@@ -155,10 +155,10 @@ const char* Fl_Input_::expand(const char* p, char* buf) const {
} else while (o<e) {
if (wrap() && (p >= value_+size_ || isspace(*p & 255))) {
word_wrap = w() - Fl::box_dw(box()) - 5; // 5 px space for cursor (#1414)
width_to_lastspace += (int)fl_width(lastspace_out, (int) (o-lastspace_out));
word_wrap = w() - Fl::box_dw(box()) - 4;
width_to_lastspace += fl_width(lastspace_out, (int) (o-lastspace_out));
if (p > lastspace+1) {
if (word_count && width_to_lastspace > word_wrap) {
if (word_count && (int)width_to_lastspace > word_wrap) {
p = lastspace; o = lastspace_out; break;
}
word_count++;
@@ -362,7 +362,7 @@ void Fl_Input_::drawtext(int X, int Y, int W, int H, bool draw_active) {
} else if (curx < newscroll+threshold) {
newscroll = curx-threshold;
}
if (newscroll < 0) newscroll = 0;
if (newscroll < 0 || ((type() & FL_MULTILINE_INPUT) && (type() & FL_INPUT_WRAP))) newscroll = 0;
if (newscroll != xscroll_) {
xscroll_ = newscroll;
mu_p = 0; erase_cursor_only = 0;