mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 03:05:11 -07:00
Turn ARABIC_CHAR into a function
This commit is contained in:
parent
7bd4d68d93
commit
fd6fd35eef
@ -1129,6 +1129,12 @@ static int half_shape(int c)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// Whether c belongs to the range of Arabic characters that might be shaped.
|
||||
int arabic_char(int c)
|
||||
{
|
||||
return c >= a_HAMZA && c <= a_MINI_ALEF;
|
||||
}
|
||||
|
||||
/*
|
||||
* Do Arabic shaping on character "c". Returns the shaped character.
|
||||
* out: "ccp" points to the first byte of the character to be shaped.
|
||||
|
@ -238,7 +238,6 @@
|
||||
|
||||
#define a_BYTE_ORDER_MARK 0xfeff
|
||||
|
||||
// Range of Arabic characters that might be shaped.
|
||||
#define ARABIC_CHAR(c) ((c) >= a_HAMZA && (c) <= a_MINI_ALEF)
|
||||
int arabic_char(int c);
|
||||
|
||||
#endif // NEOVIM_ARABIC_H
|
||||
|
@ -12,6 +12,7 @@
|
||||
*/
|
||||
|
||||
#include "vim.h"
|
||||
#include "arabic.h"
|
||||
#include "ex_getln.h"
|
||||
#include "buffer.h"
|
||||
#include "charset.h"
|
||||
@ -2100,7 +2101,7 @@ static void draw_cmdline(int start, int len)
|
||||
p = ccline.cmdbuff + j;
|
||||
u8c = utfc_ptr2char_len(p, u8cc, start + len - j);
|
||||
mb_l = utfc_ptr2len_len(p, start + len - j);
|
||||
if (ARABIC_CHAR(u8c)) {
|
||||
if (arabic_char(u8c)) {
|
||||
/* Do Arabic shaping. */
|
||||
if (cmdmsg_rl) {
|
||||
/* displaying from right to left */
|
||||
|
@ -88,6 +88,7 @@
|
||||
*/
|
||||
|
||||
#include "vim.h"
|
||||
#include "arabic.h"
|
||||
#include "screen.h"
|
||||
#include "buffer.h"
|
||||
#include "charset.h"
|
||||
@ -1868,7 +1869,7 @@ static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T
|
||||
ScreenLinesUC[idx] = 0;
|
||||
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];
|
||||
@ -3049,7 +3050,7 @@ win_line (
|
||||
}
|
||||
} 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];
|
||||
@ -5218,7 +5219,7 @@ void screen_puts_len(char_u *text, int len, int row, int col, int attr)
|
||||
attr = hl_attr(HLF_8);
|
||||
}
|
||||
# endif
|
||||
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. */
|
||||
|
Loading…
Reference in New Issue
Block a user