dyna icon indicating copy to clipboard operation
dyna copied to clipboard

special color for user input in REPL

Open jeisner opened this issue 11 years ago • 5 comments

Could user input be shown at the REPL in a special color? Or perhaps in bold? It's nice to distinguish input from output when scrolling. And it would also be helpful to distinguish them in doctests and when showing REPL traces in the tutorial or manual.

(If user input needs to be in the default color, I imagine everything else could be in a special color ...)

jeisner avatar Jul 25 '13 02:07 jeisner

How about a compromise: only the > will be a special color. This is what other REPLs seem to do (e.g. IPython, bash terminals are often configures to have colorful PS1).

timvieira avatar Jul 25 '13 17:07 timvieira

Compromise because what I suggested is hard? The compromise is better than what we have now, but the version I suggested seems nicer if we could get it. Especially better for distinguishing input from output in the manual, and for clarifying where there's multi-line input.

jeisner avatar Jul 25 '13 18:07 jeisner

Compromise because what I suggested is hard?

Yup. It's pretty tricky to get colors in the terminal to be well-behaved. For example, If you ^C in the middle of an ANSI control code, it will break your terminal (e.g. you wont be able to see what your typing). Limiting the use of color is generally a good idea. This is why you don't tend to see very many colorful terminal applications (unless it's curses).

timvieira avatar Jul 25 '13 18:07 timvieira

Should probably xref:#11

timvieira avatar Jul 26 '13 20:07 timvieira

Seems like the ^C problem would bite us for using any amount of color: limiting the amount doesn't really fix it, does it? But to fix it, isn't there a reset-terminal ANSI code that we could emit after ^C?

How about the idea of having user input in the default color, but all output in other colors? Does that help? The output is pretty darn colorful already ...

jeisner avatar Jul 26 '13 21:07 jeisner