mirror of
https://github.com/neovim/neovim.git
synced 2025-10-09 19:36:40 +00:00
refactor(grid): make screen rendering more multibyte than ever before
Problem: buffer text with composing chars are converted from UTF-8 to an array of up to seven UTF-32 values and then converted back to UTF-8 strings. Solution: Convert buffer text directly to UTF-8 based schar_T values. The limit of the text size is now in schar_T bytes, which is currently 31+1 but easily could be raised as it no longer multiplies the size of the entire screen grid when not used, the full size is only required for temporary scratch buffers. Also does some general cleanup to win_line text handling, which was unnecessarily complicated due to multibyte rendering being an "opt-in" feature long ago. Nowadays, a char is just a char, regardless if it consists of one ASCII byte or multiple bytes.
This commit is contained in:
@@ -7,8 +7,8 @@
|
||||
#include "nvim/pos.h"
|
||||
#include "nvim/types.h"
|
||||
|
||||
#define MAX_MCO 6 // fixed value for 'maxcombine'
|
||||
// Includes final NUL. at least 4*(MAX_MCO+1)+1
|
||||
// Includes final NUL. MAX_MCO is no longer used, but at least 4*(MAX_MCO+1)+1=29
|
||||
// ensures we can fit all composed chars which did fit before.
|
||||
#define MAX_SCHAR_SIZE 32
|
||||
|
||||
// if data[0] is 0xFF, then data[1..4] is a 24-bit index (in machine endianness)
|
||||
@@ -35,7 +35,7 @@ enum {
|
||||
/// we can avoid sending bigger updates than necessary to the Ul layer.
|
||||
///
|
||||
/// Screen cells are stored as NUL-terminated UTF-8 strings, and a cell can
|
||||
/// contain up to MAX_MCO composing characters after the base character.
|
||||
/// contain composing characters as many as fits in MAX_SCHAR_SIZE-1 bytes
|
||||
/// The composing characters are to be drawn on top of the original character.
|
||||
/// The content after the NUL is not defined (so comparison must be done a
|
||||
/// single cell at a time). Double-width characters are stored in the left cell,
|
||||
|
Reference in New Issue
Block a user