FLTK logo

[fltk/fltk] Fl_Simple_Terminal::append(str, len) assumes a null terminated string in non-ansi mode (Issue #728)

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.issues  ]
 
Previous Message ]New Message | Reply ]Next Message ]

[fltk/fltk] Fl_Simple_Terminal::append(str, len) assumes a null terminated string in non-ansi mode (Issue #728) Mohammed Alyousef May 04, 2023  
 

Is your feature request related to a problem? Please describe.
Given the following program:

#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Simple_Terminal.H>

const char *MSG = "Hello World";

int main() {
    auto w = new Fl_Window(400, 300);
    auto t = new Fl_Simple_Terminal(0, 0, 400, 300);
    t->append(MSG, 5);
    w->end();
    w->show();
    return Fl::run();
}

in FLTK 1.4, the signature of append implies that when passed a length, the length will be adhered to.
However this will print the whole message (until null termination). Which I would say is unintuitive and might be a source of issues.

I am using FLTK

  • Version 1.4.0

Describe the solution you'd like
I would suggest that the append method adhere to the passed length in non-ansi mode.

Describe alternatives you've considered
The alternative would be to allocate new strings just to add null termination, which might be undesirable.

Additional context
N/A


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <fltk/fltk/issues/728@github.com>

Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.