Change marks to store a command string and error code. Set them from finalterm codes. Use a red mark for error codes not equal to 0. Marks get a context menu showing what's known about the associated command.
Fix off by one error for finding pwd for a line. Handle final term return code escape code.