mirror of
https://github.com/magnars/multiple-cursors.el.git
synced 2025-10-13 13:03:03 +00:00
Create customizable mc/insert-numbers-default
This commit fulfills the feature request from #248 and creates a customizable variable called mc/insert-numbers-default which is the starting value for mc/insert-numbers if no arg is passed
This commit is contained in:
parent
a508978cd9
commit
be149f9121
@ -17,3 +17,24 @@ Feature: Insert increasing numbers
|
||||
When I press "C-u H-0"
|
||||
And I press "SPC"
|
||||
Then I should see "This 4 text contains the word 5 text thrice (6 text)"
|
||||
|
||||
Scenario: Three cursors, 0-1-2, default
|
||||
Given I have cursors at "text" in "This text contains the word text thrice (text)"
|
||||
When I set mc/insert-numbers-default to 1
|
||||
And I press "H-0"
|
||||
And I press "SPC"
|
||||
Then I should see "This 1 text contains the word 2 text thrice (3 text)"
|
||||
|
||||
Scenario: Three cursors, 9-10-11, default
|
||||
Given I have cursors at "text" in "This text contains the word text thrice (text)"
|
||||
When I set mc/insert-numbers-default to 1
|
||||
And I press "C-9 H-0"
|
||||
And I press "SPC"
|
||||
Then I should see "This 9 text contains the word 10 text thrice (11 text)"
|
||||
|
||||
Scenario: Three cursors, 9-10-11, default
|
||||
Given I have cursors at "text" in "This text contains the word text thrice (text)"
|
||||
When I set mc/insert-numbers-default to 1
|
||||
And I press "C-u H-0"
|
||||
And I press "SPC"
|
||||
Then I should see "This 4 text contains the word 5 text thrice (6 text)"
|
||||
|
@ -31,13 +31,20 @@
|
||||
|
||||
;;;###autoload
|
||||
(defun mc/insert-numbers (arg)
|
||||
"Insert increasing numbers for each cursor, starting at 0 or ARG."
|
||||
"Insert increasing numbers for each cursor, starting at
|
||||
`mc/insert-numbers-default' or ARG."
|
||||
(interactive "P")
|
||||
(setq mc--insert-numbers-number (or (and arg (prefix-numeric-value arg))
|
||||
0))
|
||||
mc/insert-numbers-default))
|
||||
(mc/for-each-cursor-ordered
|
||||
(mc/execute-command-for-fake-cursor 'mc--insert-number-and-increase cursor)))
|
||||
|
||||
(defcustom mc/insert-numbers-default 0
|
||||
"The default number at which to start counting for
|
||||
`mc/insert-numbers'"
|
||||
:type 'integer
|
||||
:group 'multiple-cursors)
|
||||
|
||||
(defvar mc--insert-numbers-number 0)
|
||||
|
||||
(defun mc--insert-number-and-increase ()
|
||||
|
Loading…
x
Reference in New Issue
Block a user