Skip to content

Surplus output in function 'Screen.Clear_To_End_Of_Line' ? #78

@wiremoons

Description

@wiremoons

Hi

UPDATED: the output described below only appears (so far) on the GNAT Studio messages window when using Build and run. The extra part described is not showing up in Gnome Terminal for example when the binary is run there using zsh.

In my Ada program I am calling the follow code:

--  prior code excluded
   --  initialise screen outputs wanted for colour support
   Screen.Init_For_Stdout (Auto);
   Screen.Init_For_Stderr (Auto);
   --  show colour output capabilities in debug mode
   pragma Debug (Put_Line (Standard_Error, "[DEBUG] Checking for colour terminal support..."));
   pragma Debug (Put_Line (Standard_Error, "[DEBUG] Colour support: " & (if Screen.Has_Colors then "YES" else "NO")));
   pragma Debug
     (Put_Line (Standard_Error, "[DEBUG] ANSI support: " & (if Screen.Has_ANSI_Colors then "YES" else "NO")));
   Screen.Clear_To_End_Of_Line;
--  following code excluded

This creates the output as follows:

[DEBUG] Checking for colour terminal support...
[DEBUG] Colour support: YES
[DEBUG] ANSI support: YES.
�[0K[DEBUG] build <remaining output deleted here>

The output includes some unexpected extra text: �[0K.

NB: The output after the extra unexpected text: �[0K (ie the [DEBUG] build <remaining output deleted here> part) is expected - it is from a later part of the program.

This extra element is being inserted by the call to Screen.Clear_To_End_Of_Line;.

Looking in the gnatcoll-core source at the function gnatcoll_clear_to_end_of_line in terminal.c line 112 the source of this extra output can be found at line 112:

if (write(forStderr ? 2 : 1, "\033[0K", 4) != 4) {

Is this supposed to be there, and is the output intended in that way?

The program is being built and run on Fedora Linux 38 (x86_64), and the full source code that is calling this function can be found here if usefule: password_manager.adb around line 242

Thanks for your help.

Simon

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions