From 3e2c0fef3b0bf6bff2ab8c8853a4f0bb8c1d53f1 Mon Sep 17 00:00:00 2001 From: Yash Thakur <45539777+ysthakur@users.noreply.github.com> Date: Thu, 11 Jan 2024 10:29:07 -0500 Subject: [PATCH] Print after cursor until newline (#700) --- src/painting/painter.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/painting/painter.rs b/src/painting/painter.rs index f4fb4262..1c6769be 100644 --- a/src/painting/painter.rs +++ b/src/painting/painter.rs @@ -389,6 +389,12 @@ impl Painter { if let Some(menu) = menu { // TODO: Also solve the difficult problem of displaying (parts of) // the content after the cursor with the completion menu + // This only shows the rest of the line the cursor is on + if let Some(newline) = lines.after_cursor.find('\n') { + self.stdout.queue(Print(&lines.after_cursor[0..newline]))?; + } else { + self.stdout.queue(Print(&lines.after_cursor))?; + } self.print_menu(menu, lines, use_ansi_coloring)?; } else { // Selecting lines for the hint