Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sodium
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
29
Issues
29
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
redox-os
sodium
Commits
90b88c36
Commit
90b88c36
authored
Oct 29, 2015
by
Ticki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update todo, and optimize
parent
6eb63e20
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
16 additions
and
13 deletions
+16
-13
TODO.md
TODO.md
+7
-3
cursor.rs
cursor.rs
+2
-2
delete.rs
delete.rs
+1
-2
editor.rs
editor.rs
+2
-2
help.txt
help.txt
+2
-0
insert.rs
insert.rs
+1
-2
parse.rs
parse.rs
+0
-1
position.rs
position.rs
+1
-1
No files found.
TODO.md
View file @
90b88c36
-
[ ] Fix
`d<motion>`
-
[ ] Add 't' command
-
[ ] Clear up
`let`
borrowck bypassers
-
[ ] Make editor.pos method and use that instead of
-
[ ] Add word navigation
Known bugs:
-
[ ] When using
`t`
with a char that isn't in the document, Sodium will crash.
-
[ ]
`d<motion>`
does not do anything if: 1) the motion moves to the end of a line. 2) if the motion moves to the last line.
cursor.rs
View file @
90b88c36
...
...
@@ -30,8 +30,8 @@ impl Editor {
/// Get the char under the cursor
#[inline]
pub
fn
current
(
&
self
)
->
char
{
let
curs
=
self
.cursor
();
self
.text
[
curs
.y
][
curs
.
x
]
let
(
x
,
y
)
=
self
.pos
();
self
.text
[
y
][
x
]
}
/// Get the current cursor
...
...
delete.rs
View file @
90b88c36
...
...
@@ -4,8 +4,7 @@ impl Editor {
/// Delete char
#[inline]
pub
fn
delete
(
&
mut
self
)
{
let
y
=
self
.y
();
let
x
=
self
.x
();
let
(
x
,
y
)
=
self
.pos
();
if
self
.text
[
y
]
.is_empty
()
{
if
self
.text
.len
()
!=
1
{
self
.text
.remove
(
y
);
...
...
editor.rs
View file @
90b88c36
...
...
@@ -37,7 +37,7 @@ impl Editor {
let
mut
editor
=
Editor
{
current_cursor
:
0
,
cursors
:
Vec
::
new
()
,
cursors
:
vec!
[
Cursor
::
new
()]
,
text
:
VecDeque
::
new
(),
scroll_x
:
0
,
scroll_y
:
0
,
...
...
@@ -48,10 +48,10 @@ impl Editor {
options
:
Options
::
new
(),
};
editor
.cursors
.push
(
Cursor
::
new
());
editor
.text
.push_back
(
VecDeque
::
new
());
editor
.redraw
();
loop
{
let
inp
=
editor
.next_inst
();
editor
.exec
(
inp
);
...
...
help.txt
View file @
90b88c36
...
...
@@ -69,6 +69,7 @@ Navigation:
- <numeral>g : Go to <numeral> line
- g<motion> : Do <motion>
- G : Go to the end of the document
- t<char> : Go to the next occurence of <char>
Cursor management:
- b : Branch the cursor
...
...
@@ -143,6 +144,7 @@ stated.
line
- <numeral>g : Go to <numeral> line
- G : Go to the end of the document
- t<char> : Go to the next occurence of <char>
Tips'n'tricks
-------------
...
...
insert.rs
View file @
90b88c36
...
...
@@ -23,8 +23,7 @@ pub struct InsertOptions {
impl
Editor
{
/// Insert text
pub
fn
insert
(
&
mut
self
,
k
:
Key
,
InsertOptions
{
mode
:
mode
}:
InsertOptions
)
{
let
mut
x
=
self
.x
();
let
mut
y
=
self
.y
();
let
(
mut
x
,
mut
y
)
=
self
.pos
();
match
mode
{
InsertMode
::
Insert
=>
match
k
{
Key
::
Char
(
'\n'
)
=>
{
...
...
parse.rs
View file @
90b88c36
...
...
@@ -131,6 +131,5 @@ impl Editor {
}
}
unreachable!
()
}
}
position.rs
View file @
90b88c36
...
...
@@ -14,7 +14,7 @@ impl Editor {
pub
fn
x
(
&
self
)
->
usize
{
self
.pos
()
.0
}
#[inline]
/// Y coordinate
pub
fn
y
(
&
self
)
->
usize
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment