From c47b2409a046fa40ae950a0d8f3fee4f18b15afc Mon Sep 17 00:00:00 2001 From: koalaman Date: Thu, 20 Feb 2014 16:53:42 -0800 Subject: [PATCH] Created SC2025 (markdown) --- SC2025.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 SC2025.md diff --git a/SC2025.md b/SC2025.md new file mode 100644 index 0000000..0e6ff1d --- /dev/null +++ b/SC2025.md @@ -0,0 +1,19 @@ +# Make sure all escape sequences are enclosed in \[..\] to prevent line wrapping issues + +### Problematic code: + + PS1='\e[36m\$ \e(B\e[m' + +### Correct code: + + PS1='\[\e[36m\]\$ \[\e(B\e[m\]' + +### Rationale: + +Bash is unable to determine exactly which parts of your prompt are text and which are terminal codes. You have to help it by wrapping invisible control codes in `\[..\]` (and ensuring that visible characters are not wrapped in `\[..\]`). + +Note: ShellCheck offers this as a helpful hint and not a robust check. Don't rely on ShellCheck to verify that your prompt is correct. + +### Contraindications + +None. \ No newline at end of file