简体   繁体   English

Windows 10 Bash (Ubuntu) - 如何向上滚动?

[英]Windows 10 Bash (Ubuntu) - How to scroll up?

I have bash installed on my W10 laptop, but one thing that is very frustrating is I can not scroll up.我在 W10 笔记本电脑上安装了 bash,但非常令人沮丧的一件事是我无法向上滚动。

Does anyone know of a way to enable scrolling with the mouse wheel?有谁知道启用鼠标滚轮滚动的方法? I could not find anything after many google searches.经过多次谷歌搜索后,我找不到任何东西。

Context: If I compile some C++ files and get a lot of errors, I can not scroll up to see all those errors.上下文:如果我编译一些 C++ 文件并得到很多错误,我将无法向上滚动以查看所有这些错误。

You must set PropertiesLayoutScreen Buffer SizeHeight to the number of lines you want.您必须将PropertiesLayoutScreen Buffer SizeHeight设置为您想要的行数。

The default was 50 lines.默认值为 50 行。 I set it to 1000 and that's enough for me.我将它设置为 1000,这对我来说就足够了。

属性菜单

Right click the window frame, select "properties" from the contextual menu.右键单击窗口框架,从上下文菜单中选择“属性”。 In Properties, first tab, in the edit option area, tick the "QuickEditMode".在属性的第一个选项卡中,在编辑选项区域中,勾选“QuickEditMode”。 That will allow you to mouse scroll.这将允许您进行鼠标滚动。

Screenshot of properties:属性截图:

Make sure you're hitting properties, and not defaults.确保您点击的是属性,而不是默认值。 Both menus will appear the same, but only properties will give you the result you're looking for!两个菜单看起来都一样,但只有属性会给你你正在寻找的结果!

I found that this doesn't work when running the current Ubuntu 20.04 LTS image (or 16.04 LTS either, IME).我发现这在运行当前的Ubuntu 20.04 LTS 映像(或 16.04 LTS,IME)时不起作用。 This is because tmux is enabled.这是因为启用了tmux

Try enabling tmux's mouse mode:尝试启用 tmux 的鼠标模式:

echo 'set -g mouse on' >> "~/.tmux.conf"

And restart your terminal window (close/open).并重新启动您的终端窗口(关闭/打开)。

See related post: https://superuser.com/questions/209437/how-do-i-scroll-in-tmux见相关帖子: https : //superuser.com/questions/209437/how-do-i-scroll-in-tmux

  1. Switch to a different Windows application to bring the WSL terminal out of focus (eg by pressing Alt Tab or clicking an empty part of the Windows taskbar)切换到不同的 Windows 应用程序以使 WSL 终端失去焦点(例如,通过按Alt Tab或单击 Windows 任务栏的空白部分)
  2. Hover over the (now out-of-focus) terminal running WSL and scroll using the mouse wheel将鼠标悬停在运行 WSL 的(现在失焦)终端上并使用鼠标滚轮滚动

And make sure that in the Windows Settings, you have Mouse > "Scroll inactive windows when I hover over them" turned on.并确保在 Windows 设置中,您已打开鼠标 >“将鼠标悬停在非活动窗口上时滚动它们”。


I know this is a bit unsatisfying but it's the only thing that actually works well for me.我知道这有点令人不满意,但它是唯一真正适合我的东西。

  • My screen buffer size was sufficiently large and the scroll bar works fine otherwise.我的屏幕缓冲区大小足够大,否则滚动条工作正常。 However, the mouse wheel still doesn't start working by increasing the buffer size alone.但是,仅通过增加缓冲区大小,鼠标滚轮仍然无法开始工作。
  • I'm not interested in QuickEdit mode because it stalls running programs indefinitely if I so much as accidentally click我对 QuickEdit 模式不感兴趣,因为如果我不小心点击它会无限期地停止运行程序
  • editing my tmux configuration did nothing.编辑我的 tmux 配置什么也没做。

As I had the same problem and none of the mentioned solutions worked for me, I continued my research and just found out the problem occures because I'm using screen inside my WSL.由于我遇到了同样的问题,并且上述解决方案均不适合我,因此我继续研究并发现问题的发生是因为我在 WSL 中使用了屏幕。

If you do so as well, you can't use the buffer of WSL, but you have to use screens own buffer.如果你也这样做,你就不能使用 WSL 的缓冲区,但你必须使用屏幕自己的缓冲区。

See https://unix.stackexchange.com/questions/40242/scroll-inside-screen-or-pause-output for more help有关更多帮助,请参阅https://unix.stackexchange.com/questions/40242/scroll-inside-screen-or-pause-output

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM