How do I properly enable ANSI escape sequences in cgdb? - cgdb

I am using CGDB version 0.6.7 (latest available from apt) on WSL2. Colors are showing properly in the code window, but I see sequences like [34m in the lower window. See the screenshot below:
The only way I have found to get rid of these is by using the command set style enabled off. However, it would be nicer if it just worked instead of having to disable the feature altogether. How can I set this up so that the escape sequences work properly in the lower window?

Related

While typing in the xterm js terminal (Android chrome) - backspace is giving previous command history

I am using ng-terminal in my project. I observed this unexpected behaviour when I use terminal in android chrome. When I backspace in the terminal, I erase previous command input by 1 character and keep going to previous command history.
Browser and version: Android Chrome - 109.0.5414.46
xterm.js version: 5.0.0
The key issue I think we're facing, aside from the behaviour being odd, is the backspace buffer. I suspect that the keyboard has its own buffer of text that isn't being cleared when the app decides to consume the text, and when you backspace, it moves back in to this buffer This is why each word reappears when you backspace.
Update the terminal emulator to a newer version As newer version may include fixes or issues like this. It is possible that there may be a configuration option of setting that you can use to change the behaviour of the back space key in the terminal emulator.
I've actually encountered this bug too and its super annoying, I reported it onto cockpit since I toughed it was problem in their code, but turns out that gboard and xterm.js are kind of broke and I don't think there is a fix for this yet.
Github issue on cockpit: https://github.com/cockpit-project/cockpit/issues/18138

How to print a file from VsCode?

I want to send the file I'm currently editing to a printer, like I did in Notepad++ for example.
I havn't found any hint on a print command. Is it not possible ?
It is not yet available, but I found an issue report for that feature.
It's currently in the backlog, so we can expect it soon.
https://github.com/Microsoft/vscode/issues/5953
Edit:
In the meantime:
https://marketplace.visualstudio.com/items?itemName=nobuhito.printcode
https://marketplace.visualstudio.com/items?itemName=pdconsec.vscode-print
Now you can install addon for VS Code - search "PrintCode".
Note that the repository for this extension was last updated in February 2018 with numerous issues outstanding.
I found the PrintCode extension inspiring but unfinished and with a number of flaws. In particular it depends on a specific paper size to wrap and as a result does not respond well if you change paper size or orientation in the print dialog.
It's open source so I looked at the code and didn't like that either. No programmer ever likes another's coding style. So I pinched the idea of using a web-browser as platform driver for HTML printing -- my hat is off to the PrintCode author for that cunning insight -- and wrote my own.
In the process I fixed all the known bugs, added everything on my wishlist and a couple of things suggested by others. The biggest thing was figuring out the CSS required to respect print dialog paper size and orientation. This also sorts out the mysterious disappearing line numbers problem, although I'm not sure why. The next biggest thing was learning to probe for an unused port, a problem that also afflicts PrintCode causing the browser to open showing no content.
Major issues
PrintCode depends on a web service. You can't use it offline.
Many people want to be able to open a file, select a portion and print just the selection.
The print dialog supports changing paper size and orientation. This clashes with the way PrintCode works.
Some people like to run multiple VS Code windows.
When you print a markdown file, you probably don't want it printed like a text file when it can be rendered with fonts and proper headings and bullets etc.
Support is required for remote workspaces.
Because each instance of VS Code needs a different port for its embedded webserver, you can't just use a setting. Dynamic port allocation is necessary.
Remote workspaces weren't even a thing until two years after maintenance ceased on PrintCode.
If you want to survey your options, get onto https://marketplace.visualstudio.com, choose the Visual Studio Code tab and search for printing.
If you just want a link to my version, it's here http://marketplace.visualstudio.com/items?itemName=pdconsec.vscode-print.
If you like what you see but need something I haven't thought of, the marketplace page has a link to the repo on github. Create an issue and tell me what you need -- or write it yourself and submit a PR.
Now there is an extension available for printing from the VS Code Editor.
It's called VS Code Printing Free.
I've tried it for a couple of days and it works fine.
Poor man's answer: Copy code to Notepad2 or Notepad++ and print from there.
The colour coding will be different though
You can use an Extension of VS Code: PrintCode
Install extension PrintCode
On Mac: command + shift + P
choose command> PrintCode
I have modified the https://marketplace.visualstudio.com/items?itemName=pdconsec.vscode-print. If you change the values that I have marked in the picture in the extension settings a browser tab opens with the you can then print this also works on the Ipad. It works also with the code-server Version inside a Docker Container.
I put the file on github https://github.com/chrishdx/vsc-print
enter image description here

Dart: Move cursor in command-line app

What methods are there to move the cursor in a command line app?
I've tried simpler things, such as using "\b", but that didn't work:
print("test\ba");
I expected the output tesa but I get testa (\b was ignored).
Update
Regarding (2), that was the output in the webstorm IDE, however it worked fine in the normal OS X Terminal.
On Linux or OSX you can use ANSI sequences https://en.wikipedia.org/wiki/ANSI_escape_code. On Windows you are pretty much out of luck AFAIK. Take a look at https://pub.dartlang.org/packages/ansicolor for an example how to use ANSI codes.
See also this similar question Clearing the terminal screen in a command-line Dart app

Text wrapping in SPSS-22 syntax editor

I use SPSS-22 on a Linux machine.
I would like to know, if I can somehow tell the editor to automatically introduce line breaks, once the edge of the window is reached, as I would like to insert some longer comments in the syntax without having to press return all the time.
The syntax editor will turn overly long lines red, but it will not wrap the lines for you. 251 characters is the maximum legal length, but you would probably not want lines that long in your output for readability, so wrapping them yourself is probably warranted.
You might be interested in the TEXT extension command for writing long comments that will appear in separate text blocks in the output rather than being buried in log blocks. TEXT supports html and rtf markup as well.
TEXT requires the (free) Python Essentials for Statistics. Details are on the SPSS Community website (www.ibm.com/developerworks/spssdevcentral), but the Essentials are automatically installed (unless you decline) with Statistics 22. I think TEXT is included in the Essentials, but if not, you can get it via the Download and Install Extension Bundles feature under Utilities.

Running just the matlab editor

Is there a way to just run the matlab (7.9.0) editor and not the rest of the "desktop" on linux?
This can't be done directly, because the editor stopped being a stand-alone executable many releases ago. It is now launched as a separate Java window from the Matlab desktop. However, you could try hiding the desktop once the editor is displayed, using the following simple code snippet:
com.mathworks.mde.desk.MLDesktop.getInstance.getMainFrame.hide % to hide desktop
com.mathworks.mde.desk.MLDesktop.getInstance.getMainFrame.show % to show desktop
Note that if your editor is docked to the desktop, it will be hidden together with the desktop, so be careful...
No, this is no longer possible since r2007a.
You can get Matlab syntax highlighting for emacs and vi, though.
On my windows machine, I can start MATLAB with the -nodesktop option, then once in the command prompt, I start only the editor with edit.
Im not sure if this is different in terms of memory space used, but this way you only get the editor and the command prompt (no auto-completion though)
You can add Matlab syntax highlighting to Kate via a plugin. I don't know about gedit, but there's probably an addon for that as well.

Resources