Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wiremoons opened this issue Sep 23, 2023 · 1 comment
Open

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

wiremoons opened this issue Sep 23, 2023 · 1 comment

Comments

@wiremoons
Copy link

wiremoons commented Sep 23, 2023

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

@Jicquel
Copy link
Collaborator

Jicquel commented Mar 26, 2024

Hello @wiremoons, thank you for opening up this issue. This is clearly a bug. You can either contribute with a patch that we would be happy to merge or wait for us to fix it on our side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants