Repository: atuinsh/atuin (language: rust)

Issue:
preview is missing a few characters
While implementing my [idea](https://forum.atuin.sh/t/show-preview-only-if-command-longer-than-terminal-width/212?u=tessus) and testing my code change, I found out that there is actually a display issue with the preview text.

This has nothing to do with my code change and I have reproduced it on git main (commit 593dc410eb3d5d7d409b780b9c7bd22ee4aa8654).

I used the following fairly long command (you can use whatever is longer than your terminal width):

```
echo "this is a very long command. I have to come to a width longer than 200 characters. I hate typing all that much. But what can you do when you have to test stuff and see if everything works as expected. kc tessarek."
```

As you can see a few characters around the borders are missing:

<img width="715" alt="image" src="https://github.com/atuinsh/atuin/assets/223439/43b49254-9b3f-45fc-a819-aec0817e9bb5">

I haven't had a chance to debug the issue any further. I might be able to look into it on the weekend, but maybe a ratatui expert can figure this out in a few seconds.



Discussion / hints:
Does it still occur with 

```
style = compact
```

Compact style drops the borders
Nope. In compact mode no characters are missing.

<img width="996" alt="image" src="https://github.com/atuinsh/atuin/assets/223439/c4ef9f6d-5090-4962-b1cb-a707125f49a7">

However, I think this is an issue with ratatui. I can't believe that one has to specify the padding manually depending on whether a border is used in the widget or not.

I could try adding a paddig to the preview paragraph, but IMO that should be handled automatically.

Maybe someone with expert insight into rartatui can help out. @orhun any chance you could have a look at this?

Fix patch:
diff --git a/atuin/src/command/client/search/interactive.rs b/atuin/src/command/client/search/interactive.rs
index 514b42b5348..6c306aa9aa0 100644
--- a/atuin/src/command/client/search/interactive.rs
+++ b/atuin/src/command/client/search/interactive.rs
@@ -639,6 +639,11 @@ impl State {
         let input = self.build_input(style);
         f.render_widget(input, input_chunk);
 
+        let preview_width = if compact {
+            preview_width
+        } else {
+            preview_width - 2
+        };
         let preview =
             self.build_preview(results, compact, preview_width, preview_chunk.width.into());
         f.render_widget(preview, preview_chunk);


Test patch: