@@ -236,10 +236,6 @@ func (w *Window) grabScreen() *gui.QPixmap {
236
236
fullRect .Y ()+ (w .viewportMargins [0 ]* font .lineHeight ),
237
237
fullRect .Width ()- w .viewportMargins [2 ]* int (font .cellwidth )- w .viewportMargins [3 ]* int (font .cellwidth ),
238
238
fullRect .Height ()- (w .viewportMargins [0 ]* font .lineHeight )- (w .viewportMargins [1 ]* font .lineHeight ),
239
- // fullRect.X(),
240
- // fullRect.Y(),
241
- // fullRect.Width(),
242
- // fullRect.Height(),
243
239
)
244
240
return w .Grab (rect )
245
241
}
@@ -293,9 +289,6 @@ func (w *Window) paint(event *gui.QPaintEvent) {
293
289
rows ++
294
290
}
295
291
296
- // Draw scroll snapshot
297
- w .drawScrollSnapshot (p )
298
-
299
292
var verScrollPixels int
300
293
if w .lastScrollphase != core .Qt__NoScrollPhase {
301
294
verScrollPixels = w .scrollPixels2
@@ -304,24 +297,42 @@ func (w *Window) paint(event *gui.QPaintEvent) {
304
297
verScrollPixels += w .scrollPixels [1 ]
305
298
}
306
299
300
+ // -------------
307
301
// Draw contents
302
+ // -------------
303
+
308
304
if w .isFloatWin && ! w .isMsgGrid {
309
305
w .drawUndrawnAreas (p )
310
306
}
311
- // for y := row + rows; y >= row; y-- {
312
- // w.drawBackground(p, y, col, cols)
313
- // w.drawForeground(p, y, col, cols)
314
- // }
315
- if verScrollPixels <= 0 {
316
- for y := row + rows ; y >= row ; y -- {
317
- w .drawBackground (p , y , col , cols )
318
- w .drawForeground (p , y , col , cols )
307
+ // Draw content within viewportMargin in the y-axis direction
308
+ for y := row + rows ; y >= row ; y -- {
309
+ if y < w .viewportMargins [0 ] {
310
+ continue
319
311
}
320
- } else {
321
- for y := row ; y <= row + rows ; y ++ {
322
- w .drawBackground (p , y , col , cols )
323
- w .drawForeground (p , y , col , cols )
312
+ if y > w .rows - w .viewportMargins [1 ] {
313
+ continue
314
+ }
315
+ w .drawBackground (p , y , col , cols )
316
+ w .drawForeground (p , y , col , cols )
317
+ }
318
+
319
+ // Draw scroll snapshot
320
+ w .drawScrollSnapshot (p )
321
+
322
+ // Draw content outside the viewportMargin in the y-axis direction
323
+ for y := row + rows ; y >= row ; y -- {
324
+ if y <= w .viewportMargins [0 ] {
325
+ continue
326
+ }
327
+ w .drawBackground (p , y , col , cols )
328
+ w .drawForeground (p , y , col , cols )
329
+ }
330
+ for y := row + rows ; y >= row ; y -- {
331
+ if y >= w .rows - w .viewportMargins [1 ] {
332
+ continue
324
333
}
334
+ w .drawBackground (p , y , col , cols )
335
+ w .drawForeground (p , y , col , cols )
325
336
}
326
337
327
338
// TODO: We should use msgSepChar to separate message window area
@@ -3516,7 +3527,7 @@ func (w *Window) focusGrid() {
3516
3527
}
3517
3528
3518
3529
// convertWindowsToUnixPath converts a Windows path to a Unix path as wslpath does.
3519
- func convertWindowsToUnixPath (winPath string ) string {
3530
+ func convertWindowsToUnixPath (winPath string ) string {
3520
3531
unixPath := strings .ReplaceAll (winPath , `\` , `/` )
3521
3532
if len (unixPath ) <= 2 {
3522
3533
return unixPath
0 commit comments