aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Oliveira Carvalho <felipekde@gmail.com>2014-03-21 23:55:09 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-03-24 18:23:23 -0300
commitfd6fd35eef766d4ad80f8c0dd77e3b2dea026bcf (patch)
tree8aaa9cdcfa450241b9a4aaa3e14cbe0b75909583
parent7bd4d68d9316e13c6a8b3ff805daaf6b4c35e18c (diff)
downloadrneovim-fd6fd35eef766d4ad80f8c0dd77e3b2dea026bcf.tar.gz
rneovim-fd6fd35eef766d4ad80f8c0dd77e3b2dea026bcf.tar.bz2
rneovim-fd6fd35eef766d4ad80f8c0dd77e3b2dea026bcf.zip
Turn ARABIC_CHAR into a function
-rw-r--r--src/arabic.c6
-rw-r--r--src/arabic.h3
-rw-r--r--src/ex_getln.c3
-rw-r--r--src/screen.c7
4 files changed, 13 insertions, 6 deletions
diff --git a/src/arabic.c b/src/arabic.c
index fab7cfafed..5b324912bd 100644
--- a/src/arabic.c
+++ b/src/arabic.c
@@ -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.
diff --git a/src/arabic.h b/src/arabic.h
index 9743e8a935..2f956195b1 100644
--- a/src/arabic.h
+++ b/src/arabic.h
@@ -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
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 140a440f98..2079eafb8c 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -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 */
diff --git a/src/screen.c b/src/screen.c
index 11238995c0..95775f3bcb 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -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. */