vim-patch:8.1.0932: remove Farsi support (#9622)

Problem:    Farsi support is outdated and unused.
Solution:   Delete the Farsi support.
14184a3133
This commit is contained in:
Justin M. Keyes
2019-02-17 10:54:00 +01:00
committed by GitHub
parent dc9dd8d664
commit 33ce70c883
29 changed files with 64 additions and 2911 deletions

View File

@@ -1189,8 +1189,6 @@ struct window_S {
ScopeDictDictItem w_winvar; ///< Variable for "w:" dictionary.
dict_T *w_vars; ///< Dictionary with w: variables.
int w_farsi; /* for the window dependent Farsi functions */
/*
* The w_prev_pcmark field is used to check whether we really did jump to
* a new line after setting the w_pcmark. If not, then we revert to

View File

@@ -14,7 +14,6 @@
#include "nvim/vim.h"
#include "nvim/ascii.h"
#include "nvim/charset.h"
#include "nvim/farsi.h"
#include "nvim/func_attr.h"
#include "nvim/indent.h"
#include "nvim/main.h"
@@ -112,12 +111,6 @@ int buf_init_chartab(buf_T *buf, int global)
g_chartab[c++] = 1 + CT_PRINT_CHAR;
}
if (p_altkeymap) {
while (c < YE) {
g_chartab[c++] = 1 + CT_PRINT_CHAR;
}
}
while (c < 256) {
if (c >= 0xa0) {
// UTF-8: bytes 0xa0 - 0xff are printable (latin1)
@@ -217,8 +210,7 @@ int buf_init_chartab(buf_T *buf, int global)
// "C".
if (!do_isalpha
|| mb_islower(c)
|| mb_isupper(c)
|| (p_altkeymap && (F_isalpha(c) || F_isdigit(c)))) {
|| mb_isupper(c)) {
if (i == 0) {
// (re)set ID flag
if (tilde) {
@@ -230,9 +222,7 @@ int buf_init_chartab(buf_T *buf, int global)
// (re)set printable
// For double-byte we keep the cell width, so
// that we can detect it from the first byte.
if (((c < ' ')
|| (c > '~')
|| (p_altkeymap && (F_isalpha(c) || F_isdigit(c))))) {
if (((c < ' ') || (c > '~'))) {
if (tilde) {
g_chartab[c] = (uint8_t)((g_chartab[c] & ~CT_CELL_MASK)
+ ((dy_flags & DY_UHEX) ? 4 : 2));
@@ -540,8 +530,7 @@ char_u *transchar(int c)
c = K_SECOND(c);
}
if ((!chartab_initialized && (((c >= ' ') && (c <= '~'))
|| (p_altkeymap && F_ischar(c))))
if ((!chartab_initialized && (((c >= ' ') && (c <= '~'))))
|| ((c <= 0xFF) && vim_isprintc_strict(c))) {
// printable character
transchar_buf[i] = (char_u)c;

View File

@@ -21,7 +21,6 @@
#include "nvim/eval/typval.h"
#include "nvim/ex_docmd.h"
#include "nvim/ex_getln.h"
#include "nvim/farsi.h"
#include "nvim/fileio.h"
#include "nvim/fold.h"
#include "nvim/getchar.h"
@@ -342,13 +341,7 @@ static void insert_enter(InsertState *s)
}
if (s->cmdchar == 'R') {
if (p_fkmap && p_ri) {
beep_flush();
EMSG(farsi_text_3); // encoded in Farsi
State = INSERT;
} else {
State = REPLACE;
}
State = REPLACE;
} else if (s->cmdchar == 'V' || s->cmdchar == 'v') {
State = VREPLACE;
s->replaceState = VREPLACE;
@@ -630,10 +623,6 @@ static int insert_execute(VimState *state, int key)
s->c = hkmap(s->c); // Hebrew mode mapping
}
if (p_fkmap && KeyTyped) {
s->c = fkmap(s->c); // Farsi mode mapping
}
// Special handling of keys while the popup menu is visible or wanted
// and the cursor is still in the completed word. Only when there is
// a match, skip this when no matches were found.
@@ -5344,7 +5333,6 @@ insertchar (
&& !ISSPECIAL(c)
&& MB_BYTE2LEN(c) == 1
&& i < INPUT_BUFLEN
&& !(p_fkmap && KeyTyped) // Farsi mode mapping moves cursor
&& (textwidth == 0
|| (virtcol += byte2cells(buf[i - 1])) < (colnr_T)textwidth)
&& !(!no_abbr && !vim_iswordc(c) && vim_iswordc(buf[i - 1]))) {
@@ -7379,19 +7367,7 @@ static void ins_ctrl_(void)
undisplay_dollar();
} else
revins_scol = -1;
if (p_altkeymap) {
/*
* to be consistent also for redo command, using '.'
* set arrow_used to true and stop it - causing to redo
* characters entered in one mode (normal/reverse insert).
*/
arrow_used = TRUE;
(void)stop_arrow();
p_fkmap = curwin->w_p_rl ^ p_ri;
if (p_fkmap && p_ri)
State = INSERT;
} else
p_hkmap = curwin->w_p_rl ^ p_ri; /* be consistent! */
p_hkmap = curwin->w_p_rl ^ p_ri; // be consistent!
showmode();
}
@@ -7444,12 +7420,6 @@ static bool ins_start_select(int c)
*/
static void ins_insert(int replaceState)
{
if (p_fkmap && p_ri) {
beep_flush();
EMSG(farsi_text_3); /* encoded in Farsi */
return;
}
set_vim_var_string(VV_INSERTMODE, ((State & REPLACE_FLAG) ? "i" :
replaceState == VREPLACE ? "v" :
"r"), 1);
@@ -8423,12 +8393,10 @@ static bool ins_eol(int c)
if (virtual_active() && curwin->w_cursor.coladd > 0)
coladvance(getviscol());
if (p_altkeymap && p_fkmap)
fkmap(NL);
/* NL in reverse insert will always start in the end of
* current line. */
if (revins_on)
// NL in reverse insert will always start in the end of current line.
if (revins_on) {
curwin->w_cursor.col += (colnr_T)STRLEN(get_cursor_pos_ptr());
}
AppendToRedobuff(NL_STR);
bool i = open_line(FORWARD,

View File

@@ -10667,7 +10667,6 @@ static void f_has(typval_T *argvars, typval_T *rettv, FunPtr fptr)
"eval", /* always present, of course! */
"ex_extra",
"extra_search",
"farsi",
"file_in_path",
"filterpipe",
"find_in_path",

View File

@@ -30,7 +30,6 @@
#include "nvim/ex_docmd.h"
#include "nvim/ex_eval.h"
#include "nvim/ex_getln.h"
#include "nvim/farsi.h"
#include "nvim/fileio.h"
#include "nvim/fold.h"
#include "nvim/getchar.h"
@@ -3295,9 +3294,6 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
delimiter = *cmd++; // remember delimiter character
has_second_delim = true;
} else { // find the end of the regexp
if (p_altkeymap && curwin->w_p_rl) {
lrF_sub(cmd);
}
which_pat = RE_LAST; // use last used regexp
delimiter = *cmd++; // remember delimiter character
pat = cmd; // remember start of search pat
@@ -4298,9 +4294,6 @@ void ex_global(exarg_T *eap)
*cmd++ = NUL; /* replace it with a NUL */
}
if (p_altkeymap && curwin->w_p_rl)
lrFswap(pat,0);
if (search_regcomp(pat, RE_BOTH, which_pat, SEARCH_HIS, &regmatch) == FAIL) {
EMSG(_(e_invcmd));
return;

View File

@@ -27,7 +27,6 @@
#include "nvim/ex_cmds2.h"
#include "nvim/ex_docmd.h"
#include "nvim/ex_eval.h"
#include "nvim/farsi.h"
#include "nvim/fileio.h"
#include "nvim/func_attr.h"
#include "nvim/getchar.h"
@@ -221,7 +220,6 @@ static bool getln_interrupted_highlight = false;
#endif
static int cmd_hkmap = 0; // Hebrew mapping during command line
static int cmd_fkmap = 0; // Farsi mapping during command line
/// Internal entry point for cmdline mode.
///
@@ -421,8 +419,6 @@ static uint8_t *command_line_enter(int firstc, long count, int indent)
cmdmsg_rl = false;
cmd_fkmap = 0;
ExpandCleanup(&s->xpc);
ccline.xpc = NULL;
@@ -552,10 +548,6 @@ static int command_line_execute(VimState *state, int key)
s->c = hkmap(s->c);
}
if (cmd_fkmap) {
s->c = cmdl_fkmap(s->c);
}
if (cmdmsg_rl && !KeyStuffed) {
// Invert horizontal movements and operations. Only when
// typed by the user directly, not when the result of a
@@ -1180,10 +1172,6 @@ static int command_line_handle_key(CommandLineState *s)
case K_DEL:
case K_KDEL:
case Ctrl_W:
if (cmd_fkmap && s->c == K_BS) {
s->c = K_DEL;
}
if (s->c == K_KDEL) {
s->c = K_DEL;
}
@@ -1279,13 +1267,7 @@ static int command_line_handle_key(CommandLineState *s)
case K_INS:
case K_KINS:
// if Farsi mode set, we are in reverse insert mode -
// Do not change the mode
if (cmd_fkmap) {
beep_flush();
} else {
ccline.overstrike = !ccline.overstrike;
}
ccline.overstrike = !ccline.overstrike;
ui_cursor_shape(); // may show different cursor shape
return command_line_not_changed(s);
@@ -1740,16 +1722,7 @@ static int command_line_handle_key(CommandLineState *s)
if (!p_ari) {
break;
}
if (p_altkeymap) {
cmd_fkmap = !cmd_fkmap;
if (cmd_fkmap) {
// in Farsi always in Insert mode
ccline.overstrike = false;
}
} else {
// Hebrew is default
cmd_hkmap = !cmd_hkmap;
}
cmd_hkmap = !cmd_hkmap;
return command_line_not_changed(s);
default:
@@ -3217,40 +3190,40 @@ void put_on_cmdline(char_u *str, int len, int redraw)
msg_clr_eos();
msg_no_more = FALSE;
}
/*
* If we are in Farsi command mode, the character input must be in
* Insert mode. So do not advance the cmdpos.
*/
if (!cmd_fkmap) {
if (KeyTyped) {
m = Columns * Rows;
if (m < 0) /* overflow, Columns or Rows at weird value */
m = MAXCOL;
} else
if (KeyTyped) {
m = Columns * Rows;
if (m < 0) { // overflow, Columns or Rows at weird value
m = MAXCOL;
for (i = 0; i < len; ++i) {
c = cmdline_charsize(ccline.cmdpos);
/* count ">" for a double-wide char that doesn't fit. */
if (has_mbyte)
correct_cmdspos(ccline.cmdpos, c);
/* Stop cursor at the end of the screen, but do increment the
* insert position, so that entering a very long command
* works, even though you can't see it. */
if (ccline.cmdspos + c < m)
ccline.cmdspos += c;
if (has_mbyte) {
c = (*mb_ptr2len)(ccline.cmdbuff + ccline.cmdpos) - 1;
if (c > len - i - 1)
c = len - i - 1;
ccline.cmdpos += c;
i += c;
}
++ccline.cmdpos;
}
} else {
m = MAXCOL;
}
for (i = 0; i < len; i++) {
c = cmdline_charsize(ccline.cmdpos);
// count ">" for a double-wide char that doesn't fit.
if (has_mbyte) {
correct_cmdspos(ccline.cmdpos, c);
}
// Stop cursor at the end of the screen, but do increment the
// insert position, so that entering a very long command
// works, even though you can't see it.
if (ccline.cmdspos + c < m) {
ccline.cmdspos += c;
}
if (has_mbyte) {
c = (*mb_ptr2len)(ccline.cmdbuff + ccline.cmdpos) - 1;
if (c > len - i - 1) {
c = len - i - 1;
}
ccline.cmdpos += c;
i += c;
}
ccline.cmdpos++;
}
if (redraw)
if (redraw) {
msg_check();
}
}
/*
@@ -5999,37 +5972,12 @@ int hist_type2char(int type)
return NUL;
}
/*
* Write a character at the current cursor+offset position.
* It is directly written into the command buffer block.
*/
void cmd_pchar(int c, int offset)
{
if (ccline.cmdpos + offset >= ccline.cmdlen || ccline.cmdpos + offset < 0) {
EMSG(_("E198: cmd_pchar beyond the command length"));
return;
}
ccline.cmdbuff[ccline.cmdpos + offset] = (char_u)c;
ccline.cmdbuff[ccline.cmdlen] = NUL;
}
int cmd_gchar(int offset)
{
if (ccline.cmdpos + offset >= ccline.cmdlen || ccline.cmdpos + offset < 0) {
/* EMSG(_("cmd_gchar beyond the command length")); */
return NUL;
}
return (int)ccline.cmdbuff[ccline.cmdpos + offset];
}
/*
* Open a window on the current command line and history. Allow editing in
* the window. Returns when the window is closed.
* Returns:
* CR if the command is to be executed
* Ctrl_C if it is to be abandoned
* K_IGNORE if editing continues
*/
/// Open a window on the current command line and history. Allow editing in
/// the window. Returns when the window is closed.
/// Returns:
/// CR if the command is to be executed
/// Ctrl_C if it is to be abandoned
/// K_IGNORE if editing continues
static int open_cmdwin(void)
{
struct cmdline_info save_ccline;

File diff suppressed because it is too large Load Diff

View File

@@ -1,174 +0,0 @@
/// @file farsi.h
///
/// Farsi characters are categorized into following types:
///
/// TyA (for capital letter representation)
/// TyB (for types that look like _X e.g. AYN)
/// TyC (for types that look like X_ e.g. YE_)
/// TyD (for types that look like _X_ e.g. _AYN_)
/// TyE (for types that look like X e.g. RE)
#ifndef NVIM_FARSI_H
#define NVIM_FARSI_H
#include "nvim/normal.h"
#include "nvim/types.h"
// Farsi character set definition
// Begin of the non-standard part
#define TEE_ 0x80
#define ALEF_U_H_ 0x81
#define ALEF_ 0x82
#define _BE 0x83
#define _PE 0x84
#define _TE 0x85
#define _SE 0x86
#define _JIM 0x87
#define _CHE 0x88
#define _HE_J 0x89
#define _XE 0x8a
#define _SIN 0x8b
#define _SHIN 0x8c
#define _SAD 0x8d
#define _ZAD 0x8e
#define _AYN 0x8f
#define _AYN_ 0x90
#define AYN_ 0x91
#define _GHAYN 0x92
#define _GHAYN_ 0x93
#define GHAYN_ 0x94
#define _FE 0x95
#define _GHAF 0x96
#define _KAF 0x97
#define _GAF 0x98
#define _LAM 0x99
#define LA 0x9a
#define _MIM 0x9b
#define _NOON 0x9c
#define _HE 0x9d
#define _HE_ 0x9e
#define _YE 0x9f
#define _IE 0xec
#define IE_ 0xed
#define IE 0xfb
#define _YEE 0xee
#define YEE_ 0xef
#define YE_ 0xff
// End of the non-standard part
// Standard part
#define F_BLANK 0xa0 // Farsi ' ' (SP) character
#define F_PSP 0xa1 // PSP for capitalizing of a character
#define F_PCN 0xa2 // PCN for redefining of the hamye meaning
#define F_EXCL 0xa3 // Farsi ! character
#define F_CURRENCY 0xa4 // Farsi Rial character
#define F_PERCENT 0xa5 // Farsi % character
#define F_PERIOD 0xa6 // Farsi '.' character
#define F_COMMA 0xa7 // Farsi ',' character
#define F_LPARENT 0xa8 // Farsi '(' character
#define F_RPARENT 0xa9 // Farsi ')' character
#define F_MUL 0xaa // Farsi 'x' character
#define F_PLUS 0xab // Farsi '+' character
#define F_BCOMMA 0xac // Farsi comma character
#define F_MINUS 0xad // Farsi '-' character
#define F_DIVIDE 0xae // Farsi divide (/) character
#define F_SLASH 0xaf // Farsi '/' character
#define FARSI_0 0xb0
#define FARSI_1 0xb1
#define FARSI_2 0xb2
#define FARSI_3 0xb3
#define FARSI_4 0xb4
#define FARSI_5 0xb5
#define FARSI_6 0xb6
#define FARSI_7 0xb7
#define FARSI_8 0xb8
#define FARSI_9 0xb9
#define F_DCOLON 0xba // Farsi ':' character
#define F_SEMICOLON 0xbb // Farsi ';' character
#define F_GREATER 0xbc // Farsi '>' character
#define F_EQUALS 0xbd // Farsi '=' character
#define F_LESS 0xbe // Farsi '<' character
#define F_QUESTION 0xbf // Farsi ? character
#define ALEF_A 0xc0
#define ALEF 0xc1
#define HAMZE 0xc2
#define BE 0xc3
#define PE 0xc4
#define TE 0xc5
#define SE 0xc6
#define JIM 0xc7
#define CHE 0xc8
#define HE_J 0xc9
#define XE 0xca
#define DAL 0xcb
#define ZAL 0xcc
#define RE 0xcd
#define ZE 0xce
#define JE 0xcf
#define SIN 0xd0
#define SHIN 0xd1
#define SAD 0xd2
#define ZAD 0xd3
#define _TA 0xd4
#define _ZA 0xd5
#define AYN 0xd6
#define GHAYN 0xd7
#define FE 0xd8
#define GHAF 0xd9
#define KAF 0xda
#define GAF 0xdb
#define LAM 0xdc
#define MIM 0xdd
#define NOON 0xde
#define WAW 0xdf
#define F_HE 0xe0 // F_ added for name clash with Perl
#define YE 0xe1
#define TEE 0xfc
#define _KAF_H 0xfd
#define YEE 0xfe
#define F_LBRACK 0xe2 // Farsi '[' character
#define F_RBRACK 0xe3 // Farsi ']' character
#define F_LBRACE 0xe4 // Farsi '{' character
#define F_RBRACE 0xe5 // Farsi '}' character
#define F_LQUOT 0xe6 // Farsi left quotation character
#define F_RQUOT 0xe7 // Farsi right quotation character
#define F_STAR 0xe8 // Farsi '*' character
#define F_UNDERLINE 0xe9 // Farsi '_' character
#define F_PIPE 0xea // Farsi '|' character
#define F_BSLASH 0xeb // Farsi '\' character
#define MAD 0xf0
#define JAZR 0xf1
#define OW 0xf2
#define MAD_N 0xf3
#define JAZR_N 0xf4
#define OW_OW 0xf5
#define TASH 0xf6
#define OO 0xf7
#define ALEF_U_H 0xf8
#define WAW_H 0xf9
#define ALEF_D_H 0xfa
// definitions for the window dependent functions (w_farsi).
#define W_CONV 0x1
#define W_R_L 0x2
// special Farsi text messages
extern const char_u farsi_text_1[];
extern const char_u farsi_text_2[];
extern const char_u farsi_text_3[];
extern const char_u farsi_text_5[];
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "farsi.h.generated.h"
#endif
#endif // NVIM_FARSI_H

View File

@@ -25,7 +25,6 @@
#include "nvim/eval.h"
#include "nvim/ex_docmd.h"
#include "nvim/ex_getln.h"
#include "nvim/farsi.h"
#include "nvim/func_attr.h"
#include "nvim/main.h"
#include "nvim/mbyte.h"
@@ -2689,16 +2688,9 @@ do_map (
}
}
/*
* When in right-to-left mode and alternate keymap option set,
* reverse the character flow in the rhs in Farsi.
*/
if (p_altkeymap && curwin->w_p_rl)
lrswap(rhs);
/*
* check arguments and translate function keys
*/
//
// check arguments and translate function keys
//
if (haskey) {
len = (int)STRLEN(keys);
if (len > MAXMAPLEN) { /* maximum length of MAXMAPLEN chars */

View File

@@ -424,16 +424,10 @@ int main(int argc, char **argv)
p_ut = 1;
}
if (curwin->w_p_rl && p_altkeymap) {
p_hkmap = FALSE; /* Reset the Hebrew keymap mode */
curwin->w_p_arab = FALSE; /* Reset the Arabic keymap mode */
p_fkmap = TRUE; /* Set the Farsi keymap mode */
}
/*
* Read in registers, history etc, from the ShaDa file.
* This is where v:oldfiles gets filled.
*/
//
// Read in registers, history etc, from the ShaDa file.
// This is where v:oldfiles gets filled.
//
if (*p_shada != NUL) {
shada_read_everything(NULL, false, true);
TIME_MSG("reading ShaDa");
@@ -915,11 +909,6 @@ static void command_line_scan(mparm_T *parmp)
case 'f': { // "-f" GUI: run in foreground.
break;
}
case 'F': { // "-F" start in Farsi mode: rl + fkmap set.
p_fkmap = true;
set_option_value("rl", 1L, NULL, 0);
break;
}
case '?': // "-?" give help message (for MS-Windows)
case 'h': { // "-h" give help message
usage();

View File

@@ -28,7 +28,6 @@
#include "nvim/ex_cmds2.h"
#include "nvim/ex_docmd.h"
#include "nvim/ex_getln.h"
#include "nvim/farsi.h"
#include "nvim/fileio.h"
#include "nvim/fold.h"
#include "nvim/getchar.h"
@@ -340,8 +339,6 @@ static const struct nv_cmd {
{ K_F1, nv_help, NV_NCW, 0 },
{ K_XF1, nv_help, NV_NCW, 0 },
{ K_SELECT, nv_select, 0, 0 },
{ K_F8, farsi_f8, 0, 0 },
{ K_F9, farsi_f9, 0, 0 },
{ K_EVENT, nv_event, NV_KEEPREG, 0 },
{ K_COMMAND, nv_colon, 0, 0 },
};
@@ -719,10 +716,6 @@ static void normal_get_additional_char(NormalState *s)
if (p_hkmap && lang && KeyTyped) {
*cp = hkmap(*cp);
}
// adjust Farsi mapped char
if (p_fkmap && lang && KeyTyped) {
*cp = fkmap(*cp);
}
}
// When the next character is CTRL-\ a following CTRL-N means the

View File

@@ -3945,51 +3945,6 @@ static char *set_bool_option(const int opt_idx, char_u *const varp,
if (errmsg != NULL)
EMSG(_(errmsg));
}
} else if ((int *)varp == &p_altkeymap) {
if (old_value != p_altkeymap) {
if (!p_altkeymap) {
p_hkmap = p_fkmap;
p_fkmap = 0;
} else {
p_fkmap = p_hkmap;
p_hkmap = 0;
}
(void)init_chartab();
}
}
/*
* In case some second language keymapping options have changed, check
* and correct the setting in a consistent way.
*/
/*
* If hkmap or fkmap are set, reset Arabic keymapping.
*/
if ((p_hkmap || p_fkmap) && p_altkeymap) {
p_altkeymap = p_fkmap;
curwin->w_p_arab = FALSE;
(void)init_chartab();
}
/*
* If hkmap set, reset Farsi keymapping.
*/
if (p_hkmap && p_altkeymap) {
p_altkeymap = 0;
p_fkmap = 0;
curwin->w_p_arab = FALSE;
(void)init_chartab();
}
/*
* If fkmap set, reset Hebrew keymapping.
*/
if (p_fkmap && !p_altkeymap) {
p_altkeymap = 1;
p_hkmap = 0;
curwin->w_p_arab = FALSE;
(void)init_chartab();
}
if ((int *)varp == &curwin->w_p_arab) {
@@ -4027,10 +3982,6 @@ static char *set_bool_option(const int opt_idx, char_u *const varp,
// Force-set the necessary keymap for arabic.
set_option_value("keymap", 0L, "arabic", OPT_LOCAL);
p_altkeymap = 0;
p_hkmap = 0;
p_fkmap = 0;
(void)init_chartab();
} else {
/*
* 'arabic' is reset, handle various sub-settings.
@@ -5664,8 +5615,6 @@ void win_copy_options(win_T *wp_from, win_T *wp_to)
{
copy_winopt(&wp_from->w_onebuf_opt, &wp_to->w_onebuf_opt);
copy_winopt(&wp_from->w_allbuf_opt, &wp_to->w_allbuf_opt);
/* Is this right? */
wp_to->w_farsi = wp_from->w_farsi;
}
/*

View File

@@ -464,8 +464,6 @@ EXTERN int p_hls; // 'hlsearch'
EXTERN long p_hi; // 'history'
EXTERN int p_hkmap; // 'hkmap'
EXTERN int p_hkmapp; // 'hkmapp'
EXTERN int p_fkmap; // 'fkmap'
EXTERN int p_altkeymap; // 'altkeymap'
EXTERN int p_arshape; // 'arabicshape'
EXTERN int p_icon; // 'icon'
EXTERN char_u *p_iconstring; // 'iconstring'

View File

@@ -81,13 +81,6 @@ return {
varname='p_ari',
defaults={if_true={vi=false}}
},
{
full_name='altkeymap', abbreviation='akm',
type='bool', scope={'global'},
vi_def=true,
varname='p_altkeymap',
defaults={if_true={vi=false}}
},
{
full_name='ambiwidth', abbreviation='ambw',
type='string', scope={'global'},
@@ -821,13 +814,6 @@ return {
varname='p_fixeol',
defaults={if_true={vi=true}}
},
{
full_name='fkmap', abbreviation='fk',
type='bool', scope={'global'},
vi_def=true,
varname='p_fkmap',
defaults={if_true={vi=false}}
},
{
full_name='foldclose', abbreviation='fcl',
type='string', list='onecomma', scope={'global'},

View File

@@ -80,7 +80,6 @@
#include "nvim/ex_cmds2.h"
#include "nvim/ex_getln.h"
#include "nvim/edit.h"
#include "nvim/farsi.h"
#include "nvim/fileio.h"
#include "nvim/fold.h"
#include "nvim/indent.h"
@@ -6499,9 +6498,6 @@ int showmode(void)
if (p_hkmap) {
MSG_PUTS_ATTR(_(" Hebrew"), attr);
}
if (p_fkmap) {
MSG_PUTS_ATTR(farsi_text_5, attr);
}
if (State & LANGMAP) {
if (curwin->w_p_arab) {
MSG_PUTS_ATTR(_(" Arabic"), attr);

View File

@@ -21,7 +21,6 @@
#include "nvim/ex_cmds.h"
#include "nvim/ex_cmds2.h"
#include "nvim/ex_getln.h"
#include "nvim/farsi.h"
#include "nvim/fileio.h"
#include "nvim/fold.h"
#include "nvim/func_attr.h"
@@ -1198,18 +1197,14 @@ int do_search(
}
}
if (p_altkeymap && curwin->w_p_rl)
lrFswap(searchstr,0);
c = searchit(curwin, curbuf, &pos, dirc == '/' ? FORWARD : BACKWARD,
searchstr, count, (spats[0].off.end * SEARCH_END
+ (options &
(SEARCH_KEEP + SEARCH_PEEK +
SEARCH_HIS
+ SEARCH_MSG + SEARCH_START
+ ((pat != NULL && *pat ==
';') ? 0 : SEARCH_NOOF)))),
RE_LAST, (linenr_T)0, tm);
searchstr, count,
(spats[0].off.end * SEARCH_END
+ (options
& (SEARCH_KEEP + SEARCH_PEEK + SEARCH_HIS + SEARCH_MSG
+ SEARCH_START
+ ((pat != NULL && *pat == ';') ? 0 : SEARCH_NOOF)))),
RE_LAST, (linenr_T)0, tm);
if (dircp != NULL)
*dircp = dirc; /* restore second '/' or '?' for normal_cmd() */
@@ -2470,9 +2465,6 @@ static int cls(void)
int c;
c = gchar_cursor();
if (p_altkeymap && c == F_BLANK) {
return 0;
}
if (c == ' ' || c == '\t' || c == NUL) {
return 0;
}

View File

@@ -1,133 +0,0 @@
" Simplistic testing of Farsi mode.
" Note: must be edited with latin1 encoding.
if !has('farsi') || has('nvim') " Not supported in Nvim. #6192
finish
endif
" Farsi uses a single byte encoding.
set enc=latin1
func Test_farsi_toggle()
new
set altkeymap
call assert_equal(0, &fkmap)
call assert_equal(0, &rl)
call feedkeys("\<F8>", 'x')
call assert_equal(1, &fkmap)
call assert_equal(1, &rl)
call feedkeys("\<F8>", 'x')
call assert_equal(0, &fkmap)
call assert_equal(0, &rl)
set rl
" conversion from Farsi 3342 to Farsi VIM.
call setline(1, join(map(range(0x80, 0xff), 'nr2char(v:val)'), ''))
call feedkeys("\<F9>", 'x')
let exp = [0xfc, 0xf8, 0xc1, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
\ 0xc8, 0xc9, 0xca, 0xd0, 0xd1, 0xd2, 0xd3, 0xd6,
\ 0xd6, 0xd6, 0xd7, 0xd7, 0xd7, 0xd8, 0xd9, 0xda,
\ 0xdb, 0xdc, 0xdc, 0xc1, 0xdd, 0xde, 0xe0, 0xe0,
\ 0xe1, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6,
\ 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae,
\ 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6,
\ 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe,
\ 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6,
\ 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce,
\ 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6,
\ 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde,
\ 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6,
\ 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xfb, 0xfb, 0xfe,
\ 0xfe, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6,
\ 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xe1,
\ ]
call assert_equal(join(map(exp, 'nr2char(v:val)'), ''), getline(1))
" conversion from Farsi VIM to Farsi 3342.
call setline(1, join(map(range(0x80, 0xff), 'nr2char(v:val)'), ''))
call feedkeys("\<F9>", 'x')
let exp = [0xfc, 0xf8, 0xc1, 0x83, 0x84, 0x85, 0x86, 0x87,
\ 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x90,
\ 0x90, 0x90, 0x92, 0x93, 0x93, 0x95, 0x96, 0x97,
\ 0x98, 0xdc, 0x9a, 0x9b, 0x9c, 0x9e, 0x9e, 0xff,
\ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
\ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
\ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
\ 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
\ 0xc0, 0xc1, 0xc2, 0x83, 0x84, 0x85, 0x86, 0x87,
\ 0x88, 0x89, 0x8a, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
\ 0x8b, 0x8c, 0x8d, 0x8e, 0xd4, 0xd5, 0x90, 0x93,
\ 0x95, 0x96, 0x97, 0x98, 0x99, 0x9b, 0x9c, 0xdf,
\ 0x9d, 0xff, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
\ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xec, 0xee, 0xef,
\ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
\ 0xf8, 0xf9, 0xfa, 0xec, 0x80, 0xfd, 0xee, 0xff,
\ ]
call assert_equal(join(map(exp, 'nr2char(v:val)'), ''), getline(1))
bwipe!
endfunc
func Test_farsi_map()
new
set altkeymap
set rl
" RHS of mapping is reversed.
imap xyz abc
call feedkeys("axyz\<Esc>", 'tx')
call assert_equal('cba', getline(1))
set norl
iunmap xyz
set noaltkeymap
bwipe!
endfunc
func Test_input_farsi()
new
setlocal rightleft fkmap
" numbers switch input direction
call feedkeys("aabc0123456789.+-^%#=xyz\<Esc>", 'tx')
call assert_equal("\x8c<38>ν<EFBFBD><CEBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\x93<39>", getline('.'))
" all non-number special chars with spaces
call feedkeys("oB E F H I K L M O P Q R T U W Y ` ! @ # $ % ^ & * () - _ = + \\ | : \" . / < > ? \<Esc>", 'tx')
call assert_equal("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> [<5B>]<5D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>񠢠<EFBFBD><F1A0A2A0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E8A0A8><EFBFBD><EFBFBD><EFBFBD><E9A0BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EAA0BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", getline('.'))
" all non-number special chars without spaces
call feedkeys("oBEFHIKLMOPQRTUWY`!@#$%^&*()-_=+\\|:\"./<>?\<Esc>",'tx')
call assert_equal("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>[]<5D><><EFBFBD><EFBFBD><EFBFBD>񢣧<EFBFBD><F1A2A3A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EABABB><EFBFBD><EFBFBD><EFBFBD>", getline('.'))
" all letter chars with spaces
call feedkeys("oa A b c C d D e f g G h i j J k l m n N o p q r s S t u v V w x X y z Z ; \ , [ ] \<Esc>", 'tx')
call assert_equal(<><D1A0>̠ΠϠ<CEA0><CFA0><EFBFBD><EFBFBD>Ơàܠ<C3A0><DCA0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Š<EFBFBD><C5A0>ޠݠĠˠˠʠɠӠ٠Р<D9A0><D0A0>ؠ֠͠͠ҠԠԠנՠ<D7A0><D5A0>ڠ<EFBFBD>ߠǠȠ", getline('.'))
" all letter chars without spaces
call feedkeys("oaAbcCdDefgGhijJklmnNopqrsStuvVwxXyzZ;\,[]\<Esc>", 'tx')
call assert_equal("\x8c<38><63><EFBFBD><EFBFBD>\x9f<39>\x86\x83<38><33><EFBFBD>\x9d\x85\x80\x9c\x9b\x84<38><34>\x8a\x89\x8e\x96\x8b<38>\x95\x90<39><30>\x8d<38><64>\x93<39><33>\x97<39>\x87\x88", getline('.'))
bwipe!
endfunc
func Test_command_line_farsi()
set allowrevins altkeymap
" letter characters with spaces
call feedkeys(":\"\<C-_>a A b c C d D e f g G h i j J k l m n N o p q r s S t u v V w x X y z Z ; \\ , [ ]\<CR>", 'tx')
call assert_equal("\"\x88<38>Ǡߠ<C7A0><DFA0>ڠՠՠנԠԠҠ֠͠͠ؠ<D6A0><D8A0>Р٠ӠɠʠˠˠĠݠޠ<DDA0><DEA0>Š<EFBFBD><C5A0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܠàƠ<C3A0><C6A0><EFBFBD><EFBFBD>ϠΠ̠<CEA0><CCA0><EFBFBD>", getreg(':'))
" letter characters without spaces
call feedkeys(":\"\<C-_>aAbcCdDefgGhijJklmnNopqrsStuvVwxXyzZ;\\,[]\<CR>", 'tx')
call assert_equal("\"\x88\x87<38><37><EFBFBD><EFBFBD><EFBFBD>\x93<39><33>\x8d<38><64>\x90\x95<39>\x8b\x96\x8e\x89\x8a<38><61>\x84\x9b\x9c\x80\x85\x9d<39><64><EFBFBD>\x83\x86<38>\x9f<39><66><EFBFBD><EFBFBD>\x8c", getreg(':'))
" other characters with spaces
call feedkeys(":\"\<C-_>0 1 2 3 4 5 6 7 8 9 ` . ! \" $ % ^ & / () = \\ ? + - _ * : # ~ @ < > { } | B E F H I K L M O P Q R T U W Y\<CR>", 'tx')
call assert_equal("\"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>]<5D>[<5B> <EFBFBD><C2A0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>}<7D>{<7B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>~<7E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E9A0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBA0BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", getreg(':'))
" other characters without spaces
call feedkeys(":\"\<C-_>0123456789`.!\"$%^&/()=\\?+-_*:#~@<>{}|BEFHIKLMOPQRTUWY\<CR>", 'tx')
call assert_equal("\"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>][<5B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>}{<7B><><EFBFBD>~<7E><><EFBFBD><EFBFBD><EFBFBD><EBBDA9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", getreg(':'))
set noallowrevins noaltkeymap
endfunc

View File

@@ -20,7 +20,6 @@
#include "nvim/ex_docmd.h"
#include "nvim/ex_eval.h"
#include "nvim/ex_getln.h"
#include "nvim/farsi.h"
#include "nvim/fileio.h"
#include "nvim/fold.h"
#include "nvim/getchar.h"
@@ -2934,10 +2933,6 @@ void win_init_empty(win_T *wp)
wp->w_topline = 1;
wp->w_topfill = 0;
wp->w_botline = 2;
if (wp->w_p_rl)
wp->w_farsi = W_CONV + W_R_L;
else
wp->w_farsi = W_CONV;
wp->w_s = &wp->w_buffer->b_s;
}