diff options
author | Blaž Hrastnik | 2021-05-09 09:13:50 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-05-09 09:13:50 +0000 |
commit | ff4c1d05deee2b4b4d85c29a627fb01e60886c7f (patch) | |
tree | fb99b0abf84a43ff2280481739a17f5052698ac7 /helix-term | |
parent | 1255bcb8a311c7f382f0bf66bbe791c6dfd77b30 (diff) |
Replace the Clear widget with buffer.clear/clear_with.
Diffstat (limited to 'helix-term')
-rw-r--r-- | helix-term/src/ui/completion.rs | 9 | ||||
-rw-r--r-- | helix-term/src/ui/picker.rs | 9 | ||||
-rw-r--r-- | helix-term/src/ui/popup.rs | 9 | ||||
-rw-r--r-- | helix-term/src/ui/prompt.rs | 16 |
4 files changed, 5 insertions, 38 deletions
diff --git a/helix-term/src/ui/completion.rs b/helix-term/src/ui/completion.rs index 3f60dad4..238569f0 100644 --- a/helix-term/src/ui/completion.rs +++ b/helix-term/src/ui/completion.rs @@ -202,14 +202,7 @@ impl Component for Completion { // clear area let background = cx.editor.theme.get("ui.popup"); - for y in area.top()..area.bottom() { - for x in area.left()..area.right() { - let cell = surface.get_mut(x, y); - cell.reset(); - // cell.symbol.clear(); - cell.set_style(background); - } - } + surface.clear_with(area, background); doc.render(area, surface, cx); } None => (), diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index 6d77bf1d..55975240 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -205,14 +205,7 @@ impl<T: 'static> Component for Picker<T> { // clear area let background = cx.editor.theme.get("ui.background"); - for y in area.top()..area.bottom() { - for x in area.left()..area.right() { - let cell = surface.get_mut(x, y); - cell.reset(); - // cell.symbol.clear(); - cell.set_style(background); - } - } + surface.clear_with(area, background); use tui::widgets::Widget; // don't like this but the lifetime sucks diff --git a/helix-term/src/ui/popup.rs b/helix-term/src/ui/popup.rs index 7ce7166c..c59287e2 100644 --- a/helix-term/src/ui/popup.rs +++ b/helix-term/src/ui/popup.rs @@ -148,14 +148,7 @@ impl<T: Component> Component for Popup<T> { // clear area let background = cx.editor.theme.get("ui.popup"); - for y in area.top()..area.bottom() { - for x in area.left()..area.right() { - let cell = surface.get_mut(x, y); - cell.reset(); - // cell.symbol.clear(); - cell.set_style(background); - } - } + surface.clear_with(area, background); self.contents.render(area, surface, cx); } diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs index b09b8e14..9bde1f57 100644 --- a/helix-term/src/ui/prompt.rs +++ b/helix-term/src/ui/prompt.rs @@ -126,13 +126,7 @@ impl Prompt { let area = completion_area; let background = theme.get("ui.statusline"); - for y in area.top()..area.bottom() { - for x in area.left()..area.right() { - let cell = surface.get_mut(x, y); - cell.reset(); - cell.set_style(background); - } - } + surface.clear_with(area, background); let mut row = 0; let mut col = 0; @@ -172,13 +166,7 @@ impl Prompt { ); let background = theme.get("ui.window"); - for y in area.top()..area.bottom() { - for x in area.left()..area.right() { - let cell = surface.get_mut(x, y); - cell.reset(); - cell.set_style(background); - } - } + surface.clear_with(area, background); use tui::layout::Margin; text.render( |