You are not logged in.

#1 2013-05-17 02:55:32

dodo3773
Member
Registered: 2011-03-17
Posts: 820

Middle click paste no longer works correctly zsh

After a recent update my middle click to paste no longer works right. Instead or just pasting "x" it will paste "00~x01~". I tried terminator and rxvt-unicode and they do the same. This is a recent issue that just started after an update. Is anyone else experiencing this?

Edit: This seems to only happen sometimes randomly. Also, when it does my home key and end key does not take me to the beginning and end of the line.

Edit2: Seems to be related to zsh. When I switch to bash this doesn't occur. Looking into it more. (Edited title). Here's my .zshrc (removed irrelevant stuff):

Edit3: Seems to be related to this new plugin I'm using "safe-paste.plugin.zsh". Looking into it further. Does anything look wrong with this:

# Code from Mikael Magnusson: http://www.zsh.org/mla/users/2011/msg00367.html
#
# Requires xterm, urxvt, iTerm2 or any other terminal that supports bracketed
# paste mode as documented: http://www.xfree86.org/current/ctlseqs.html

# create a new keymap to use while pasting
bindkey -N paste
# make everything in this keymap call our custom widget
bindkey -R -M paste "^@"-"\M-^?" paste-insert
# these are the codes sent around the pasted text in bracketed
# paste mode.
# do the first one with both -M viins and -M vicmd in vi mode
bindkey '^[[200~' _start_paste
bindkey -M paste '^[[201~' _end_paste
# insert newlines rather than carriage returns when pasting newlines
bindkey -M paste -s '^M' '^J'

zle -N _start_paste
zle -N _end_paste
zle -N zle-line-init _zle_line_init
zle -N zle-line-finish _zle_line_finish
zle -N paste-insert _paste_insert

# switch the active keymap to paste mode
function _start_paste() {
  bindkey -A paste main
}

# go back to our normal keymap, and insert all the pasted text in the
# command line. this has the nice effect of making the whole paste be
# a single undo/redo event.
function _end_paste() {
#use bindkey -v here with vi mode probably. maybe you want to track
#if you were in ins or cmd mode and restore the right one.
  bindkey -e
  LBUFFER+=$_paste_content
  unset _paste_content
}

function _paste_insert() {
  _paste_content+=$KEYS
}

function _zle_line_init() {
  # Tell terminal to send escape codes around pastes.
  [[ $TERM == rxvt-unicode || $TERM == xterm || $TERM = xterm-256color ]] && printf '\e[?2004h'
}

function _zle_line_finish() {
  # Tell it to stop when we leave zle, so pasting in other programs
  # doesn't get the ^[[200~ codes around the pasted text.
  [[ $TERM == rxvt-unicode || $TERM == xterm || $TERM = xterm-256color ]] && printf '\e[?2004l'
}

Last edited by dodo3773 (2013-05-17 03:35:32)

Offline

#2 2013-05-17 14:02:56

youngunix
Member
Registered: 2013-01-16
Posts: 42
Website

Re: Middle click paste no longer works correctly zsh

"Middle Click" does it mean pasting text using the wheel in the middle of the mouse? <<Sorry, never heard of that before, that's why I'm asking>>.
I don't use zsh, yet when I've used it (or any other shell) to paste text I just use [Ctrl]+[Shift]+[V] and to copy text from shell use  [Ctrl]+[Shift]+[C].
I hope that helps!


"UNIX is basically a simple operating system, but you have to be a genius to understand the simplicity." --Dennis Ritchie-- RIP

Offline

#3 2013-05-17 15:10:34

dodo3773
Member
Registered: 2011-03-17
Posts: 820

Re: Middle click paste no longer works correctly zsh

youngunix wrote:

"Middle Click" does it mean pasting text using the wheel in the middle of the mouse? <<Sorry, never heard of that before, that's why I'm asking>>.
I don't use zsh, yet when I've used it (or any other shell) to paste text I just use [Ctrl]+[Shift]+[V] and to copy text from shell use  [Ctrl]+[Shift]+[C].
I hope that helps!

Yeah. Pasting by clicking the middle button. It works if I do not use this plugin so I will just leave it disabled I guess until I figure this out.

Offline

Board footer

Powered by FluxBB