vim-patch:8.1.1038: Arabic support excludes Farsi (#19285)

Problem:    Arabic support excludes Farsi.
Solution:   Add Farsi support to the Arabic support. (Ali Gholami Rudi,
            Ameretat Reith)
dc4fa190e7

Omit Test_shape_final_to_medial(): removed in later patches.
This commit is contained in:
zeertzjq
2022-07-10 06:01:49 +08:00
committed by GitHub
parent 782f726136
commit d6a1e71881
5 changed files with 203 additions and 908 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -3,12 +3,7 @@
#include <stdbool.h>
/// Whether c belongs to the range of Arabic characters that might be shaped.
static inline bool arabic_char(int c)
{
// return c >= a_HAMZA && c <= a_MINI_ALEF;
return c >= 0x0621 && c <= 0x0670;
}
#define ARABIC_CHAR(ch) (((ch) & 0xFF00) == 0x0600)
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "arabic.h.generated.h"

View File

@@ -3224,7 +3224,7 @@ static void draw_cmdline(int start, int len)
int u8cc[MAX_MCO];
int u8c = utfc_ptr2char_len(p, u8cc, start + len - i);
mb_l = utfc_ptr2len_len(p, start + len - i);
if (arabic_char(u8c)) {
if (ARABIC_CHAR(u8c)) {
do_arabicshape = true;
break;
}
@@ -3260,7 +3260,7 @@ static void draw_cmdline(int start, int len)
int u8cc[MAX_MCO];
int u8c = utfc_ptr2char_len(p, u8cc, start + len - i);
mb_l = utfc_ptr2len_len(p, start + len - i);
if (arabic_char(u8c)) {
if (ARABIC_CHAR(u8c)) {
int pc;
int pc1 = 0;
int nc = 0;

View File

@@ -241,7 +241,7 @@ void grid_puts_len(ScreenGrid *grid, char_u *text, int textlen, int row, int col
u8c = utfc_ptr2char(ptr, u8cc);
}
mbyte_cells = utf_char2cells(u8c);
if (p_arshape && !p_tbidi && arabic_char(u8c)) {
if (p_arshape && !p_tbidi && ARABIC_CHAR(u8c)) {
// Do Arabic shaping.
if (len >= 0 && (int)(ptr - text) + mbyte_blen >= len) {
// Past end of string to be displayed.

View File

@@ -1869,7 +1869,7 @@ static int line_putchar(buf_T *buf, LineState *s, schar_T *dest, int maxcells, b
schar_from_ascii(dest[0], *p);
s->prev_c = u8c;
} else {
if (p_arshape && !p_tbidi && arabic_char(u8c)) {
if (p_arshape && !p_tbidi && ARABIC_CHAR(u8c)) {
// Do Arabic shaping.
int pc, pc1, nc;
int pcc[MAX_MCO];
@@ -3157,7 +3157,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
}
} else if (mb_l == 0) { // at the NUL at end-of-line
mb_l = 1;
} else if (p_arshape && !p_tbidi && arabic_char(mb_c)) {
} else if (p_arshape && !p_tbidi && ARABIC_CHAR(mb_c)) {
// Do Arabic shaping.
int pc, pc1, nc;
int pcc[MAX_MCO];