lyxNotebook icon indicating copy to clipboard operation
lyxNotebook copied to clipboard

Sage out of sync

Open ItayXD opened this issue 5 years ago • 1 comments

Hi, I find the sage option completely out of sync. I get extra 2 empty lines after the sage prompt so added os.read(self.fd, max_bytes).decode("utf-8").rstrip() and mine is also colored so I had to strip off the color with re.sub(r'\x1b(\[.*?[@-~]|\].*?(\x07|\x1b\\))', '', read_string) and lastly I had to remove the space as defined on the prompet. It still is out of sync most of the time, I don't know whether it's the timing or something else, but it's not reliable on my system.

ItayXD avatar Apr 15 '20 23:04 ItayXD

Sage cells haven't been tested in a while. As you found, Sage has since added ANSI colors to the output which messes up the prompt detection. The color-code removing regexes I tried from the internet didn't quite work. (Sage startup also seems to have gotten quite slow on the recent version.)

As a temporary workaround, it works for me to create a sage script in the PATH which then runs something like /usr/bin/sage "$@" | cat. Color coding is then stripped from the prompt (but unfortunately not from any syntax-error messages).

abarker avatar Apr 16 '20 11:04 abarker