MCPcopy Create free account
hub / github.com/LibertyOS-Development/kernel / handle_down

Method handle_down

src/sys/prompt.rs:311–339  ·  view source on GitHub ↗

Handle down key

(&mut self)

Source from the content-addressed store, hash-verified

309
310 // Handle down key
311 fn handle_down(&mut self)
312 {
313 self.compupdate();
314 let n = self.hist.items.len();
315 if n == 0
316 {
317 return;
318 }
319
320 let (bs, i) = match self.hist.pos
321 {
322 Some(i) => (self.hist.items[i].chars().count(), i + 1),
323 None => return,
324 };
325
326 let (pos, ln) = if i < n
327 {
328 (Some(i), self.hist.items[i].clone())
329 }
330 else
331 {
332 (None, self.ln.iter().collect())
333 };
334
335 let erase = '\x08'.to_string().repeat(bs);
336 print!("{}{}", erase, ln);
337 self.cur = self.offset + ln.chars().count();
338 self.hist.pos = pos;
339 }
340
341
342 // Handle forward key

Callers 1

csi_dispatchMethod · 0.80

Calls 2

compupdateMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected