Skip to content

Commit a0b9704

Browse files
committed
UpdateVersion to 0.3.0
修改: Cargo.toml 修改: UpdateLog.md 修改: src/lib.rs
1 parent 3fbb7b8 commit a0b9704

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "term_lattice"
3-
version = "0.2.0"
3+
version = "0.3.0"
44
edition = "2021"
55

66
license = "MIT"

UpdateLog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ Modified failed but reasonable assertions
77

88
# v0.2.0
99
Modified some display sections, added some practical methods, and adjusted the visibility of some fields.
10+
11+
# v0.3.0
12+
Revised the visibility of some fields again and added some methods

src/lib.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::{
55
},
66
cell::{
77
RefCell,
8-
RefMut,
8+
RefMut, Ref,
99
},
1010
};
1111
use enum_variant_eq::{
@@ -470,12 +470,12 @@ mod color_test {
470470
/// ```
471471
#[derive(Clone, Debug)]
472472
pub struct ScreenBuffer {
473-
pub colors: RefCell<Vec<Color>>,
473+
colors: RefCell<Vec<Color>>,
474474
/// Colors present in the output area
475-
pub background_colors: RefCell<Vec<Color>>,
475+
background_colors: RefCell<Vec<Color>>,
476476
/// The value of this field should be the color of the last change.
477477
/// Subscript 0 is the background color, and subscript 1 is the foreground color
478-
pub prev_color: RefCell<[Color; 2]>,
478+
prev_color: RefCell<[Color; 2]>,
479479
size: Position,
480480
/// config
481481
pub cfg: Config,
@@ -592,6 +592,14 @@ impl ScreenBuffer {
592592
pub fn init_prev_color(&self) {
593593
*self.prev_color.borrow_mut() = [Color::None; 2];
594594
}
595+
/// get prev_color ref
596+
pub fn get_prev_color(&self) -> Ref<[Color; 2]> {
597+
self.prev_color.borrow()
598+
}
599+
/// get prev_color mut ref
600+
pub fn get_prev_color_mut(&self) -> RefMut<[Color; 2]> {
601+
self.prev_color.borrow_mut()
602+
}
595603
/// 两颜色在此缓冲区是否判定为相似
596604
fn color_similarity(&self, color1: &Color, color2: &Color) -> bool {
597605
color1.chromatic_aberration(color2) < self.cfg.chromatic_aberration

0 commit comments

Comments
 (0)