iT邦幫忙

0

windows terminal + git bash 使用 del鍵 畫面會閃爍

windows terminal + git bash 使用 del鍵 畫面會閃爍

情況圖

https://imgur.com/a/huQTptb

git bash setting

C:\Program Files\Git\etc\profile.d\git-prompt.sh

if test -f /etc/profile.d/git-sdk.sh
then
	TITLEPREFIX=SDK-${MSYSTEM#MINGW}
else
	TITLEPREFIX=$MSYSTEM
fi

if test -f ~/.config/git/git-prompt.sh
then
	. ~/.config/git/git-prompt.sh
else
	PS1='\[\033]0;$PWD\007\]' # set window title
	# PS1="$PS1"'\n'                 # new line
	PS1="$PS1"'\[\033[33m\]'       # change to brownish yellow
	PS1="$PS1"'\w'                 # current working directory
	if test -z "$WINELOADERNOEXEC"
	then
		GIT_EXEC_PATH="$(git --exec-path 2>/dev/null)"
		COMPLETION_PATH="${GIT_EXEC_PATH%/libexec/git-core}"
		COMPLETION_PATH="${COMPLETION_PATH%/lib/git-core}"
		COMPLETION_PATH="$COMPLETION_PATH/share/git/completion"
		if test -f "$COMPLETION_PATH/git-prompt.sh"
		then
			. "$COMPLETION_PATH/git-completion.bash"
			. "$COMPLETION_PATH/git-prompt.sh"
			PS1="$PS1"'\[\033[36m\]'  # change color to cyan
			PS1="$PS1"'`__git_ps1`'   # bash function
		fi
	fi
	PS1="$PS1"'\[\033[0m\]'        # change color
	PS1="$PS1"'\n'                 # new line
	PS1="$PS1"'@ '                 # prompt: always $
fi

MSYS2_PS1="$PS1"               # for detection by MSYS2 SDK's bash.basrc

# Evaluate all user-specific Bash completion scripts (if any)
if test -z "$WINELOADERNOEXEC"
then
	for c in "$HOME"/bash_completion.d/*.bash
	do
		# Handle absence of any scripts (or the folder) gracefully
		test ! -f "$c" ||
		. "$c"
	done
fi

windowns terminal setting

setting.json

// This file was initially generated by Windows Terminal 1.4.3243.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
    "$schema": {
        "name" : "Campbell",
    
        "cursorColor": "#FFFFFF",
        "selectionBackground": "#FFFFFF",
    
        "background" : "#0C0C0C",
        "foreground" : "#CCCCCC",
    
        "black" : "#0C0C0C",
        "blue" : "#0037DA",
        "cyan" : "#3A96DD",
        "green" : "#13A10E",
        "purple" : "#881798",
        "red" : "#C50F1F",
        "white" : "#CCCCCC",
        "yellow" : "#C19C00",
        "brightBlack" : "#767676",
        "brightBlue" : "#3B78FF",
        "brightCyan" : "#61D6D6",
        "brightGreen" : "#16C60C",
        "brightPurple" : "#B4009E",
        "brightRed" : "#E74856",
        "brightWhite" : "#F2F2F2",
        "brightYellow" : "#F9F1A5"
    },
    "defaultProfile": "{29bab6c8-0874-4881-b61b-b4e87ffe34d1}",
    // You can add more global application settings here.
    // To learn more about global settings, visit https://aka.ms/terminal-global-settings
    // If enabled, selections are automatically copied to your clipboard.
    "copyOnSelect": false,
    // If enabled, formatted data is also copied to your clipboard
    "copyFormatting": false,
    // A profile specifies a command to execute paired with information about how it should look and feel.
    // Each one of them will appear in the 'New Tab' dropdown,
    //   and can be invoked from the commandline with `wt.exe -p xxx`
    // To learn more about profiles, visit https://aka.ms/terminal-profile-settings
    "tabWidthMode":"titleLength",
    "profiles": {
        "defaultProfile": {
            // Put settings here that you want to apply to all profiles.
        },
        "list": [
            {
                "guid": "{29bab6c8-0874-4881-b61b-b4e87ffe34d1}",
                "commandline": "C:/Program Files/Git/bin/bash.exe",
                "fontFace": "Fira Code",
                "icon": "C:/Users/Brian/Pictures/git-bash.png",
                "name": "Git Bash",
                "tabTitle": "Git Bash",
                "startingDirectory": "%USERPROFILE%/workspace",
                "historySize" : 9001,
                "padding" : "8,8,8,8",
                "snapOnInput" : true,
                "backgroundImage":"C:/Users/Brian/Pictures/photos/jose-carlos-ichiro-7uITycbXooI-unsplash.jpg",
                "backgroundImageOpacity":0.3,
                "antialiasingMode":"cleartype",
                "useAcrylic":true,
                "acrylicOpacity":0.9
            },
            {
                "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
                "hidden": false,
                "name": "wsl",
                "fontFace": "Fira Code",
                "source": "Windows.Terminal.Wsl",
                "startingDirectory": "//wsl$/Ubuntu/home/brian/workspace"
            },
            {
                // Make changes here to the powershell.exe profile.
                "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
                "name": "Windows PowerShell",
                "commandline": "powershell.exe",
                "fontFace": "Fira Code",
                "hidden": false
            },
            {
                // Make changes here to the cmd.exe profile.
                "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
                "name": "Command Prompt",
                "commandline": "cmd.exe",
                "hidden": false
            },
            {
                "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
                "hidden": true,
                "name": "Azure Cloud Shell",
                "source": "Windows.Terminal.Azure"
            }
        ]
    },
    // Add custom color schemes to this array.
    // To learn more about color schemes, visit https://aka.ms/terminal-color-schemes
    "schemes": [],
    // Add custom actions and keybindings to this array.
    // To unbind a key combination from your defaults.json, set the command to "unbound".
    // To learn more about actions and keybindings, visit https://aka.ms/terminal-keybindings
    "actions": [
        // Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json.
        // These two lines additionally bind them to Ctrl+C and Ctrl+V.
        // To learn more about selection, visit https://aka.ms/terminal-selection
        // Press Ctrl+Shift+F to open the search box
        {
            "command": "find",
            "keys": "ctrl+shift+f"
        },
        {
            "command": "closeTab",
            "keys": "ctrl+w"
        },
        {
            "command": "newTab",
            "keys": "ctrl+t"
        }
    ]
}
看更多先前的討論...收起先前的討論...
直接用git bash 不會有這樣的情況
windows terminal用別種shell之類的 也不會有這種情況
想問問這是哪邊會有問題啊?
這閃爍的範圍看起來像在在文字範圍...
有sourcetree這麼好用的git神器, 不要死守/堅持非git bash不用吧!
只是想在windows環境下有bash可以用,並不是一定要git bash,Windows環境有其他bash的選項嗎?
powershell不喜歡...
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

2 個回答

0
Franky Chen
iT邦研究生 3 級 ‧ 2021-01-08 12:53:54

這個不是Bug阿
Git Bash 在有bash error的時候本來就會閃畫面+發出提示音

你的影片中的錯誤原因是輸入指令的地方已經沒有文字了你還在按[backspace]所以他在警告你

bash error的時候的反應可以調整嗎? 不閃畫面+只發出提示音之類的??

0
8051
iT邦見習生 ‧ 2021-12-10 13:22:37

用編輯器(ex:nano或vi等) 創建(或編輯) ~/.inputrc,輸入set bell-style none,保存退出後,重啟Windows Terminal.

nano ~/.inputrc

set bell-style none

以上參考GIT Bash has bad flicker · Issue #7200 · microsoft/terminal · GitHub

我要發表回答

立即登入回答