func DrawFrame(x, y, w, h int, border BorderStyle) {
	var chars string
	if border == BorderThick {
		chars = SysObject(ObjDoubleBorder)
	} else if border == BorderThin {
		chars = SysObject(ObjSingleBorder)
	} else if border == BorderNone {
		chars = "      "
	} else {
		chars = "      "
	}

	parts := []rune(chars)
	H, V, UL, UR, DL, DR := parts[0], parts[1], parts[2], parts[3], parts[4], parts[5]

	if InClipRect(x, y) {
		putCharUnsafe(x, y, UL)
	}
	if InClipRect(x+w-1, y+h-1) {
		putCharUnsafe(x+w-1, y+h-1, DR)
	}
	if InClipRect(x, y+h-1) {
		putCharUnsafe(x, y+h-1, DL)
	}
	if InClipRect(x+w-1, y) {
		putCharUnsafe(x+w-1, y, UR)
	}

	var xx, yy, ww, hh int
	xx, yy, ww, _ = clip(x+1, y, w-2, 1)
	if ww > 0 {
		DrawHorizontalLine(xx, yy, ww, H)
	}
	xx, yy, ww, _ = clip(x+1, y+h-1, w-2, 1)
	if ww > 0 {
		DrawHorizontalLine(xx, yy, ww, H)
	}
	xx, yy, _, hh = clip(x, y+1, 1, h-2)
	if hh > 0 {
		DrawVerticalLine(xx, yy, hh, V)
	}
	xx, yy, _, hh = clip(x+w-1, y+1, 1, h-2)
	if hh > 0 {
		DrawVerticalLine(xx, yy, hh, V)
	}
}
func DrawFrame(x, y, w, h int, border BorderStyle) {
	var chars string
	if border == BorderThick {
		chars = SysObject(ObjDoubleBorder)
	} else if border == BorderThin {
		chars = SysObject(ObjSingleBorder)
	} else if border == BorderNone {
		chars = "      "
	} else {
		chars = "      "
	}

	parts := []rune(chars)
	H, V, UL, UR, DL, DR := parts[0], parts[1], parts[2], parts[3], parts[4], parts[5]

	if InClipRect(x, y) {
		putCharUnsafe(x, y, UL)
	}
	if InClipRect(x+w-1, y+h-1) {
		putCharUnsafe(x+w-1, y+h-1, DR)
	}
	if InClipRect(x, y+h-1) {
		putCharUnsafe(x, y+h-1, DL)
	}
	if InClipRect(x+w-1, y) {
		putCharUnsafe(x+w-1, y, UR)
	}

	var xx, yy, ww, hh int
	xx, yy, ww, _ = clip(x+1, y, w-2, 1)
	if ww > 0 {
		DrawHorizontalLine(xx, yy, ww, H)
	}
	xx, yy, ww, _ = clip(x+1, y+h-1, w-2, 1)
	if ww > 0 {
		DrawHorizontalLine(xx, yy, ww, H)
	}
	xx, yy, _, hh = clip(x, y+1, 1, h-2)
	if hh > 0 {
		DrawVerticalLine(xx, yy, hh, V)
	}
	xx, yy, _, hh = clip(x+w-1, y+1, 1, h-2)
	if hh > 0 {
		DrawVerticalLine(xx, yy, hh, V)
	}
}
// DrawFrame paints the frame without changing area inside it