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

Method refresh

src/elements/text_field.rs:129–165  ·  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

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