Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insert state changes line height #60

Open
duianto opened this issue May 4, 2017 · 3 comments
Open

Insert state changes line height #60

duianto opened this issue May 4, 2017 · 3 comments

Comments

@duianto
Copy link
Contributor

duianto commented May 4, 2017

Description

In windows the line height changes when one enters and exits insert state.
It happens on any line with a multi cursor.

Windows 10

evil-mc-windows-emacs-normal-vs-insert-line-height
evil-mc-windows-spacemacs-normal-vs-insert-line-height

Ubuntu 16.10

It works as expected in Ubuntu.

evil-mc-ubuntu-emacs-normal-vs-insert-line-height
evil-mc-ubuntu-spacemacs-normal-vs-insert-line-height

System Info

The first animation for each OS shows: Emacs with the evil-mc package installed.
The second animation shows: Spacemacs 0.200.9 (develop branch).

System 1:

Emacs 25.1.1
Windows 10

System 2 (Windows 10, Virtual box host OS):

Emacs 26.0.50
Ubuntu 16.10

@gabesoft
Copy link
Owner

gabesoft commented May 5, 2017

This is a known issue on Windows and Mac. To turn off that behavior and have the fake cursors have the default cursor face set this variable evil-mc-enable-bar-cursor to nil.

@duianto
Copy link
Contributor Author

duianto commented May 6, 2017

Thanks, setting the evil-mc-enable-bar-cursor variable to nil stops the line height from changing.

XPM images as additional cursors

If there aren't any downsides to using XPM images as the additional cursors. Then I might have found a solution to the Windows cursor issue.

This question: http://stackoverflow.com/questions/23744237/emacs-how-to-create-a-vertical-strike-through-effect
shows two examples of how to draw XPM images in Emacs. I modified the last example, so that it shows a 1px wide and 16px tall, vertical line (16px is the same height as the cursor).

(let* ((img `(image :type xpm :mask nil :ascent center :data
                    "/* XPM */
      static char * img_xpm[] = {
      \"1 16 1 1\",
      \"* c green\",
      \"*\",
      \"*\",
      \"*\",
      \"*\",
      \"*\",
      \"*\",
      \"*\",
      \"*\",
      \"*\",
      \"*\",
      \"*\",
      \"*\",
      \"*\",
      \"*\",
      \"*\",
      \"*\"};"))
       (img-str (propertize " " 'display img))
       (vertical-line-overlay (make-overlay (point) (1+ (point)))))
  (overlay-put vertical-line-overlay 'before-string img-str)
  (internal-show-cursor nil nil)
  (sit-for 2)
  (internal-show-cursor nil t)
  (delete-overlay vertical-line-overlay))

Here's a comparison of the normal and insert state cursors, to the XPM image (with the cursor hidden).

xpm-vertical-line

Where it works

The XPM image looks the same in both Ubuntu and Windows.

Terminals issue:

XPM images probably won't work with text only terminals.

Possible solution:

(display-graphic-p) returns t when a gui version of Emacs is used.

mask descriptor

Maybe :mask nil can be removed from the line:
(let* ((img `(image :type xpm :mask nil :ascent center :data
Because it seems to work the same, both with or without it.

This page describes the :mask image descriptor: http://www.gnu.org/software/emacs/manual/html_node/elisp/Image-Descriptors.html

@gabesoft
Copy link
Owner

gabesoft commented May 7, 2017

Thanks, that definitely looks interesting. I'll look into using XPM images when I have some time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants