mirror of
https://github.com/neovim/neovim.git
synced 2025-11-14 22:39:08 +00:00
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:
1094
src/nvim/arabic.c
1094
src/nvim/arabic.c
File diff suppressed because it is too large
Load Diff
@@ -3,12 +3,7 @@
|
|||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
/// Whether c belongs to the range of Arabic characters that might be shaped.
|
#define ARABIC_CHAR(ch) (((ch) & 0xFF00) == 0x0600)
|
||||||
static inline bool arabic_char(int c)
|
|
||||||
{
|
|
||||||
// return c >= a_HAMZA && c <= a_MINI_ALEF;
|
|
||||||
return c >= 0x0621 && c <= 0x0670;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||||
# include "arabic.h.generated.h"
|
# include "arabic.h.generated.h"
|
||||||
|
|||||||
@@ -3224,7 +3224,7 @@ static void draw_cmdline(int start, int len)
|
|||||||
int u8cc[MAX_MCO];
|
int u8cc[MAX_MCO];
|
||||||
int u8c = utfc_ptr2char_len(p, u8cc, start + len - i);
|
int u8c = utfc_ptr2char_len(p, u8cc, start + len - i);
|
||||||
mb_l = utfc_ptr2len_len(p, start + len - i);
|
mb_l = utfc_ptr2len_len(p, start + len - i);
|
||||||
if (arabic_char(u8c)) {
|
if (ARABIC_CHAR(u8c)) {
|
||||||
do_arabicshape = true;
|
do_arabicshape = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -3260,7 +3260,7 @@ static void draw_cmdline(int start, int len)
|
|||||||
int u8cc[MAX_MCO];
|
int u8cc[MAX_MCO];
|
||||||
int u8c = utfc_ptr2char_len(p, u8cc, start + len - i);
|
int u8c = utfc_ptr2char_len(p, u8cc, start + len - i);
|
||||||
mb_l = utfc_ptr2len_len(p, start + len - i);
|
mb_l = utfc_ptr2len_len(p, start + len - i);
|
||||||
if (arabic_char(u8c)) {
|
if (ARABIC_CHAR(u8c)) {
|
||||||
int pc;
|
int pc;
|
||||||
int pc1 = 0;
|
int pc1 = 0;
|
||||||
int nc = 0;
|
int nc = 0;
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ void grid_puts_len(ScreenGrid *grid, char_u *text, int textlen, int row, int col
|
|||||||
u8c = utfc_ptr2char(ptr, u8cc);
|
u8c = utfc_ptr2char(ptr, u8cc);
|
||||||
}
|
}
|
||||||
mbyte_cells = utf_char2cells(u8c);
|
mbyte_cells = utf_char2cells(u8c);
|
||||||
if (p_arshape && !p_tbidi && arabic_char(u8c)) {
|
if (p_arshape && !p_tbidi && ARABIC_CHAR(u8c)) {
|
||||||
// Do Arabic shaping.
|
// Do Arabic shaping.
|
||||||
if (len >= 0 && (int)(ptr - text) + mbyte_blen >= len) {
|
if (len >= 0 && (int)(ptr - text) + mbyte_blen >= len) {
|
||||||
// Past end of string to be displayed.
|
// Past end of string to be displayed.
|
||||||
|
|||||||
@@ -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);
|
schar_from_ascii(dest[0], *p);
|
||||||
s->prev_c = u8c;
|
s->prev_c = u8c;
|
||||||
} else {
|
} else {
|
||||||
if (p_arshape && !p_tbidi && arabic_char(u8c)) {
|
if (p_arshape && !p_tbidi && ARABIC_CHAR(u8c)) {
|
||||||
// Do Arabic shaping.
|
// Do Arabic shaping.
|
||||||
int pc, pc1, nc;
|
int pc, pc1, nc;
|
||||||
int pcc[MAX_MCO];
|
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
|
} else if (mb_l == 0) { // at the NUL at end-of-line
|
||||||
mb_l = 1;
|
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.
|
// Do Arabic shaping.
|
||||||
int pc, pc1, nc;
|
int pc, pc1, nc;
|
||||||
int pcc[MAX_MCO];
|
int pcc[MAX_MCO];
|
||||||
|
|||||||
Reference in New Issue
Block a user