Tk Source Code

Artifact [052233b3]
Login

Artifact 052233b3b87608dd2eaec7e0905f90f04fd0a62c05859dfb7dcac75d28826d21:

Attachment "selclip.diff" to ticket [0fb337ea] added by emiliano 2024-05-28 21:53:50.
Index: generic/ttk/ttkEntry.c
==================================================================
--- generic/ttk/ttkEntry.c
+++ generic/ttk/ttkEntry.c
@@ -1255,13 +1255,19 @@
 	int borderWidth = 0;
 
 	Tk_GetPixelsFromObj(NULL, tkwin, es.selBorderWidthObj, &borderWidth);
 
 	if (selBorder) {
+	    int selWidth;
+	    int textareaEnd = textarea.x + textarea.width;
+	    if (selEndX > textareaEnd)
+		selEndX = textareaEnd;
+	    selWidth = selEndX - selStartX + 2*borderWidth;
+	    if (selWidth > 0)
 	    Tk_Fill3DRectangle(tkwin, d, selBorder,
 		selStartX - borderWidth, entryPtr->entry.layoutY - borderWidth,
-		selEndX - selStartX + 2*borderWidth,
+		selWidth,
 		entryPtr->entry.layoutHeight + 2*borderWidth,
 		borderWidth, TK_RELIEF_RAISED);
 	}
     }