gabesoft / evil-mc

Multiple cursors implementation for evil-mode
MIT License
388 stars 36 forks source link

cursors from selection doesn't work before a first selection has been made #101

Closed duianto closed 4 years ago

duianto commented 4 years ago

Description :octocat:

The error message: (wrong-type-argument integer-or-marker-p nil) Is shown if grI or grA is pressed before a selection has been made after starting Emacs.

Reproduction guide :beetle:

Observed behaviour: :eyes: :broken_heart:

evil-mc-make-cursor-in-visual-selection: Wrong type argument: integer-or-marker-p, nil

Expected behaviour: :heart: :smile: A message could be shown: evil-mc-make-cursor-in-visual-selection-beg: Only works with a selection evil-mc-make-cursor-in-visual-selection-end: Only works with a selection

Something like this:

(message "%s: Only works with a selection" this-command)

Cause

The function: https://github.com/gabesoft/evil-mc/blob/ef22ee1a9d9a82a9b954f27f82ddcb7cb0f634ec/evil-mc-cursor-make.el#L477

calls: (count-lines evil-visual-beginning evil-visual-end) but before a selection has been made then both variables: evil-visual-beginning and evil-visual-end are nil.

System Info :computer:

evil-mc-20191124.538 GNU Emacs 26.3 (build 1, x86_64-w64-mingw32) of 2019-08-29 Windows 1903