CE-Programming / CEmu

Third-party TI-84 Plus CE / TI-83 Premium CE emulator, focused on developer features
https://ce-programming.github.io/CEmu/
Other
1.07k stars 76 forks source link

Colored/formatted text in console, uppercase pointers, & navigatable pointers. #151

Closed KryptonicDragon closed 6 years ago

KryptonicDragon commented 6 years ago

After a certain amount of debug outputs, the console will start to take a bit more effort to read. image It'd be nice if there was a way to output colored text to the console (besides the black dbgout and red dbgerr). It'd be nicer if text formatting (bold, underline, italics, strike-through) were also possible (but that might just be stretching it, colors would be more useful.) I thought of two ways to do this, one way would be done via CEmu's side. The user would have settings in CEmu to choose colors for certain things, I.E, all unsigned integers (%u) could be set to blue, or all pointers (%p) could be set to green, or all strings (%s) could be set to orange, etc. The other way I thought of doing this would be from the debug program's side, where certain characters/commands would be used in the dbg_sprintf commands to signify what color to print what in.

Also, if pointers were displayed with uppercase letters instead of lowercase ones, it'd be easier to distinguish them from the surrounding text (provided the surrounding text is in lowercase, which is more likely than not).

Last suggestion, clicking on pointers in the console (ones printed with %p in dbg_sprintf) would pause emulation (as if user had hit the stop button in debug control), open the memory view (if it's one of the tabs or visible panels), and navigate to the location in memory that is being pointed to.

Just a few suggestions, if they're too much effort, that's fine. :D

runer112 commented 6 years ago

The console just gets a raw string. The formatting is done by your program and the "source" format is not available to the console. So automatically highlighting different format specifiers is not possible. It could be possible to support explicit coloring (you print extra control characters in the debug string), but I wouldn't be the one to know how to do this.

To display a pointer with uppercase hexadecimal, just use %X instead of %p.

As mentioned before, since the format specifiers are not available to the console, pointers cannot be immediately located for making clickable links. However, it might be feasible for this to work with predetermined extra signaling characters, such as an 0x or $ prefix.

jacobly0 commented 6 years ago

If you are on Linux or macOS, you can launch CEmu from a terminal emulator and change the Console setting to console which would allow you to use ANSI terminal formatting escapes such as dbg_printf("\033[32mgreen\033[m\n");.

mateoconlechuga commented 6 years ago

The really beneficial thing that this could use has been moved to #155. Thanks for the ideas; however we feel that adding too many things to the console could make it too heavy for things that are not used often.

mateoconlechuga commented 6 years ago

Update: You can now use ctrl + click to open the debugger when you click on an address in the console.

mateoconlechuga commented 6 years ago

Update: Color output is now supported in the console