Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
Bevy Cosmic Edit
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package 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
Microhacks
Bevy Forks
Bevy Cosmic Edit
Commits
fa8e49b4
Unverified
Commit
fa8e49b4
authored
1 year ago
by
sam
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
fix no focus causing failed rendering (#97)
parent
28e00c94
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/lib.rs
+7
-2
7 additions, 2 deletions
src/lib.rs
src/render.rs
+9
-6
9 additions, 6 deletions
src/render.rs
with
16 additions
and
8 deletions
src/lib.rs
+
7
−
2
View file @
fa8e49b4
...
...
@@ -507,12 +507,17 @@ fn cosmic_editor_builder(
mut
commands
:
Commands
,
)
{
for
(
entity
,
metrics
)
in
added_editors
.iter_mut
()
{
let
buffer
=
Buffer
::
new
(
let
mut
buffer
=
Buffer
::
new
(
&
mut
font_system
.0
,
Metrics
::
new
(
metrics
.font_size
,
metrics
.line_height
)
.scale
(
metrics
.scale_factor
),
);
// buffer.set_wrap(&mut font_system.0, cosmic_text::Wrap::None);
let
editor
=
Editor
::
new
(
buffer
);
buffer
.set_redraw
(
true
);
let
mut
editor
=
Editor
::
new
(
buffer
);
let
mut
cursor
=
editor
.cursor
();
cursor
.color
=
Some
(
cosmic_text
::
Color
::
rgba
(
0
,
0
,
0
,
0
));
editor
.set_cursor
(
cursor
);
commands
.entity
(
entity
)
.insert
(
CosmicEditor
(
editor
));
commands
.entity
(
entity
)
.insert
(
CosmicEditHistory
::
default
());
...
...
This diff is collapsed.
Click to expand it.
src/render.rs
+
9
−
6
View file @
fa8e49b4
...
...
@@ -429,14 +429,14 @@ pub(crate) fn hide_inactive_or_readonly_cursor(
editor
.0
.buffer_mut
()
.set_redraw
(
true
);
}
if
active_editor
.is_changed
()
||
active_editor
.0
.is_none
()
{
return
;
}
for
(
e
,
mut
editor
,
readonly_opt
)
in
&
mut
cosmic_editor_q_placeholder
.iter_mut
()
{
if
e
!=
active_editor
.0
.unwrap
()
||
readonly_opt
.is_some
()
{
// filthy short circuiting instead of correct unwrapping
if
active_editor
.is_none
()
||
e
!=
active_editor
.0
.unwrap
()
||
readonly_opt
.is_some
()
{
let
editor
=
&
mut
editor
.0
;
let
mut
cursor
=
editor
.0
.cursor
();
if
cursor
.color
==
Some
(
cosmic_text
::
Color
::
rgba
(
0
,
0
,
0
,
0
))
{
return
;
}
cursor
.color
=
Some
(
cosmic_text
::
Color
::
rgba
(
0
,
0
,
0
,
0
));
editor
.0
.set_cursor
(
cursor
);
editor
.0
.buffer_mut
()
.set_redraw
(
true
);
...
...
@@ -444,8 +444,11 @@ pub(crate) fn hide_inactive_or_readonly_cursor(
}
for
(
e
,
mut
editor
)
in
&
mut
cosmic_editor_q_editable
.iter_mut
()
{
if
e
!=
active_editor
.0
.unwrap
()
{
if
active_editor
.is_none
()
||
e
!=
active_editor
.0
.unwrap
()
{
let
mut
cursor
=
editor
.0
.cursor
();
if
cursor
.color
==
Some
(
cosmic_text
::
Color
::
rgba
(
0
,
0
,
0
,
0
))
{
return
;
}
cursor
.color
=
Some
(
cosmic_text
::
Color
::
rgba
(
0
,
0
,
0
,
0
));
editor
.0
.set_cursor
(
cursor
);
editor
.0
.buffer_mut
()
.set_redraw
(
true
);
...
...
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