[vim/vim] Gvim: ligatures are reshaped when cursor moves across constituent characters (Issue #20916)

6 views
Skip to first unread message

ubaldot

unread,
Aug 1, 2026, 5:31:28 PM (yesterday) Aug 1
to vim/vim, Subscribed
ubaldot created an issue (vim/vim#20916)

Steps to reproduce

  1. Install Fira Code or any other font that support ligatures. Start gVim with:
  • set encoding=utf-8
  • set renderoptions=type:directx
  • set guifont=Fira_Code:h12
  1. Insert text containing a ligature sequence, for example:

<=

  1. Move the cursor repeatedly across the two characters.

The symbol change shape:

image.png (view on web)

Expected behaviour

The cursor keeps consistently its correct shape:

image.png (view on web)

Note that Vim run in Windows Terminal don't have this problem.

Version of Vim

9.2 with patch 1-45

Environment

Windows 11

Logs and stack traces


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/20916@github.com>

ubaldot

unread,
3:37 AM (17 hours ago) 3:37 AM
to vim/vim, Subscribed
ubaldot left a comment (vim/vim#20916)

I have to reopen because the issue is still there despite I upgraded to patch 0.894.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/20916/5156253850@github.com>

Mao-Yining

unread,
10:10 AM (10 hours ago) 10:10 AM
to vim/vim, Subscribed
mao-yining left a comment (vim/vim#20916)

@chrisbra The problem is still there in-spite I upgraded to patch 0.894. Shall we re-open #12901 or shall I keep open this one?

That is for GTK.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/20916/5158426630@github.com>

Foxe Chen

unread,
10:49 AM (10 hours ago) 10:49 AM
to vim/vim, Subscribed
64-bitman left a comment (vim/vim#20916)

Does this patch fix your issue?

diff --git a/src/gui.c b/src/gui.c
index 5d6eae105..e2b3b4021 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -1412,9 +1412,6 @@ gui_update_cursor(
 	    }
 	    break;
 	}
-    // gui_redraw_block() may invalidate the cursor, make sure to validate
-    // it again.
-    gui.cursor_is_valid = true;
 
 # ifndef USE_GTK4
     if ((lig_left || lig_right) && shape->shape != SHAPE_BLOCK)
@@ -1430,6 +1427,9 @@ gui_update_cursor(
 	gui.col = old;
     }
 # endif
+    // gui_redraw_block()/gui_screenchar() may invalidate the cursor, make sure
+    // to validate it again.
+    gui.cursor_is_valid = true;
 #endif
 
     old_hl_mask = gui.highlight_mask;


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/20916/5158643690@github.com>

Mao-Yining

unread,
11:16 AM (9 hours ago) 11:16 AM
to vim/vim, Subscribed
mao-yining left a comment (vim/vim#20916)

@64-bitman

Does this patch fix your issue?

Note that, this is happened on Windows.

Before:
https://github.com/user-attachments/assets/08f4fd6b-1e6f-4972-b2d7-0dc4ad564c35

After:
https://github.com/user-attachments/assets/e805db43-c0f1-4a05-a56d-9795814b8122

My Expect Behaviour (this is Windows Terminal):
https://github.com/user-attachments/assets/a6f7de15-786c-492b-a33e-6ff8a924ed84


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/20916/5158798575@github.com>

ubaldot

unread,
12:57 PM (7 hours ago) 12:57 PM
to vim/vim, Subscribed
ubaldot left a comment (vim/vim#20916)

Does this patch fix your issue?

diff --git a/src/gui.c b/src/gui.c


index 5d6eae105..e2b3b4021 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -1412,9 +1412,6 @@ gui_update_cursor(
}
break;
}

  • // gui_redraw_block() may invalidate the cursor, make sure to validate
  • // it again.
  • gui.cursor_is_valid = true;

ifndef USE_GTK4

 if ((lig_left || lig_right) && shape->shape != SHAPE_BLOCK)

@@ -1430,6 +1427,9 @@ gui_update_cursor(
gui.col = old;
}

endif

    • // gui_redraw_block()/gui_screenchar() may invalidate the cursor, make sure

    • // to validate it again.

    • gui.cursor_is_valid = true;
      #endif

      old_hl_mask = gui.highlight_mask;

    Unfortunately, I cannot build on Windows, but it seems that @mao-yining give it a shot.


    Reply to this email directly, view it on GitHub, or unsubscribe.
    Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

    You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/20916/5159389985@github.com>

    Foxe Chen

    unread,
    4:25 PM (4 hours ago) 4:25 PM
    to vim/vim, Subscribed
    64-bitman left a comment (vim/vim#20916)

    I believe you need to add the characters that make ligatures in guiligatures (e.g. set guiligatures=>=). It seems that GVim on Windows if using DirectX to render always renders ligatures, even if the ligature character is not specified in guiligatures


    Reply to this email directly, view it on GitHub, or unsubscribe.
    Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

    You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/20916/5160182949@github.com>

    Foxe Chen

    unread,
    4:29 PM (4 hours ago) 4:29 PM
    to vim/vim, Subscribed
    64-bitman left a comment (vim/vim#20916)

    @mao-yining In your expected behaviour video, I don't think that would be possible (e.g. the ligature staying intact as cursor moves over it). This is because the cursor is rendered as a "cell" just like other text with a background. Currently text with different backgrounds are rendered separately, meaning ligatures cannot connect over background boundaries. It could be possible, but I'm not sure how complicated that would be.


    Reply to this email directly, view it on GitHub, or unsubscribe.
    Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

    You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/20916/5160198758@github.com>

    Mao-Yining

    unread,
    8:09 PM (15 minutes ago) 8:09 PM
    to vim/vim, Subscribed
    mao-yining left a comment (vim/vim#20916)

    I believe you need to add the characters that make ligatures in guiligatures (e.g. set guiligatures=>=). It seems that GVim on Windows if using DirectX to render always renders ligatures, even if the ligature character is not specified in guiligatures

    Ah. Thanks. After set that option. It works well while moving. What's more your patch fix another problem which I just find.

    set guiligatures=!\"#$%&()*+-./:<=>?@[]^_{\|~
    set guifontwide=:h12
    

    Before (ghost cursor of insert mode):
    https://github.com/user-attachments/assets/456f354e-ad3c-4bfd-9f35-a0615e0ac072

    After:
    https://github.com/user-attachments/assets/d7c0734c-fdb3-42a1-b124-64d26f3e1028

    @64-bitman Could you make a PR for that?


    Reply to this email directly, view it on GitHub, or unsubscribe.
    Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

    You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/20916/5161006269@github.com>

    Foxe Chen

    unread,
    8:16 PM (8 minutes ago) 8:16 PM
    to vim/vim, Subscribed
    64-bitman left a comment (vim/vim#20916)

    Maybe it would be fine if gVim can automatically set that while reading fonts? Or also don't show ligatures on Windows which like the behaviour you said on GTK.

    What do you mean?


    Reply to this email directly, view it on GitHub, or unsubscribe.
    Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

    You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/20916/5161045548@github.com>

    Mao-Yining

    unread,
    8:19 PM (5 minutes ago) 8:19 PM
    to vim/vim, Subscribed
    mao-yining left a comment (vim/vim#20916)

    Maybe it would be fine if gVim can automatically set that while reading fonts? Or also don't show ligatures on Windows which like the behaviour you said on GTK.

    What do you mean?

    The current behavior is strange: ligatures are displayed by default, but cursor movement does not support ligatures by default. What I mean is, if it's convenient to implement, we can unify the GUI behavior across all platforms.


    Reply to this email directly, view it on GitHub, or unsubscribe.
    Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

    You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/20916/5161061356@github.com>

    Reply all
    Reply to author
    Forward
    0 new messages