akermu/emacs-libvterm

When pasting content into the vterm, the background and foreground colours are swapped?

Prague2049 opened this issue · 2 comments

When pasting content into the terminal, the background and foreground colours are swapped. How do I make sure that the font colours do not swap and that the input colours remain the same?
There is an example where the background and foreground colours are swapped as follow in vterm of emacs:
image
The background is black and the text is white when pasted.However, after enters the background is white and the text is light green as follow:
image
How can I paste text in a light green colour without the black background and white font?

Can you please provide steps to reproduce?

My vterm configuration is as follows:
(use-package vterm
:defer t;;
:when (memq window-system '(mac ns x pgtk))
:bind (:map vterm-mode-map
("C-y" . vterm-yank)
("M-y" . vterm-yank-pop)
("C-k" . vterm-send-C-k-and-kill))
:init
(setq vterm-shell "zsh")
:config
;(setq vterm-term-environment-variable xterm-color)
(setq vterm-always-compile-module t)
(defun vterm-send-C-k-and-kill ()
(interactive)
(kill-ring-save (point) (vterm-end-of-line))
(vterm-send-key "k" nil nil t))
(add-hook 'vterm-mode-hook
(lambda ()
(set (make-local-variable 'buffer-face-mode-face) 'fixed-pitch)
(buffer-face-mode t)));;;; 字体font (the face)
)
(use-package vterm-toggle
:defer t;;
:when (memq window-system '(mac ns x pgtk))
:bind (([f8] . vterm-toggle)
([f9] . vterm-compile)
:map vterm-mode-map
([f8] . vterm-toggle)
([(control return)] . vterm-toggle-insert-cd))
:config
(setq vterm-toggle-cd-auto-create-buffer nil)
(defvar vterm-compile-buffer nil)
(defun vterm-compile ()
"Compile the program including the current buffer in `vterm'."
(interactive)
(setq compile-command (compilation-read-command compile-command))
(let ((vterm-toggle-use-dedicated-buffer t)
(vterm-toggle--vterm-dedicated-buffer (if (vterm-toggle--get-window)
(vterm-toggle-hide)
vterm-compile-buffer)))
(with-current-buffer (vterm-toggle-cd)
(setq vterm-compile-buffer (current-buffer))
(rename-buffer "vterm compilation")
(compilation-shell-minor-mode 1)
(vterm-send-M-w)
(vterm-send-string compile-command t)
(vterm-send-return)))
)
(setq vterm-toggle-fullscreen-p nil)
(add-to-list 'display-buffer-alist
'((lambda (buffer-or-name _)
(let ((buffer (get-buffer buffer-or-name)))
(with-current-buffer buffer
(or (equal major-mode 'vterm-mode)
(string-prefix-p vterm-buffer-name (buffer-name buffer))))))
(display-buffer-reuse-window display-buffer-in-side-window)
;(side . bottom)
(side . right)
;;(dedicated . t) ;dedicated is supported in emacs27
(reusable-frames . visible)
(window-height . 0.3)))
)

This happens when I open vterm in emacs with M+x vterm and paste the content into vterm. My system is a mac emacs is emacs-plus@30. I also have iterm2 and zsh installed on my mac system
Thanks!