-1

So I am using the bash shell with st terminal emulator (issues occur with different terminal emulator also), what happens is if I paste a string of text in my shell, I got a issue like this enter image description here

But if I use any other shell like zsh it doesn't have this issue, it paste just fine. It actually doesn't affect the actual command but it is kind of annoying while editing the command. I have tried other terminal emulator also, & the issue still exist, here is a gif while pasting the command

enter image description here

Specs which might help:

OS: Arch Linux 
Shell: bash 5.1.8 
WM: dwm 
Terminal: st 
Terminal Font: Inconsolata

My ~/.bashrc file:

# PS1
_GREEN=$(tput setaf 2)
_RESET=$(tput sgr0)
export PS1="${_GREEN}\W \$ ${_RESET}"

Exports

export PATH=$PATH:/home/anant/.local/bin export PATH=$PATH:/usr/bin/npm export HISTCONTROL=ignoreboth:erasedups export MANPAGER="nvim -c 'set ft=man' -" export EDITOR="nvim" export BROWSER="firefox"

Aliases

alias ls='exa -la' alias la='exa -a' alias ll='exa -l' alias update="yay -Syyu --devel --noconfirm" alias install="yay -S --noconfirm" alias remove="yay -Rs --noconfirm" alias config="/usr/bin/git --git-dir=$HOME/dotfiles/ --work-tree=$HOME" alias configurl="config remote set-url origin" alias giturl="git remote set-url origin" alias v="nvim" alias music="cd ~/Music;youtube-dl -x --audio-format mp3 --prefer-ffmpeg" alias sx="sx sh ~/.xinitrc" alias cat="bat" alias less="bat" alias fm6000="fm6000 -c blue -de dwm -n" alias mpv="devour mpv" alias zathura="devour zathura" alias sxiv="devour sxiv" alias lowriter="devour lowriter"

Personal Aliases

alias code="cd ~/git-dir/personal/codingPlayground/" alias pythonProject="cd ~/git-dir/personal/codingPlayground/pythonProject/" alias webProjects="cd ~/git-dir/personal/codingPlayground/webDevProject" alias learncss="cd ~/git-dir/personal/codingPlayground/learnCSS/"

fzf

source /usr/share/fzf/completion.bash source /usr/share/fzf/key-bindings.bash

Kusalananda
  • 333,661
  • 4
    Your time would be better spent figuring out how to describe your problem and actually ask a question. It certainly wouldn't be completely wasted time like, for instance, making an animated gif. Also: Please don't post images of text. Copy and paste the text itself into your question and format it as code by selecting it and pressing Ctrl-K or by using the editor's {} icon. – cas Jul 26 '21 at 06:03
  • I will guess you are using CTRL+C to copy. The problem is that CTRL+C in most terminals is not "copy", but "Interrupt! Break! Stop! Abort! Cancel that last command I typed before it wipes out my hard drive!". Many terminal programs will handle CTRL+SHIFT+C and CTRL+SHIFT+P as "copy" and "paste", respectively. – C. M. Jul 26 '21 at 06:14
  • 1
    I don't quite understand what the issue is and I don't quite see what the animation is trying to show. – Kusalananda Jul 26 '21 at 06:26
  • @C.M. No I only have in pasting issues not copying. I also know that ctrl+c is for breaking/interrupting – Anant Gupta Jul 26 '21 at 06:59
  • @cas Ok, thanks for suggestion, but I don't have any idea how can I explain you what the error is coming – Anant Gupta Jul 26 '21 at 07:03
  • @AnantGupta: then please edit your question to: (1) remove or transcribe the image (not everyone here can easily view or follow images or animations), and (2) clarify what you are asking, what the problem is, and/or what you have searched/tried/failed/etc. The only issue I saw in what you have is the tell-tale ^C marker indicating a CTRL+C interrupt was sent. The only other "issue" I see might be that you are asking why certain parts get highlighted erratically, and that would typically be the result of many factors, including terminal emulatoin and prompt display handling. – C. M. Jul 26 '21 at 07:09
  • In a comment you mention an error. What is the error? – Kusalananda Jul 26 '21 at 07:50
  • So, is your problem: "If I paste text into my terminal emulator, the text stays highlighted even if I start to mark new/different text for editing in the very same terminal window I just pasted into, applying a XOR-like logic if the regions overlap?" – AdminBee Jul 26 '21 at 07:59

1 Answers1

0

I figured it out. The problem was happening because of my PS1 prompt. I was just messing up with my PS1 prompt, removed the custom PS1 prompt lines & I was done. There were no issue then, now this is my bashrc

# Exports
export PATH=$PATH:/home/anant/.local/bin
export PATH=$PATH:/usr/bin/npm
export HISTCONTROL=ignoreboth:erasedups
export MANPAGER="nvim -c 'set ft=man' -"
export EDITOR="nvim"
export BROWSER="firefox"

Aliases

alias ls='exa -la' alias la='exa -a' alias ll='exa -l' alias update="yay -Syyu --devel --noconfirm" alias install="yay -S --noconfirm" alias remove="yay -Rs --noconfirm" alias config="/usr/bin/git --git-dir=$HOME/dotfiles/ --work-tree=$HOME" alias configurl="config remote set-url origin" alias giturl="git remote set-url origin" alias v="nvim" alias music="cd ~/Music;youtube-dl -x --audio-format mp3 --prefer-ffmpeg" alias sx="sx sh ~/.xinitrc" alias cat="bat" alias less="bat" alias fm6000="fm6000 -c blue -de dwm -n" alias mpv="devour mpv" alias zathura="devour zathura" alias sxiv="devour sxiv" alias lowriter="devour lowriter"

Personal Aliases

alias code="cd ~/git-dir/personal/codingPlayground/" alias pythonProject="cd ~/git-dir/personal/codingPlayground/pythonProject/" alias webProjects="cd ~/git-dir/personal/codingPlayground/webDevProject" alias learncss="cd ~/git-dir/personal/codingPlayground/learnCSS/"

fzf

source /usr/share/fzf/completion.bash source /usr/share/fzf/key-bindings.bash