p-e-w / finalterm

At last – a modern terminal emulator (NO LONGER MAINTAINED)
http://finalterm.org
GNU General Public License v3.0
3.84k stars 179 forks source link

[Minor] Toggle button remains red after errors followed by blank lines #377

Closed arkocal closed 9 years ago

arkocal commented 9 years ago

Steps to reproduce: Give a command that returns an error code. Press enter.

It works correctly again after a command executes successfully.

p-e-w commented 9 years ago

Confirmed.

arkocal commented 9 years ago

Seems like this is not a GUI issue (at least not caused by anything GUI related). Moving the cursor over the dot also creates the popup with the last error code. I guess this is related to lines 391 and 396 in TerminalOutput.vala last_command = stream_element.get_text_parameter(0, ""); var return_code = stream_element.get_numeric_parameter(0, 0); Both return the correct values for latest executed command.

p-e-w commented 9 years ago

Yes, the problem is actually on the shell level, because bash itself does not reset the the value of $? until another command is executed.

p-e-w commented 9 years ago

Fixed in https://github.com/p-e-w/finalterm/commit/39b078b2a96a5c3c9e74f92b1929f383d220ca8b.

p-e-w commented 9 years ago

This was a much deeper issue than originally suspected. Here's the full story:

  1. Newer versions of VTE install a __vte_prompt_command function in the PROMPT_COMMAND variable. Because the preexec script was appending to rather than overriding this variable, the built-in check for no-op lines did not work.
  2. Once that was fixed, Final Term's prompt detection failed because now it was no longer getting notified of no-op commands. Adding a dummy invocation of the hook fixed that problem too.

Basically, one bug was hiding another bug. Now, both bugs are fixed.