diff --git a/Terminal.Gui/Core/View.cs b/Terminal.Gui/Core/View.cs index 8034047af..96f58b217 100644 --- a/Terminal.Gui/Core/View.cs +++ b/Terminal.Gui/Core/View.cs @@ -1575,8 +1575,18 @@ namespace Terminal.Gui { var driverClip = Driver == null ? Rect.Empty : Driver.Clip; containerBounds.X = Math.Max (containerBounds.X, driverClip.X); containerBounds.Y = Math.Max (containerBounds.Y, driverClip.Y); - containerBounds.Width = Math.Min (containerBounds.Width, driverClip.Width); - containerBounds.Height = Math.Min (containerBounds.Height, driverClip.Height); + var lenOffset = (driverClip.X + driverClip.Width) - (containerBounds.X + containerBounds.Width); + if (containerBounds.X + containerBounds.Width > driverClip.X + driverClip.Width) { + containerBounds.Width = Math.Max (containerBounds.Width + lenOffset, 0); + } else { + containerBounds.Width = Math.Min (containerBounds.Width, driverClip.Width); + } + lenOffset = (driverClip.Y + driverClip.Height) - (containerBounds.Y + containerBounds.Height); + if (containerBounds.Y + containerBounds.Height > driverClip.Y + driverClip.Height) { + containerBounds.Height = Math.Max (containerBounds.Height + lenOffset, 0); + } else { + containerBounds.Height = Math.Min (containerBounds.Height, driverClip.Height); + } return containerBounds; } diff --git a/Terminal.Gui/Views/ScrollView.cs b/Terminal.Gui/Views/ScrollView.cs index 12aab7cc0..23bfedbce 100644 --- a/Terminal.Gui/Views/ScrollView.cs +++ b/Terminal.Gui/Views/ScrollView.cs @@ -329,11 +329,10 @@ namespace Terminal.Gui { //Clear (); var savedClip = ClipToBounds (); - var rect = new Rect (new Point (-contentView.Frame.X, -contentView.Frame.Y), + OnDrawContent (new Rect (ContentOffset, new Size (Math.Max (Bounds.Width - (ShowVerticalScrollIndicator ? 1 : 0), 0), - Math.Max (Bounds.Height - (ShowHorizontalScrollIndicator ? 1 : 0), 0))); - OnDrawContent (rect); - contentView.Redraw (rect); + Math.Max (Bounds.Height - (ShowHorizontalScrollIndicator ? 1 : 0), 0)))); + contentView.Redraw (contentView.Frame); Driver.Clip = savedClip; if (autoHideScrollBars) { @@ -509,7 +508,7 @@ namespace Terminal.Gui { { if (me.Flags != MouseFlags.WheeledDown && me.Flags != MouseFlags.WheeledUp && me.Flags != MouseFlags.WheeledRight && me.Flags != MouseFlags.WheeledLeft && - // me.Flags != MouseFlags.Button1Pressed && me.Flags != MouseFlags.Button1Clicked && +// me.Flags != MouseFlags.Button1Pressed && me.Flags != MouseFlags.Button1Clicked && !me.Flags.HasFlag (MouseFlags.Button1Pressed | MouseFlags.ReportMousePosition)) { return false; }