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

查看:44
本文介绍了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/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='\[\033[1m\033[32m\]\u@\h \w\[\033[0m\]\$ '
       ^^^^^^^^^^^^^^^            ^^^^^^^

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

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

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

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