Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
fuchsia.googlesource.com-third_party-rust-mirrors-rustyline
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fuchsia-mirror
fuchsia.googlesource.com-third_party-rust-mirrors-rustyline
Commits
66cc5c99
Commit
66cc5c99
authored
8 years ago
by
gwenn
Browse files
Options
Downloads
Patches
Plain Diff
Handle vi redo last command
parent
a74ef3c9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/keymap.rs
+7
-0
7 additions, 0 deletions
src/keymap.rs
with
7 additions
and
0 deletions
src/keymap.rs
+
7
−
0
View file @
66cc5c99
...
...
@@ -83,6 +83,7 @@ pub struct EditState {
insert
:
bool
,
// vi only ?
// numeric arguments: http://web.mit.edu/gnu/doc/html/rlman_1.html#SEC7
num_args
:
i16
,
last_cmd
:
Cmd
,
// vi only
}
#[derive(Debug,
Clone,
PartialEq)]
...
...
@@ -103,6 +104,7 @@ impl EditState {
mode
:
config
.edit_mode
(),
insert
:
true
,
num_args
:
0
,
last_cmd
:
Cmd
::
Noop
,
}
}
...
...
@@ -274,6 +276,7 @@ impl EditState {
let
cmd
=
match
key
{
KeyPress
::
Char
(
'$'
)
|
KeyPress
::
End
=>
Cmd
::
EndOfLine
,
KeyPress
::
Char
(
'.'
)
=>
self
.last_cmd
.clone
(),
// vi-redo
// TODO KeyPress::Char('%') => Cmd::???, Move to the corresponding opening/closing bracket
KeyPress
::
Char
(
'0'
)
=>
Cmd
::
BeginningOfLine
,
// vi-zero: Vi move to the beginning of line.
KeyPress
::
Char
(
'^'
)
=>
Cmd
::
BeginningOfLine
,
// vi-first-print TODO Move to the first non-blank character of line.
...
...
@@ -388,6 +391,9 @@ impl EditState {
_
=>
self
.common
(
key
,
n
,
true
),
};
debug!
(
target
:
"rustyline"
,
"Vi command: {:?}"
,
cmd
);
if
key
!=
KeyPress
::
Char
(
'.'
)
{
self
.last_cmd
=
cmd
.clone
();
}
Ok
(
cmd
)
}
...
...
@@ -406,6 +412,7 @@ impl EditState {
_
=>
self
.common
(
key
,
1
,
true
),
};
debug!
(
target
:
"rustyline"
,
"Vi insert: {:?}"
,
cmd
);
self
.last_cmd
=
cmd
.clone
();
Ok
(
cmd
)
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment