contact-editor: remove empty space

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
pull/495/head
Manos Pitsidianakis 2 weeks ago
parent b8e841bbcd
commit 0c590bbc0c
No known key found for this signature in database
GPG Key ID: 7729C7707F7E09D0

@ -81,10 +81,12 @@ impl ContactManager {
if !self.content.resize_with_context(100, 1, context) { if !self.content.resize_with_context(100, 1, context) {
return; return;
} }
let mut area = self.content.area(); let area = self.content.area();
let (x, _) = self.content.grid_mut().write_string( if self.card.external_resource() {
"Last edited: ", self.mode = ViewMode::ReadOnly;
self.content.grid_mut().write_string(
"This contact's origin is external and cannot be edited within meli.",
self.theme_default.fg, self.theme_default.fg,
self.theme_default.bg, self.theme_default.bg,
self.theme_default.attrs, self.theme_default.attrs,
@ -92,9 +94,9 @@ impl ContactManager {
None, None,
None, None,
); );
area = area.skip_cols(x); } else {
let (x, y) = self.content.grid_mut().write_string( let (x, _) = self.content.grid_mut().write_string(
&self.card.last_edited(), "Last edited: ",
self.theme_default.fg, self.theme_default.fg,
self.theme_default.bg, self.theme_default.bg,
self.theme_default.attrs, self.theme_default.attrs,
@ -102,16 +104,12 @@ impl ContactManager {
None, None,
None, None,
); );
area = area.skip(x, y);
if self.card.external_resource() {
self.mode = ViewMode::ReadOnly;
self.content.grid_mut().write_string( self.content.grid_mut().write_string(
"This contact's origin is external and cannot be edited within meli.", &self.card.last_edited(),
self.theme_default.fg, self.theme_default.fg,
self.theme_default.bg, self.theme_default.bg,
self.theme_default.attrs, self.theme_default.attrs,
area, area.skip_cols(x),
None, None,
None, None,
); );
@ -166,15 +164,12 @@ impl Component for ContactManager {
if self.is_dirty() { if self.is_dirty() {
grid.clear_area(area, self.theme_default); grid.clear_area(area, self.theme_default);
grid.copy_area(self.content.grid(), area.skip_rows(2), self.content.area()); grid.copy_area(self.content.grid(), area, self.content.area());
self.dirty = false; self.dirty = false;
} }
self.form.draw( self.form
grid, .draw(grid, area.skip_rows(self.content.area().height()), context);
area.skip_rows(2 + self.content.area().height()),
context,
);
if let ViewMode::Discard(ref mut selector) = self.mode { if let ViewMode::Discard(ref mut selector) = self.mode {
/* Let user choose whether to quit with/without saving or cancel */ /* Let user choose whether to quit with/without saving or cancel */
selector.draw(grid, area, context); selector.draw(grid, area, context);

Loading…
Cancel
Save