OS X 终端文本堆叠在自身之上 [英] OS X Terminal text stacking on top of itself

查看:17
本文介绍了OS X 终端文本堆叠在自身之上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Mac OS X Lion 的终端应用程序中遇到一个奇怪的问题.当我输入一长行文本时,当它到达终端窗口的边缘时应该换行到下一行时,它会继续在上面一行的文本顶部输入.

I'm encountering a strange issue in the Terminal app in Mac OS X Lion. When I enter in a long line of text that should wrap to the next line when it reaches the edge of the Terminal window, it continues to type on top of the text from the line above it.

以下是一些有助于说明问题的屏幕截图:

在我的文本到达窗口边缘之前:

文字到达窗口边缘后:

我还提供了我的文本和窗口设置的屏幕截图,以备不时之需.

I've also supplied screenshots of my text and window settings in case those might be helpful.

文本设置:

窗口设置:

预先感谢您提供的任何帮助.我已经有一段时间了这个问题,只是从来没有解决它.当我处理需要大 grep 命令和长路径名的事情时,现在真的很痛苦.

Thanks in advance for any assistance offered. I've had this issue for a while and just never got around to it. It's now really becoming a pain in the ass when I get into things that require big grep commands and long path names.

推荐答案

PS1 环境变量决定了 shell 的提示是什么样的.man bash 提供了关于它的完整文档.(实际上有几个,用于不同的模式).

PS1 environment variable determines what shell's prompt will look like. man bash gives full documentation on it. (There are actually several of them, for different modes).

有很多文件可以设置,通常是~/.profile~/.bashrc/etc/profile 之一code> 或 /etc/bashrc.

There are number of files that may be setting it, usually one of ~/.profile, ~/.bashrc, /etc/profile or /etc/bashrc.

如果您要在其中包含颜色代码或其他控制序列,则必须使用 [] 正确地将它们包裹起来(而不是包裹普通文本),否则行编辑可能会像您的情况一样混乱.我建议将 PS1 重置为默认值,然后小心地逐项添加颜色.

If you're going to have color codes or other control sequences inside it, you must wrap them with [ and ] properly (and NOT wrap normal text), otherwise line editing may become messed up like in your case. I suggest resetting PS1 to the default value then carefully adding coloring back item by item.

例如:

PS1='[33[1m33[32m]u@h w[33[0m]$ '
       ^^^^^^^^^^^^^^^            ^^^^^^^

着色命令带有下划线.注意它们是如何被 [ ] 包围的.

Coloring commands are underlined. Note how they are surrounded with [ ].

这篇关于OS X 终端文本堆叠在自身之上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆