Development discussion of WireGuard
 help / color / mirror / Atom feed
* Wireguard Windows tunnel editing does not draw correctly with vertical scroll down
@ 2021-09-06 11:49 Hiroshi Shirosaki
  0 siblings, 0 replies; only message in thread
From: Hiroshi Shirosaki @ 2021-09-06 11:49 UTC (permalink / raw)
  To: wireguard


When I edit my tunnel setting that has multiple peers and input keys
with vertical scroll down,
the inputted characters are not shown correctly.
It looks like the old contents remain.

Without vertical scroll down the inputted characters are shown correctly.

It seems EM_SETCHARFORMAT and RedrawWindow don't play nicely together.

I use Wireguard-windows amd64 0.4.5.

I've found that adding window hide/show around EM_SETCHARFORMAT seems
to fix the redraw issue.
Here is a patch.

diff --git a/ui/syntax/syntaxedit.go b/ui/syntax/syntaxedit.go
index 42f6e7b7..7b88271a 100644
--- a/ui/syntax/syntaxedit.go
+++ b/ui/syntax/syntaxedit.go
@@ -247,6 +247,8 @@ func (se *SyntaxEdit) highlightText() error {
  win.SendMessage(hWnd, win.EM_SETBKGNDCOLOR, 0, uintptr(bgColor))
  numSpans := len(spans)
  foundPrivateKey := false
+ // Workaround to redraw correctly with vertical scroll down
+ win.ShowWindow(hWnd, win.SW_HIDE)
  for i := range spans {
  span := &spans[i]
  if numSpans <= 2048 {
@@ -262,6 +264,7 @@ func (se *SyntaxEdit) highlightText() error {
  foundPrivateKey = true
+ win.ShowWindow(hWnd, win.SW_SHOW)
  win.SendMessage(hWnd, win.EM_SETSCROLLPOS, 0,
  win.SendMessage(hWnd, win.EM_EXSETSEL, 0,
  win.SendMessage(hWnd, win.EM_HIDESELECTION, win.FALSE, 0)

Hiroshi Shirosaki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-06 11:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-06 11:49 Wireguard Windows tunnel editing does not draw correctly with vertical scroll down Hiroshi Shirosaki

Development discussion of WireGuard

This inbox may be cloned and mirrored by anyone:

	git clone --mirror wireguard/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 wireguard wireguard/ \
	public-inbox-index wireguard

Example config snippet for mirrors.
Newsgroup available over NNTP:

AGPL code for this site: git clone