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
5034fdcd
Commit
5034fdcd
authored
7 years ago
by
Jeremy Soller
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #74 from dummie999/master
Fix a panic when using 'dL' or 'dG'
parents
de5e8219
8e781e00
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
TODO.md
+2
-1
2 additions, 1 deletion
TODO.md
src/caret/motion.rs
+2
-3
2 additions, 3 deletions
src/caret/motion.rs
src/edit/buffer.rs
+5
-1
5 additions, 1 deletion
src/edit/buffer.rs
src/edit/selection.rs
+2
-2
2 additions, 2 deletions
src/edit/selection.rs
with
11 additions
and
7 deletions
TODO.md
+
2
−
1
View file @
5034fdcd
...
...
@@ -7,7 +7,8 @@
Known bugs:
-
[x] When using
`t`
with a char that isn't in the document, Sodium will crash.
-
[x]
`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.
-
[x]
`dG`
on the last line of the file deletes from the cursor to the end of the line, instead of the entire line.
Not sure if intended.
The bug causing these two bugs, is localised to be in position.rs. It resolves by returning a value one over bound x
...
...
This diff is collapsed.
Click to expand it.
src/caret/motion.rs
+
2
−
3
View file @
5034fdcd
...
...
@@ -62,7 +62,6 @@ impl Editor {
pub
fn
to_motion_unbounded
(
&
mut
self
,
Inst
(
n
,
cmd
):
Inst
)
->
Option
<
(
isize
,
isize
)
>
{
use
io
::
key
::
Key
::
*
;
let
x
=
self
.x
();
let
y
=
self
.y
();
match
cmd
.key
{
...
...
@@ -71,8 +70,8 @@ impl Editor {
Char
(
'j'
)
=>
Some
(
self
.down_unbounded
(
n
.d
())),
Char
(
'k'
)
=>
Some
(
self
.up_unbounded
(
n
.d
())),
Char
(
'g'
)
=>
Some
((
0
,
n
.or
(
1
)
as
isize
-
1
)),
Char
(
'G'
)
=>
Some
((
0
,
self
.buffers
.current_buffer
()
.len
()
as
isize
-
1
)),
Char
(
'L'
)
=>
Some
(
to_signed_pos
((
x
,
self
.buffers
.current_buffer
()[
y
]
.len
()))),
Char
(
'G'
)
=>
Some
((
self
.buffers
.current_buffer
()[
y
]
.len
()
as
isize
,
self
.buffers
.current_buffer
()
.len
()
as
isize
-
1
)),
Char
(
'L'
)
=>
Some
(
to_signed_pos
((
self
.buffers
.current_buffer
()[
y
]
.len
()
,
y
))),
Char
(
'H'
)
=>
Some
((
0
,
y
as
isize
)),
Char
(
't'
)
=>
{
...
...
This diff is collapsed.
Click to expand it.
src/edit/buffer.rs
+
5
−
1
View file @
5034fdcd
...
...
@@ -146,7 +146,11 @@ impl<'a> TextBuffer<'a> for SplitBuffer {
self
.before
.remove
(
n
)
}
else
if
n
<
self
.len
()
{
let
n
=
self
.len
()
-
1
-
n
;
self
.after
.remove
(
n
)
let
ret
=
self
.after
.remove
(
n
);
if
n
==
0
{
self
.up
();
}
ret
}
else
{
panic!
(
"Out of bound"
);
}
...
...
This diff is collapsed.
Click to expand it.
src/edit/selection.rs
+
2
−
2
View file @
5034fdcd
...
...
@@ -7,8 +7,8 @@ impl Editor {
/// defines a position on the same line, only the characters from the current position to the
/// motion's position are removed.
pub
fn
remove_rb
<
'a
>
(
&
mut
self
,
(
x
,
y
):
(
isize
,
isize
))
{
if
y
==
self
.y
()
as
isize
{
let
(
x
,
y
)
=
self
.bound
((
x
as
usize
,
y
as
usize
),
tru
e
);
if
y
==
(
self
.y
()
as
isize
)
{
let
(
x
,
y
)
=
self
.bound
((
x
as
usize
,
y
as
usize
),
fals
e
);
// Single line mode
let
(
a
,
b
)
=
if
self
.x
()
>
x
{
(
x
,
self
.x
())
...
...
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