Mercurial > vim
view src/libvterm/src/utf8.h @ 28150:0fa25a1b8451 v8.2.4599
patch 8.2.4599: GTK: get assertion errors when scrolling a split window
Commit: https://github.com/vim/vim/commit/a4df834a92535cf124afd1c3b711b4a7109e3534
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Mar 20 15:43:01 2022 +0000
patch 8.2.4599: GTK: get assertion errors when scrolling a split window
Problem: GTK: get assertion errors when scrolling a split window.
Solution: Use GDK_IS_DRAWABLE() on the scrollbar window. (closes https://github.com/vim/vim/issues/9982)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 20 Mar 2022 16:45:03 +0100 |
parents | a4652d7ec99f |
children |
line wrap: on
line source
/* The following functions copied and adapted from libtermkey * * http://www.leonerd.org.uk/code/libtermkey/ */ unsigned int utf8_seqlen(long codepoint); #if defined(DEFINE_INLINES) || USE_INLINE INLINE unsigned int utf8_seqlen(long codepoint) { if(codepoint < 0x0000080) return 1; if(codepoint < 0x0000800) return 2; if(codepoint < 0x0010000) return 3; if(codepoint < 0x0200000) return 4; if(codepoint < 0x4000000) return 5; return 6; } #endif /* Does NOT NUL-terminate the buffer */ int fill_utf8(long codepoint, char *str); #if defined(DEFINE_INLINES) || USE_INLINE INLINE int fill_utf8(long codepoint, char *str) { int nbytes = utf8_seqlen(codepoint); // This is easier done backwards int b = nbytes; while(b > 1) { b--; str[b] = 0x80 | (codepoint & 0x3f); codepoint >>= 6; } switch(nbytes) { case 1: str[0] = (codepoint & 0x7f); break; case 2: str[0] = 0xc0 | (codepoint & 0x1f); break; case 3: str[0] = 0xe0 | (codepoint & 0x0f); break; case 4: str[0] = 0xf0 | (codepoint & 0x07); break; case 5: str[0] = 0xf8 | (codepoint & 0x03); break; case 6: str[0] = 0xfc | (codepoint & 0x01); break; } return nbytes; } #endif /* end copy */