tumashu / ivy-posframe

ivy-posframe is a ivy extension, which let ivy use posframe to show its candidate menu, ivy-posframe is a **GNU ELPA** package.
415 stars 26 forks source link

cursor remains visible when evil-wants-minibuffer used #85

Open ambihelical opened 4 years ago

ambihelical commented 4 years ago

When evil-want-minibuffer is set (allows evil states in the minibuffer), there is a strange interaction when ivy-posframe is showing results. Basically the cursor is will be visible in the minibuffer area and be positioned in about the right location as if the minibuffer was actually still being used. Otherwise everything is still functioning correctly. Also if normal-mode is entered and the cursor moved to already typed input, the character under the cursor shows in the minibuffer area as well.

I'm not sure if this is a ivy-posframe issue, but I have no idea how to determine if ivy or evil are actually the problem. Any input would be appreciated.

The following is a fairly minimal init.el which shows the problem. Run emacs with this config, use M-x to bring up ivy-posframe. You should still see a cursor in the minibuffer area. Adding input moves this cursor corresponding to the position in the posframe. Hitting escape to go to normal mode and using j to move left will show the character under the cursor in the minibuffer area as well.

Remove the evil-want-minibuffer customization from this config, and there is no issue.

;;; -*- lexical-binding: t -*-

;; package management

(require 'package)

(setq package-archives '(("melpa" . "http://melpa.milkbox.net/packages/")
                         ("org"   . "http://orgmode.org/elpa/")
                         ("gnu"   . "https://elpa.gnu.org/packages/"))
      package-check-signature nil)
(package-initialize)
(unless package-archive-contents
  (package-refresh-contents))
(unless (package-installed-p 'use-package )
  (package-install 'use-package))
(eval-when-compile
  (require 'subr-x)                                               ; need string functions
  (setq use-package-enable-imenu-support t)                       ; support for packages in imenu
  (require 'use-package))

(use-package ivy
  :defer 1
  :config
  (ivy-mode 1))

;; Show ivy in a child window
(use-package ivy-posframe
  :hook (( ivy-mode ) . ivy-posframe-mode)
  :init
  (setq ivy-posframe-display-functions-alist
        '((t               . ivy-posframe-display-at-frame-center))))

(use-package evil
  :defer 0.5
  :custom
  (evil-want-minibuffer t)
  :config
  (evil-mode 1))
tumashu commented 4 years ago

ivy-posframe use minibuffer, it just let minibuffer fontground color = background color

conao3 commented 4 years ago

I could regenerate your issue. Also, it seems that the cursor change in evil mode is not reflected in ivy-posframe frame. This issue is related to #11.

I used below sample init.el

;; ~/.debug.emacs.d/ivy-posframe-with-evil/init.el

;; you can run like 'emacs -q -l ~/.debug.emacs.d/{{pkg}}/init.el'
(when load-file-name
  (setq user-emacs-directory
        (expand-file-name (file-name-directory load-file-name))))

(prog1 "prepare leaf"
  (prog1 "package"
    (custom-set-variables
     '(package-archives '(("org"   . "https://orgmode.org/elpa/")
                          ("melpa" . "https://melpa.org/packages/")
                          ("gnu"   . "https://elpa.gnu.org/packages/"))))
    (package-initialize))

  (prog1 "leaf"
    (unless (package-installed-p 'leaf)
      (package-refresh-contents)
      (package-install 'leaf))))

(leaf ivy
  :ensure t
  :custom ((ivy-mode     . t)
           (counsel-mode . t))
  :config
  (leaf ivy-posframe
    :ensure t
    :custom ((ivy-posframe-mode . t)
             (ivy-posframe-display-functions-alist
              . '((t . ivy-posframe-display-at-frame-center))))))

(leaf evil
  :ensure t
  :custom ((evil-want-minibuffer . t))
  :config (evil-mode 1))
weitongdao commented 4 years ago

呆神,请问下,pyim五笔候选框在 ivy-posframe中无法显示,只能通过盲猜输入汉字候选词条。 @tumashu