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
4f274a32
Commit
4f274a32
authored
7 years ago
by
Paul Sajna
Browse files
Options
Downloads
Patches
Plain Diff
infer file to save to from file opened
parent
22c312a9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/io/file.rs
+4
-1
4 additions, 1 deletion
src/io/file.rs
src/state/editor.rs
+6
-0
6 additions, 0 deletions
src/state/editor.rs
with
10 additions
and
1 deletion
src/io/file.rs
+
4
−
1
View file @
4f274a32
...
...
@@ -37,8 +37,11 @@ impl Editor {
}
/// Write the file.
pub
fn
write
(
&
mut
self
,
path
:
&
str
)
->
FileStatus
{
pub
fn
write
<
'a
>
(
&
'a
mut
self
,
mut
path
:
&
'a
str
)
->
FileStatus
{
self
.buffers
.current_buffer_info_mut
()
.title
=
Some
(
path
.into
());
if
path
==
""
{
path
=
self
.files
[
0
]
.as_str
();
}
if
let
Some
(
mut
file
)
=
File
::
create
(
path
)
.ok
()
{
if
file
.write
(
self
.buffers
.current_buffer
()
.to_string
()
.as_bytes
())
.is_ok
()
...
...
This diff is collapsed.
Click to expand it.
src/state/editor.rs
+
6
−
0
View file @
4f274a32
...
...
@@ -185,6 +185,8 @@ pub struct Editor {
pub
char_width
:
usize
,
/// The character height in pixels
pub
char_height
:
usize
,
/// The files currently open
pub
files
:
Vec
<
String
>
,
}
impl
Editor
{
...
...
@@ -207,6 +209,7 @@ impl Editor {
previous_instruction
:
None
,
char_width
:
8
,
char_height
:
16
,
files
:
Vec
::
new
(),
};
#[cfg(not(feature
=
"orbital"
))]
...
...
@@ -221,6 +224,7 @@ impl Editor {
previous_instruction
:
None
,
char_width
:
8
,
char_height
:
16
,
files
:
Vec
::
new
(),
};
let
mut
files
:
Vec
<
String
>
=
Vec
::
new
();
...
...
@@ -264,6 +268,7 @@ impl Editor {
for
file
in
args_iter
{
files
.push
(
file
);
}
editor
.files
=
files
.clone
();
break
;
}
_
=>
{
...
...
@@ -291,6 +296,7 @@ impl Editor {
}
files
.push
(
arg
);
editor
.files
=
files
.clone
()
}
}
}
...
...
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