MCPcopy Create free account
hub / github.com/angular-rust/ux-components / refresh

Method refresh

src/elements/textedit.rs:128–164  ·  view source on GitHub ↗

_from_typing: bool=true, _emit: bool=true

(&self, str: String, from_typing: bool, emit: bool)

Source from the content-addressed store, hash-verified

126 #[inline]
127 // _from_typing: bool=true, _emit: bool=true
128 fn refresh(&self, str: String, from_typing: bool, emit: bool) -> String {
129 let mut state = self.state.borrow_mut();
130 state.edit = str.clone();
131
132 match state.display_char {
133 Some(ch) => {
134 state.display = String::new();
135 for i in 0..str.len() {
136 state.display.push(ch);
137 }
138 }
139 None => {
140 let state = self.state.borrow();
141 let index = state.index as usize;
142 self.state.borrow_mut().display = format!(
143 "{}{}{}",
144 self.before(index),
145 state.composition,
146 self.after(index)
147 );
148 }
149 }
150
151 let state = self.state.borrow();
152 self.label.set_text(state.display.clone());
153 self.update_cur();
154
155 if emit {
156 self.onchange.emit(&TextEditChangeEvent {
157 text: state.edit.clone(),
158 display_text: state.display.clone(),
159 from_typing,
160 });
161 }
162
163 state.edit.clone()
164 }
165
166 pub fn index(&self) -> i32 {
167 self.state.borrow().index

Callers 5

newMethod · 0.45
set_textMethod · 0.45
set_display_charMethod · 0.45
cutMethod · 0.45
textinputMethod · 0.45

Calls 5

pushMethod · 0.80
emitMethod · 0.80
cloneMethod · 0.45
set_textMethod · 0.45
update_curMethod · 0.45

Tested by

no test coverage detected