Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
sodium
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Frans Klaver
sodium
Commits
d77a9540
Commit
d77a9540
authored
8 years ago
by
Wesley Wiser
Browse files
Options
Downloads
Patches
Plain Diff
Add 'Repeat last command' ('.')
Fixes #29
parent
8a36ca75
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
help.txt
+1
-0
1 addition, 0 deletions
help.txt
src/core/exec.rs
+12
-0
12 additions, 0 deletions
src/core/exec.rs
src/state/editor.rs
+4
-0
4 additions, 0 deletions
src/state/editor.rs
with
17 additions
and
0 deletions
help.txt
+
1
−
0
View file @
d77a9540
...
...
@@ -101,6 +101,7 @@ Editing:
( -> )
/ -> \
- ; : Go to prompt mode
- . : Repeat the previous command
# Insert
...
...
This diff is collapsed.
Click to expand it.
src/core/exec.rs
+
12
−
0
View file @
d77a9540
...
...
@@ -220,6 +220,14 @@ impl Editor {
(
Command
(
Normal
),
Char
(
'~'
))
=>
{
self
.invert_chars
(
n
);
}
(
Command
(
Normal
),
Char
(
'.'
))
=>
{
if
let
Some
(
inst
)
=
self
.previous_instruction
{
self
.exec
(
inst
);
}
else
{
self
.status_bar.msg
=
"No previous command"
.into
();
self
.redraw_task
=
RedrawTask
::
StatusBar
;
}
}
(
Command
(
Normal
),
Char
(
c
))
=>
{
self
.status_bar.msg
=
format!
(
"Unknown command: {}"
,
c
);
self
.redraw_task
=
RedrawTask
::
StatusBar
;
...
...
@@ -249,5 +257,9 @@ impl Editor {
if
mov
{
self
.redraw_task
=
RedrawTask
::
Cursor
(
bef
,
self
.pos
());
}
if
!
(
self
.cursor
()
.mode
==
Command
(
Normal
)
&&
cmd
.key
==
Char
(
'.'
))
{
self
.previous_instruction
=
Some
(
Inst
(
para
,
cmd
));
}
}
}
This diff is collapsed.
Click to expand it.
src/state/editor.rs
+
4
−
0
View file @
d77a9540
...
...
@@ -37,6 +37,8 @@ pub struct Editor {
pub
key_state
:
KeyState
,
/// Redraw
pub
redraw_task
:
RedrawTask
,
/// The previous instruction
pub
previous_instruction
:
Option
<
Inst
>
,
}
impl
Editor
{
...
...
@@ -59,6 +61,7 @@ impl Editor {
options
:
Options
::
new
(),
key_state
:
KeyState
::
new
(),
redraw_task
:
RedrawTask
::
None
,
previous_instruction
:
None
,
};
#[cfg(not(feature
=
"orbital"
))]
...
...
@@ -73,6 +76,7 @@ impl Editor {
options
:
Options
::
new
(),
key_state
:
KeyState
::
new
(),
redraw_task
:
RedrawTask
::
None
,
previous_instruction
:
None
,
};
if
let
Some
(
x
)
=
args
()
.skip
(
1
)
.next
()
{
...
...
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