branch: elpa/evil-nerd-commenter
commit 7e9bb3256cde919b40fffb9585c48745c64d0929
Author: Chen Bin <[email protected]>
Commit: Chen Bin <[email protected]>
invert comment bug when used with text object #53
- `C-u 2 M-x evilnc-comment-operator j` comment 3 lines instead 2 lines
- Only happens on evil text object
- Thanks to Dickby for the fix
---
README.org | 4 ++--
evil-nerd-commenter-operator.el | 2 +-
evil-nerd-commenter.el | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/README.org b/README.org
index f4b7b0cb44..216fa5dcb8 100644
--- a/README.org
+++ b/README.org
@@ -113,7 +113,7 @@ Toggle flag evilnc-invert-comment-line-by-line.
When the flag is true, the command "evilnc-comment-or-uncomment-lines",
"evilnc-comment-or-uncomment-to-the-line", and
"evilnc-comment-or-uncomment-paragraphs" will be influenced. They will *invert*
each line's comment status instead comment the whole thing.
-Please note this command does NOT work on evil text object.
+Please note this command may NOT work on complex evil text object.
*** evilnc-kill-to-line
Kill from the current line to the user-specified line.
@@ -163,7 +163,7 @@ The first line is production code. The second line is your
debug code. You want
All you need to is "M-x evilnc-toggle-invert-comment-line-by-line" then "C-u 2
evilnc-comment-or-uncomment-lines". The first command turn on some flag, so the
behavior of (un)commenting is different.
* Evil usage
-If you use [[http://emacswiki.org/emacs/Evil][Evil]], you can use
[[http://vimdoc.sourceforge.net/htmldoc/motion.html#text-objects][text objects
and motions]].
+If you use [[http://emacswiki.org/emacs/Evil][Evil]], you can use
[[http://vimdoc.sourceforge.net/htmldoc/motion.html#text-objects][text objects
and motions]]. But if you only *deals with lines*, I suggest *using
evilnc-comment-or-uncomment-lines instead*.
"evilnc-comment-operator" acts much like the delete/change operator. Takes a
motion or text object and comments it out, yanking its content in the process.
diff --git a/evil-nerd-commenter-operator.el b/evil-nerd-commenter-operator.el
index 28c14c3615..2e20ed8112 100644
--- a/evil-nerd-commenter-operator.el
+++ b/evil-nerd-commenter-operator.el
@@ -52,7 +52,7 @@
(= (char-before beg) ?\n))
(evilnc--comment-or-uncomment-region (1- beg) end))
((eq type 'line)
- (evilnc--comment-or-uncomment-region beg end))
+ (evilnc--comment-or-uncomment-region beg (1- end)))
(t
(let ((newpos (evilnc--extend-to-whole-comment beg end) ))
(evilnc--comment-or-uncomment-region (nth 0 newpos) (nth 1 newpos))
diff --git a/evil-nerd-commenter.el b/evil-nerd-commenter.el
index 353fad83c3..e510d48bb2 100644
--- a/evil-nerd-commenter.el
+++ b/evil-nerd-commenter.el
@@ -436,7 +436,7 @@ or 'C-u 3 M-x
evilnc-quick-comment-or-uncomment-to-the-line' to comment to the l
;;;###autoload
(defun evilnc-toggle-invert-comment-line-by-line ()
- "Please note this command does NOT work on evil text objects"
+ "Please note this command may NOT work on complex evil text objects"
(interactive)
(if evilnc-invert-comment-line-by-line
(setq evilnc-invert-comment-line-by-line nil)