Skip to content

Commit 659b538

Browse files
committed
prepare release for 0.0.7
1 parent fde7c7f commit 659b538

File tree

8 files changed

+85
-58
lines changed

8 files changed

+85
-58
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ theme = "lucario"
1919
font-size = 18
2020
```
2121

22+
- Fix Background color not entirely set on vim [#88](https://github.com/raphamorim/rio/issues/88)
2223
- Scroll now works for x11 and wayland.
2324
- No longer renders to macos and x11 windows that are fully occluded / not directly visible.
2425
- Introduced `window-opacity` config property for WebAssembly and Wayland builds.

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

misc/osx/Rio.app/Contents/Info.plist

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@
1717
<key>CFBundlePackageType</key>
1818
<string>APPL</string>
1919
<key>CFBundleIconFile</key>
20-
<string>Rio-canary.icns</string>
20+
<!-- <string>Rio-canary.icns</string> -->
21+
<string>Rio-stable.icns</string>
2122
<key>CFBundleShortVersionString</key>
22-
<string>0.0.7-canary</string>
23+
<string>0.0.7</string>
2324
<key>CFBundleVersion</key>
2425
<string>20230528.115631</string>
2526
<key>CSResourcesFileMapped</key>

rio/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rio"
3-
version = "0.0.7-canary"
3+
version = "0.0.7"
44
authors = ["Raphael Amorim <[email protected]>"]
55
edition = "2021"
66
license = "MIT"

rio/src/screen/state.rs

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ impl State {
206206
let mut decoration = None;
207207
if flags.contains(Flags::UNDERLINE) {
208208
decoration = Some(SugarDecoration {
209-
position: (0.0, 0.95),
209+
position: (0.0, 0.92),
210210
size: (1.0, 0.025),
211211
color: self.named_colors.foreground,
212212
});
@@ -236,7 +236,7 @@ impl State {
236236
color: self.named_colors.cursor,
237237
}),
238238
CursorShape::Underline => Some(SugarDecoration {
239-
position: (0.0, 0.95),
239+
position: (0.0, 0.92),
240240
size: (1.0, 0.05),
241241
color: self.named_colors.cursor,
242242
}),
@@ -249,6 +249,21 @@ impl State {
249249
}
250250
}
251251

252+
#[inline]
253+
fn create_empty_sugar_stack_from_columns(&self, columns: usize) -> SugarStack {
254+
let mut stack: Vec<Sugar> = vec![];
255+
for _ in 0..columns {
256+
stack.push(Sugar {
257+
content: ' ',
258+
foreground_color: self.named_colors.background.0,
259+
background_color: self.named_colors.background.0,
260+
style: None,
261+
decoration: None,
262+
})
263+
}
264+
stack
265+
}
266+
252267
#[inline]
253268
fn create_sugar_stack_with_selection(
254269
&mut self,
@@ -356,6 +371,7 @@ impl State {
356371
) {
357372
self.cursor.state = cursor;
358373
let is_cursor_visible = self.cursor.state.is_visible();
374+
359375
if let Some(sel) = self.selection_range {
360376
for (i, row) in rows.iter().enumerate() {
361377
let has_cursor = is_cursor_visible && self.cursor.state.pos.row == i;
@@ -367,15 +383,18 @@ impl State {
367383
);
368384
sugarloaf.stack(sugar_stack);
369385
}
370-
371-
return;
386+
} else {
387+
for (i, row) in rows.iter().enumerate() {
388+
let has_cursor = is_cursor_visible && self.cursor.state.pos.row == i;
389+
let sugar_stack = self.create_sugar_stack(row, has_cursor);
390+
sugarloaf.stack(sugar_stack);
391+
}
372392
}
373393

374-
for (i, row) in rows.iter().enumerate() {
375-
let has_cursor = is_cursor_visible && self.cursor.state.pos.row == i;
376-
let sugar_stack = self.create_sugar_stack(row, has_cursor);
377-
sugarloaf.stack(sugar_stack);
378-
}
394+
// This is a fake row created only for visual purposes
395+
let empty_last_line =
396+
self.create_empty_sugar_stack_from_columns(sugarloaf.layout.columns);
397+
sugarloaf.stack(empty_last_line);
379398

380399
if context_manager.len() > 1 {
381400
let mut renderable_tabs = vec![];

sugarloaf/src/layout/mod.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,17 +136,19 @@ impl SugarloafLayout {
136136

137137
// SugarStack is a primitive representation of columns data
138138
let current_stack_bound = self.font_bound * self.columns as f32;
139-
let expected_stack_bound = self.width / self.scale_factor - self.font_bound;
139+
let expected_stack_bound = self.width / self.scale_factor - self.font_bound;
140140

141141
log::info!("expected {}", self.columns);
142142
if current_stack_bound < expected_stack_bound {
143-
let stack_difference = ((expected_stack_bound - current_stack_bound) / self.font_bound) as usize;
143+
let stack_difference =
144+
((expected_stack_bound - current_stack_bound) / self.font_bound) as usize;
144145
log::info!("recalculating columns due to font width, adding more {stack_difference:?} columns");
145146
self.columns += stack_difference;
146147
}
147148

148149
if current_stack_bound > expected_stack_bound {
149-
let stack_difference = ((current_stack_bound - expected_stack_bound) / self.font_bound) as usize;
150+
let stack_difference =
151+
((current_stack_bound - expected_stack_bound) / self.font_bound) as usize;
150152
log::info!("recalculating columns due to font width, removing {stack_difference:?} columns");
151153
self.columns -= stack_difference;
152154
}

sugarloaf/src/sugarloaf.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,10 @@ impl Sugarloaf {
259259
self.acc_line_y,
260260
],
261261
color: sugar.background_color,
262-
size: [add_pos_x * mod_size, ((self.font_bounds.default.0 * mod_size).ceil() + mod_size)],
262+
size: [
263+
add_pos_x * mod_size,
264+
((self.font_bounds.default.0 * mod_size).ceil() + mod_size),
265+
],
263266
});
264267

265268
if let Some(decoration) = &sugar.decoration {
@@ -275,7 +278,7 @@ impl Sugarloaf {
275278
color: decoration.color,
276279
size: [
277280
(dx * decoration.size.0) * mod_size,
278-
((dy * decoration.size.1) * mod_size).ceil() + mod_size,
281+
((dy * decoration.size.1) * mod_size).ceil(),
279282
],
280283
});
281284
}
@@ -340,7 +343,6 @@ impl Sugarloaf {
340343
(0., 0.)
341344
}
342345

343-
344346
pub fn set_background_color(&mut self, color: wgpu::Color) -> &mut Self {
345347
self.layout.background_color = color;
346348
self
@@ -355,6 +357,7 @@ impl Sugarloaf {
355357
///
356358
#[inline]
357359
pub fn calculate_bounds(&mut self) {
360+
// TODO: Write tests for calculate_bounds
358361
self.reset_state();
359362
self.rects = vec![];
360363

@@ -384,7 +387,8 @@ impl Sugarloaf {
384387
// Bounds are defined in runtime
385388
self.font_bounds.default = self.get_font_bounds(' ', FontId(0));
386389

387-
self.layout.update_columns_lines_per_font_bound(self.font_bounds.default.0);
390+
self.layout
391+
.update_columns_lines_per_font_bound(self.font_bounds.default.0);
388392

389393
self.font_bounds.symbols =
390394
// U+2AF9 => \u{2AF9} => ⫹

webassembly-examples/sugarloaf-styled-text/src/lib.rs

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ async fn run() {
7878
background_color: [0.0, 0.0, 0.0, 1.0],
7979
style: None,
8080
decoration: Some(SugarDecoration {
81-
position: (0.0, 0.95),
82-
size: (1.0, 0.025),
81+
position: (0.0, 0.90),
82+
size: (1.0, 0.050),
8383
color: [0.0, 0.0, 0.0, 1.0],
8484
}),
8585
},
@@ -89,7 +89,7 @@ async fn run() {
8989
background_color: [1.0, 1.0, 1.0, 1.0],
9090
style: None,
9191
decoration: Some(SugarDecoration {
92-
position: (0.0, 0.95),
92+
position: (0.0, 0.90),
9393
size: (1.0, 0.025),
9494
color: [0.0, 0.0, 0.0, 1.0],
9595
}),
@@ -100,7 +100,7 @@ async fn run() {
100100
background_color: [0.0, 0.0, 0.0, 1.0],
101101
style: None,
102102
decoration: Some(SugarDecoration {
103-
position: (0.0, 0.95),
103+
position: (0.0, 0.92),
104104
size: (1.0, 0.025),
105105
color: [0.0, 0.0, 0.0, 1.0],
106106
}),
@@ -111,7 +111,7 @@ async fn run() {
111111
background_color: [1.0, 1.0, 1.0, 1.0],
112112
style: None,
113113
decoration: Some(SugarDecoration {
114-
position: (0.0, 0.95),
114+
position: (0.0, 0.92),
115115
size: (1.0, 0.025),
116116
color: [0.0, 0.0, 0.0, 1.0],
117117
}),
@@ -122,7 +122,7 @@ async fn run() {
122122
background_color: [0.0, 0.0, 0.0, 1.0],
123123
style: None,
124124
decoration: Some(SugarDecoration {
125-
position: (0.0, 0.95),
125+
position: (0.0, 0.92),
126126
size: (1.0, 0.025),
127127
color: [0.0, 0.0, 0.0, 1.0],
128128
}),
@@ -133,7 +133,7 @@ async fn run() {
133133
background_color: [0.0, 0.0, 1.0, 1.0],
134134
style: None,
135135
decoration: Some(SugarDecoration {
136-
position: (0.0, 0.95),
136+
position: (0.0, 0.92),
137137
size: (1.0, 0.025),
138138
color: [0.0, 0.0, 0.0, 1.0],
139139
}),
@@ -151,7 +151,7 @@ async fn run() {
151151
background_color: [1.0, 1.0, 1.0, 1.0],
152152
style: None,
153153
decoration: Some(SugarDecoration {
154-
position: (0.0, 0.95),
154+
position: (0.0, 0.92),
155155
size: (1.0, 0.025),
156156
color: [0.0, 0.0, 0.0, 1.0],
157157
}),
@@ -162,7 +162,7 @@ async fn run() {
162162
background_color: [1.0, 1.0, 1.0, 1.0],
163163
style: None,
164164
decoration: Some(SugarDecoration {
165-
position: (0.0, 0.95),
165+
position: (0.0, 0.92),
166166
size: (1.0, 0.025),
167167
color: [0.0, 0.0, 0.0, 1.0],
168168
}),
@@ -173,7 +173,7 @@ async fn run() {
173173
background_color: [1.0, 1.0, 1.0, 1.0],
174174
style: None,
175175
decoration: Some(SugarDecoration {
176-
position: (0.0, 0.95),
176+
position: (0.0, 0.92),
177177
size: (1.0, 0.025),
178178
color: [0.0, 0.0, 0.0, 1.0],
179179
}),
@@ -184,7 +184,7 @@ async fn run() {
184184
background_color: [1.0, 1.0, 1.0, 1.0],
185185
style: None,
186186
decoration: Some(SugarDecoration {
187-
position: (0.0, 0.95),
187+
position: (0.0, 0.92),
188188
size: (1.0, 0.025),
189189
color: [0.0, 0.0, 0.0, 1.0],
190190
}),
@@ -195,7 +195,7 @@ async fn run() {
195195
background_color: [1.0, 1.0, 1.0, 1.0],
196196
style: None,
197197
decoration: Some(SugarDecoration {
198-
position: (0.0, 0.95),
198+
position: (0.0, 0.92),
199199
size: (1.0, 0.025),
200200
color: [0.0, 0.0, 0.0, 1.0],
201201
}),
@@ -340,7 +340,7 @@ async fn run() {
340340
background_color: [0.0, 0.0, 0.0, 1.0],
341341
style: None,
342342
decoration: Some(SugarDecoration {
343-
position: (0.0, 0.95),
343+
position: (0.0, 0.92),
344344
size: (1.0, 0.05),
345345
color: [0.0, 0.0, 0.0, 1.0],
346346
}),
@@ -396,65 +396,65 @@ async fn run() {
396396
background_color: [0.0, 0.0, 0.0, 1.0],
397397
style: None,
398398
decoration: Some(SugarDecoration {
399-
position: (0.0, 0.5),
400-
size: (1.0, 0.025),
401-
color: [0.5, 0.5, 0.0, 1.0],
402-
}),
399+
position: (0.0, 0.5),
400+
size: (1.0, 0.025),
401+
color: [0.5, 0.5, 0.0, 1.0],
402+
}),
403403
},
404404
Sugar {
405405
content: 't',
406406
foreground_color: [1.0, 1.0, 1.0, 1.0],
407407
background_color: [0.0, 0.0, 0.0, 1.0],
408408
style: None,
409409
decoration: Some(SugarDecoration {
410-
position: (0.0, 0.5),
411-
size: (1.0, 0.025),
412-
color: [0.5, 0.5, 0.0, 1.0],
413-
}),
410+
position: (0.0, 0.5),
411+
size: (1.0, 0.025),
412+
color: [0.5, 0.5, 0.0, 1.0],
413+
}),
414414
},
415415
Sugar {
416416
content: 'r',
417417
foreground_color: [1.0, 1.0, 1.0, 1.0],
418418
background_color: [0.0, 0.0, 0.0, 1.0],
419419
style: None,
420420
decoration: Some(SugarDecoration {
421-
position: (0.0, 0.5),
422-
size: (1.0, 0.025),
423-
color: [0.5, 0.5, 0.0, 1.0],
424-
}),
421+
position: (0.0, 0.5),
422+
size: (1.0, 0.025),
423+
color: [0.5, 0.5, 0.0, 1.0],
424+
}),
425425
},
426426
Sugar {
427427
content: 'i',
428428
foreground_color: [1.0, 1.0, 1.0, 1.0],
429429
background_color: [0.0, 0.0, 0.0, 1.0],
430430
style: None,
431431
decoration: Some(SugarDecoration {
432-
position: (0.0, 0.5),
433-
size: (1.0, 0.025),
434-
color: [0.5, 0.5, 0.0, 1.0],
435-
}),
432+
position: (0.0, 0.5),
433+
size: (1.0, 0.025),
434+
color: [0.5, 0.5, 0.0, 1.0],
435+
}),
436436
},
437437
Sugar {
438438
content: 'k',
439439
foreground_color: [1.0, 1.0, 1.0, 1.0],
440440
background_color: [0.0, 0.0, 0.0, 1.0],
441441
style: None,
442442
decoration: Some(SugarDecoration {
443-
position: (0.0, 0.5),
444-
size: (1.0, 0.025),
445-
color: [0.5, 0.5, 0.0, 1.0],
446-
}),
443+
position: (0.0, 0.5),
444+
size: (1.0, 0.025),
445+
color: [0.5, 0.5, 0.0, 1.0],
446+
}),
447447
},
448448
Sugar {
449449
content: 'e',
450450
foreground_color: [1.0, 1.0, 1.0, 1.0],
451451
background_color: [0.0, 0.0, 0.0, 1.0],
452452
style: None,
453453
decoration: Some(SugarDecoration {
454-
position: (0.0, 0.5),
455-
size: (1.0, 0.025),
456-
color: [0.5, 0.5, 0.0, 1.0],
457-
}),
454+
position: (0.0, 0.5),
455+
size: (1.0, 0.025),
456+
color: [0.5, 0.5, 0.0, 1.0],
457+
}),
458458
},
459459
];
460460

@@ -465,7 +465,7 @@ async fn run() {
465465
});
466466

467467
let underline = Some(SugarDecoration {
468-
position: (0.0, 0.95),
468+
position: (0.0, 0.92),
469469
size: (1.0, 0.05),
470470
color: [1.0, 0.4, 1.0, 1.0],
471471
});

0 commit comments

Comments
 (0)