MCPcopy Create free account
hub / github.com/bajrangCoder/setu / set_from_string

Method set_from_string

src/components/form_data_editor.rs:125–164  ·  view source on GitHub ↗
(&mut self, content: &str, window: &mut Window, cx: &mut Context<Self>)

Source from the content-addressed store, hash-verified

123 }
124
125 pub fn toggle_bulk_mode(&mut self, window: &mut Window, cx: &mut Context<Self>) {
126 if self.bulk_mode {
127 let text = self
128 .bulk_editor
129 .as_ref()
130 .map(|editor| editor.read(cx).text().to_string())
131 .unwrap_or_default();
132 self.replace_from_bulk_entries(parse_bulk_kv(&text), window, cx);
133 self.bulk_mode = false;
134 } else {
135 let text = serialize_bulk_kv(&self.rows_as_bulk_entries(cx));
136 self.ensure_bulk_editor(window, cx);
137 if let Some(ref editor) = self.bulk_editor {
138 editor.update(cx, |state, cx| {
139 state.set_value(text, window, cx);
140 });
141 }
142 self.bulk_mode = true;
143 }
144 cx.notify();
145 }
146
147 pub fn add_row(&mut self, window: &mut Window, cx: &mut Context<Self>) {
148 let completion_engine = self.completion_engine.clone();
149 let key_input = cx.new(|cx| {
150 configure_completion(
151 InputState::new(window, cx).placeholder("Key"),
152 completion_engine.as_ref(),
153 CompletionContext::FormName,
154 )
155 });
156 let completion_engine = self.completion_engine.clone();
157 let value_input = cx.new(|cx| {
158 configure_completion(
159 InputState::new(window, cx).placeholder("Value"),
160 completion_engine.as_ref(),
161 CompletionContext::FormValue,
162 )
163 });
164
165 self.rows.push(FormDataRow {
166 key_input,
167 value_input,

Callers

nothing calls this directly

Calls 3

clearMethod · 0.45
is_emptyMethod · 0.45
newMethod · 0.45

Tested by

no test coverage detected