Skip to content

Commit ad06985

Browse files
committed
move writing the newline to a later spot
1 parent 86b4f09 commit ad06985

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/pam/rpassword.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@ fn prompt_password(
161161
}
162162
}
163163

164+
// If there was a prompt, write a new line to move the cursor to the start
165+
if !prompt.is_empty() {
166+
let _ = write_unbuffered(sink, b"\n");
167+
}
168+
164169
return res;
165170
}
166171
}
@@ -222,7 +227,6 @@ fn read_unbuffered(
222227
impl Drop for Bullets<'_> {
223228
fn drop(&mut self) {
224229
self.clear();
225-
let _ = self.sink.write(b"\n");
226230
}
227231
}
228232

0 commit comments

Comments
 (0)