Restoring content from a cleared terminal on Mac OS - macos

After clearing a Mac terminal (via Command K, or the "Clear All" command under the edit menu), is there a way to easily restore the previously cleared text?
Periodically, when I run a long process on a Mac Terminal (such as a suite of unit tests) I prefer to clear the terminal. I do this so when I'm scrolling up to look over the results of the process, I can focus ONLY on the results of that process and not other commands I've recently run. (Such as, say, a different suite of tests)
But, sometimes I do eventually want to go back and look over the previous suit of tests.
Is there a way to restore previous terminal text?

The terminal is not going to help with restoring the text. It is gone.
If you anticipate wanting to review the text, you could (in a more or less transparent manner—not interfering with your work) run your session in script. That records everything sent to the terminal (including escape sequences for vi).
If your use of the terminal is largely just cat'ing files or watching logs, then the resulting typescript file is usable with less -R. It does not work well with cursor-movement, but for those, I use slowcat or similar filters to slowly cat a file, etc. For best results, the terminal emulator interprets escape sequences reliably.

When running the tests why not redirect the output to a file? This keeps your terminal clear and you can cat (or tail or more or less) that file to see only the results of that process. Another advantage is you can keep these log files around for future reference if needed.

Related

Why can't I access terminal on vscode dev neither on edge nor chrome?

I can not run any program.
As per the instruction I went to vscode dev.
Open up my repository to run a test program.
However, unfortunately, I can not run any of my programs.
I have checked the doctrine which said that only chrome and edge are supported.
But I can not run my program on the terminal window because it tells the code can only run on environments such as codespaces, and local vs code.
What do I miss so that the problem is occurring?
As VSCode(.dev) issue 166506 illustrates, you cannot access terminal from your browser probably because that menu entry was hidden/removed on purpose.
With VSCode 1.75 (Jan. 2023), it will be restored with an explanation.
I'm guessing we intentionally suppressed it because terminals can't run in the web, but participants were simply confused that it wasn't there without connecting its absence to the fact that vscode.dev was a browser application.
Additionally, RemoteHub contributes a welcome view for the terminal which is one of the primary ways we explain that users must continue working elsewhere to run or debug code, and the fact that the terminal is completely suppressed means one less opportunity for users to organically learn the limitations of vscode.dev through our welcome views.
The message is the one you saw:
Terminal are not available in the web editor.
To use the terminal, you will need to continue in an environment that can run code, like a codespace or local VS Code.
You can develop remotely, but you need to execute locally.

MSYS2 paste problem when pasting multiple and long lines

I have an issue with recent versions of MSYS2 that I didn't have with older versions.
I often paste a large number of commands, some of which are longer that the console width. There are also sometimes multiline commands in there (e.g. shell if stuff with the fi several lines later). But I do make sure there are no tabs in there to avoid autocompletion from kicking in.
In old MSYS2 I could just paste everything and the commands would start right away.
In newer MSYS2 after pasting it is apparently waiting for another Enter before starting.
But what's worse: the data pasted isn't intact. Sometimes pieces are missing, sometimes it gets truncated, sometimes both.
I have reproduced this on Windows 10 and Windows 11.
I also tried running msys2.exe as well as others like mingw64.exe, and I even tried running sh.exe from ConsoleZ.
Is there some kind of setting or environment variable to get the old paste behaviour back?
UPDATE
Also tried with Windows Terminal
Tried pasting from different source (Notepad instead of Notepad++)
Tried changing copied source (in Notepad++) to different line endings (CR, LF, CR+LF)
No improvement.
Additionally I noticed sometimes part of the beginning of the copied text are pasted last. So it's not just a matter of missing pieces - the contents get thrown around during paste...
I have not been able to resolve this issue in ConsoleZ or Console2, but when using mintty from MSYS2 the following fixes the paste problem:
bind 'set enable-bracketed-paste off'
As mintty is not a console program (in the Windows application sense) this solution can't be made to work with ConsoleZ or Console2, but it is possible with ConEmu.

Activator/Play commands make Cygwin bash commands invisible

I'm using Cygwin and any time I use an Activator command (e.g., activator run or activator "eclipse with-source=true"), any text thereafter is invisible. It's being typed, because if I hit enter, the command will be executed, but I cannot see it.
I've done some searching of this issue, and I'm not the only one to experience it, as I've learned I can blindly type stty sane and I'll get my text visible again, but that's a bit onerous.
Other tips suggest commenting out a certain line in <activator>\minimal\activator, but looking through that file, I see many lines for detecting if the terminal being used is Cygwin and then specific handling for that, so I'm not sure what to edit nor why it isn't already handling the fact that I'm using Cygwin.
Any help would be appreciated, thanks!

Showing VIM makeprg progress on Windows

When VIM to used make builds using GNU make utility, there are two issues I see with the default configuration.
Background execution without freezing the editor.
Showing execution progress like emacs compile/grep command
Background execution is possible with simple !start or with plugins like dispatch or AsyncExecute etc
None of these options show the progress in a scratch window with warnings/errors emitted during build progress.
Is there anything I am missing ?
Searching the web took me to shellpipe/tee workaround which does not seem to work on Windows even after installing tee.exe
Vim only parses the :make output after the command has finished.
If you launch the build asynchronously, you'd also have to periodically read the resulting output and tell Vim to parse it via :cfile errorfile. There may be a plugin that provides such auto-reload logic, but I'm not aware of any.
In general, there's very little asynchronicity and parallelism built into Vim (possibly due to its age and implementation in C).

Can't seem to get Node.js Command Line to interpret what I write, keeps returning "..."?

So honestly, I don't really 'get' what's going on here, I mean, can I open the regular windows cmd.exe and use node from there? Or does it have to be from the node.js command window? Can I move files around on my system using the node.js command window? And yes, I currently can't figure out how to get it to interpret what i write, although it was working perfect before, but now I cant seem to escape from '...' every line, with no response.
Thanks
I use Node on *nix, so I'm not sure if it's different in Windows. But on *nix systems, the ellipses means it's waiting on you to finish a code block or the like. You should be able to hit CTRL+C (again, might be different in Windows) to cancel out of the edit you're in or CTRL+Z to kill the REPL entirely.

Resources