editor: Fix autoscroll flickering regression (#24758)

smit created

This PR fixes autoscroll flickering issue caused by recent
[#24735](https://github.com/zed-industries/zed/pull/24735) which fixes
soft wrap scroll issues. No release notes, as this was few hours ago.

Adding vertical scrollbar width to viewport width, so that autoscroll
function don't try to that much pixels extra.

Release Notes:

- N/A

Change summary

crates/editor/src/element.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Detailed changes

crates/editor/src/element.rs 🔗

@@ -7188,7 +7188,7 @@ impl Element for EditorElement {
                         let autoscrolled = if autoscroll_horizontally {
                             editor.autoscroll_horizontally(
                                 start_row,
-                                editor_width - (letter_size.width / 2.0),
+                                editor_width - (letter_size.width / 2.0) + style.scrollbar_width,
                                 scroll_width,
                                 em_width,
                                 &line_layouts,
@@ -7279,7 +7279,7 @@ impl Element for EditorElement {
                         let autoscrolled = if autoscroll_horizontally {
                             editor.autoscroll_horizontally(
                                 start_row,
-                                editor_width - (letter_size.width / 2.0),
+                                editor_width - (letter_size.width / 2.0) + style.scrollbar_width,
                                 scroll_width,
                                 em_width,
                                 &line_layouts,