Set iTerm2 window wider than screen width - terminal

Is there a way to set the iTerm2 window's width to a value wider than what my monitor size allows?
My use case is, when I am in presentations, when I embiggen my font size for the audience, I want my iTerm window to be still a super-wide window, so that I don't run into wrap-line nightmare when I demo very wide stdout content.
Either iTerm2 or Terminal.app solution would work for me.

Related

How to get scrolling back after setting width/height for cmd.exe?

I have a batch script that will display long strings of text. I want the batch script to open in a certain width, and the height at a certain height.
I have this:
MODE 200, 100
python run_program.py
The width is perfect, but now cmd.exe loses its ability to scroll vertically. I cannot scroll up to see the data unless I remove the 100 part. But if I remove the height, cmd.exe will just open up to the max height of my monitor.
I just want to open up cmd in my custom resolution: 200,100 but with scrolling. Is there any way to do that in cmd.exe?
Please note I am using ONLY the base system cmd.exe, and NOT powershell or any other console program for Windows.
Mode will set both the height/width of the console window and the screen buffer. That explains why you lose the scrollbar. You can create a shortcut to cmd.exe and in the settings of the shortcut change height/width of the cmd-windows and/or height/width of the screenbuffer.

Printed contents disappear in terminal

The thing is I have printed something in the terminal, but when I accidentally resize the terminal, the printed contents at the bottom of my terminal disappear. Why is that? Is there anyway to recover these printed messages since the program runs a long time each time.
When you resize a terminal window, the terminal has to paint or repaint part of the window. If you lost text at the bottom of the window, that sounds as if you shrank the window when using one of the terminals which leave the upper-left corner of the window in a fixed position, while adjusting the rest of the window. Offhand, that could be rxvt, putty, konsole. xterm (which is configurable) defaults to the other direction.
If the window shrinks, then the location of the "bottom" row of text should be moved up (to match user's expectations). But there is a complication: GNU screen will besides redrawing the window, attempt to wrap long lines so that they fit the new margins. Developers for a few terminals have imitated that in the past few years, and you may notice some bug reports when that new feature does not work well.
For instance, if you shrank the window vertically, but changed its width, then a miscalculation of the wrapped lines could cause text to vanish. Then again, resizing it again might get the text back into view. But if that does not work, then it's gone.

Windows 10 CMD/Powershell Buffer adjusts only when enlarging the console window; not when shrinking. Fix?

I have a seemingly simple question, but my google-fu is failing me:
I have started using CMD / Powershell more in my workflow recently, for a myriad of things including VIM, compiling, and Bash (Window's Ubuntu Subsystem). These all run in window's shell interface (if that is the right term for it? As distinct from Console 2/ConEmu, which are just wrappers around the shell and don't change its behavior).
Here's my problem:
When adjusting the shell window size larger, the buffer resizes to fit it.
However, when readjusting the window size to be smaller, the buffer stays large and scroll bars appear, and I have to use the scroll bars to view my entire window.
I don't want the latter half of this behavior, as it causes problems with programs like VIM, and is just annoying.
I actually like legacy console behavior in windows 10, as though it cannot be dynamically resized, it can be minimized or maximized and the buffer resizes along with both actions. However, I cannot simply enable this option as some things such as Bash require the modern windows 10 console and won't run in legacy mode.
Are there any other ways to have the buffer resize correctly along with the size of the window for either CMD or Powershell, or alternatively, to run Powershell with different settings than CMD (so I could have legacy console enabled in one, and not in the other -- they seem to share the same settings currently).
Additionally, if there are any alternative fixes or console shells that might solve this, feel free to suggest these as well! I've tried Mintty, and it's almost perfect, but messes up my register/clipboard settings in vim.
As you've discovered, switching to the legacy console on Windows 10 (via a console shortcut's Properties dialog, tab Options, checkbox Use legacy console (requires relaunch) is, unfortunately, a global setting (affects all future console windows, irrespective of the shell run in them).
Windows 10's new console, always sets the buffer width to the window width when you resize with the mouse, avoiding the need for horizontal scrolling (whereas the legacy console retains the original, larger buffer width when you make a window narrower with the mouse, at which point a horizontal scrollbar appears; as an aside: the legacy console doesn't allow making a window wider using the mouse).
If a shortcut file of yours doesn't behave that way while not in legacy mode, recreate the shortcut file.
Note: The terms legacy and new console above refer to modes of the legacy conhost.exe-based console windows overall, as distinct from their modern successor, Windows Terminal.
Therefore, the remaining part of this answer is only of interest, if any of the following apply:
you're using the legacy console - either because you've opted to do so on Windows 10 or because you're running on Windows 8.1 or below - and want a simple command to fix the horizontal scrolling issue.
you want to modify the startup dimensions of your console window by way of shortcut files.
you're interested in a script that programmatically resizes a console window.
There's no simple UI fix to avoid the horizontal scrolling when you narrow a window using the mouse - short of using the window's system menu's Properties dialog to make the buffer width match the window with, but that's cumbersome.
Here is a command you can run after mouse-based resizing to fix the horizontal scrolling issue:
PowerShell:
[console]::BufferWidth = [console]::WindowWidth
So you don't have to type this every time, put it in a function, say, fixwin, and add it to your $PROFILE (initialization script):
function fixwin { [console]::BufferWidth = [console]::WindowWidth }
cmd.exe:
Using mode is not an option, because it would set your buffer height to the window height as well, so you'd lose your scroll-back buffer - see this answer.
You, can, however, call the above PowerShell command ad-hoc, using a DOSKEY macro:
doskey fixwin=powershell -noprofile -command "[console]::bufferwidth = [console]::windowwidth"
So you don't have to define the macro in every session, save the command to a batch file, say, .cmdrc.cmd in folder %USERPROFILE%, then modify the shortcut file that you use to start cmd.exe as follows:
Open the shortcut file's Properties dialog (via the shortcut menu, by right-clicking; for a taskbar item, right-click for the taskbar-related shortcut menu, then right-click the second to last item representing the underlying shortcut file).
In the Shortcut tab, replace the existing content of text box Target with the following:
%windir%\system32\cmd.exe /k "%USERPROFILE%\.cmdrc.cmd"
As an alternative to resizing a window after the fact, you can use a shortcut file to launch a console with preconfigured dimensions, which works with both the legacy and the new consoles:
Create a shortcut file pointing to the executable of interest (cmd.exe or powershell.exe).
Launch the shortcut.
Use the window's system menu's Properties dialog to set the desired window and buffer dimensions.
The next time you launch that shortcut file, the previously configured dimensions should take effect again.
To also remember the window position, position the window as desired, open the system menu's Properties dialog (again), uncheck Let system position window, and click OK.
cmd.exe / PowerShell script for fixing the buffer-width issue and/or programmatically resizing the window:
If you follow the instructions below, you'll be able to:
Simply execute rw (for resize window) after having used the mouse to narrow the window, so as to make the buffer width the same as the window width.
Alternatively, call rw <new-width> [<new-height>] to resize your window programmatically, which also sets the buffer width to the window width.
Instructions:
Pick or add a directory in your %PATH% in which to place the scripts below.
Create wrapper batch file rw.cmd with the following content:
#powershell.exe -executionpolicy unrestricted -noprofile -file "%~dpn0.ps1" %*
Create PowerShell script rw.ps1 with the following content (ignore the broken syntax-highlighting):
<#
.SYNOPSIS
Resizes the console window.
.DESCRIPTION
Resizes the current console window to the specified width (in columns)
and/or height (in lines.
Note that the window position doesn't change; i.e., the top-left corner of
the window remains in place, and the width / height expands or shrinks.
To only change the width, specify a single value; e.g.: 120
To only change the height, specify 0 for the width; e.g.: 0 60
Specify neither if you don't want to resize, but want to ensure that the
buffer width is set to the same value as the window width, so as to avoid
the need for horizontal scrolling.
This is convenient after having resized the window with the mouse.
Note that specifying values that are too large causes an error.
.PARAMETER Width
The new width (in columns) to resize the current console window to.
.PARAMETER Height
The new height (in lines) to resize the current console window to.
.PARAMETER KeepBufferWidth
By default, the buffer width is always set to the resulting window width,
so as to avoid the need for horizontal scrolling.
Use this switch if you want to keep the current buffer width.
.EXAMPLE
> rw 100 50
Makes the current console window 100 columns wide, and 50 lines tall.
> rw 100
Makes the current console window 100 columns, without changing the height.
> rw 0 70
Makes the current console window 70 lines tall, without changing the width.
> rw
Doesn't perform resizing, but ensures that the buffer width equals the
window width, so as to prevent horizontal scrolling.
#>
[cmdletbinding()]
param(
[uint16] $Width,
[uint16] $Height,
[switch] $KeepBufferWidth
)
if ($width) { [console]::WindowWidth = $width }
if ($height) { [console]::WindowHeight = $height }
# Unless asked not to, always set the buffer width to the window width to
# prevent horizontal scrolling.
if (-not $KeepBufferWidth) { [console]::BufferWidth = [console]::WindowWidth }

How to change terminal font color in PyCharm?

I want to set my terminal color scheme, such that I will have black text on light background (white or light yellow for example).
I changed "Console Colors" settings, such as Background, Standard output, and System output, under Editor > Colors & Fonts > Console Colors, but I keep running into the same problem.
If I change Background color to let's say white. It also changes text (Standard output and my user input to the same color). I can't figure out, which setting controls the color of the font, which appears in the terminal window. In fact, it appears that font color is the same as background color, which is confusing to me. I would expect to be able to independently control background color, and font color, which to me represents "Foreground".
<
Changing colour in
Preferences->Editor->Color Scheme->Console Colors->Standard Output
should change the terminal font's colour.
I suppose it happened on Windows. If yes then it is affected/controlled by Windows registry. Try one of the following method:
Open Windows cmd and from drop down menu selects defaults. Then change the Text and Background colors to match your choice in PyCharm. The problem occurs if you have different color settings in Windows cmd instead of default.
Delete HKEY_CURRENT_USER\Console key from Windows registry.
More information available on this link
To configure color and font scheme for consoles
Make sure you are working with an editable scheme.
Open the IDE Settings, and under Colors&Fonts, scroll through the list of components, and select the ones related to consoles:
Console Colors
Console Fonts
In the right-hand pane, click the desired component in the list, and change color settings and font type:
See Image of how to do it

How to maximize command prompt in windows xp

I am on windows xp,
Is there any way to maximize my cmd.exe window?
I am doing some mysql and it is so difficult to read results of my queries in such a small window.
Why maximize does not really maximizes it?
Is there a way for maximizing?
Or maybe an alternative command prompt I can use?
thanks
Click on the top left icon in the window (the "C:\" one) and select "Properties".
Then select the "Layout" tab and change the window size to what you want it to be (I have 128x50 for the screen and 128x999 for the scroll buffer). You can also optionally set the top left position (I always have it at 1,1) if you don't want Windows itself deciding where the window goes.
When you click on OK, make sure you tell it to modify the shortcut that started the window.
Then it will remember.
This is for XP, other MS operating systems may vary slightly but the general idea should be the same.
Try this:
In the Command window, right click the Title
bar and select Properties from the
popup menu. The property sheet
appears.
In the property sheet, select 'Full
Screen' in the 'Display Options'
box.
Close the property sheet by clicking
OK and select 'Save proeprties for
future windows with same title'.
I would recommand that you use powershell
http://www.microsoft.com/windowsserver2003/technologies/management/powershell/download.mspx
It also support full screen mode, and some other nice feature.
Command Window Default Properties
Click on the sytem menu, or with focus set on the Command Windows, press Alt+Space, and select Properties. Change your Font, Window Size, and so on. I always change my Window Size (on the Layout tab) to Width 80 by Height 65 and Screen Buffer Size to 80 by 300.
Check out Console2, it seems to be about the most promising window enhancement for cmd.exe.
I have to say, cmd.exe is probably the worst part of windows! Especially the copy pasting support, etc.
Personally, I use putty to ssh into a Linux box when I really need to do command line work, you can't go past Bash.
Even though you could install that on windows using Cygwin, which will allow you to use another console, although this doesn't have the ability to override the windows cmd.exe, it might be worth a shot given that you are trying to use a command line application, and not windows :).
Access Properties by right clicking on top of the CMD window, go back to the Font tab, select either 10 x 18 or 12 x 16, and then click OK. You'll then need to go back to the Layout tab and reset the Screen Buffer Size Width to the appropriate value. For example, I selected the 10 x 18 font size and then changed the Screen Buffer Size Width to 160X300 and window size width to 134X37.

Resources