Ticket #4258 (accepted defect)

Opened 3 years ago

Last modified 2 years ago

Wrong subshell prompt parsing with fish 3.3.0

Reported by: olfway Owned by: andrew_b
Priority: major Milestone: Future Releases
Component: mc-core Version: master
Keywords: Cc:
Blocked By: Blocking:
Branch state: on rework Votes for changeset:

Description

Fish 3.3.0 sends \r while printing prompt and mc erases prompt buffer

This change was introduced by https://github.com/fish-shell/fish-shell/pull/8011

It starts working after I modify parse_subshell_prompt_string function:

     /* Extract the prompt from the shell output */
     for (i = 0; i < bytes; i++)
-        if (buffer[i] == '\n' || buffer[i] == '\r')
+        if (buffer[i] == '\n')
             g_string_set_size (subshell_prompt_temp_buffer, 0);
         else if (buffer[i] != '\0')
             g_string_append_c (subshell_prompt_temp_buffer, buffer[i]);

Attachments

fish-3.3.0-prompt.png (29.6 KB) - added by olfway 3 years ago.

Change History

Changed 3 years ago by olfway

comment:1 Changed 3 years ago by andrew_b

  • Status changed from new to accepted
  • Owner set to andrew_b
  • Branch state changed from no branch to on review

Branch: 4258_fish_shell_prompt
changeset:e819ed742118dd4b9fc7d37e82830118df366ca4

Please test.

comment:2 Changed 3 years ago by olfway

I tried to run it and unfortunately it doesn't work - same empty prompt

So dumped buffer to a temporary file:

/W/l/m/mc^[(B^[[m (4258_fish_shell_prompt)^[(B^[[m> ^[[K^M^[[53C

and tried to "translate" this:

/W/l/m/mc                - Text
^[(B                     - Start sequence defining G0 character set, Select default (ISO 8859-1 mapping)
^[[m                     - Select Graphic Rendition, reset all attributes to their defaults
(4258_fish_shell_prompt) - Text
^[(B                     - Start sequence defining G0 character set, Select default (ISO 8859-1 mapping)
^[[m                     - Select Graphic Rendition, reset all attributes to their defaults
>                        - Text
^[[K                     - Erase line (default: from cursor to end of line).
^M                       - Carriage Return, moves the cursor to column zero
^[[53C                   - Move cursor right the indicated # of columns (53 here)
Version 0, edited 3 years ago by olfway (next)

comment:3 Changed 3 years ago by olfway

This for example multiline prompt (same empty prompt in mc):

2m~/W/l/m/mc^[(B^[[m|^[[31m4258_fish_shell_prompt⚡^[[34m*^[[33m?^[(B^[[m^M
➤ ^[(B^[[m^[[K^M^[[C^[[C

Actually it looks truncated, it probably should be like

user123@host123:~/W/l/m/mc|4258_fish_shell_prompt⚡*?
➤

comment:4 Changed 3 years ago by andrew_b

  • Branch state changed from on review to on rework

comment:5 Changed 2 years ago by olfway

9 months passed and it still broken :(

Any chances it could be fixed?

I had custom mc build with my change (as in description) and it works perfectly

comment:6 Changed 2 years ago by andrew_b

Related to #3121.

Note: See TracTickets for help on using tickets.