comparison src/ex_getln.c @ 15850:a6ca8cf07a98 v8.1.0932

patch 8.1.0932: Farsi support is outdated and unused commit https://github.com/vim/vim/commit/14184a3133b9a6ee5f711d493c04e41ba4fa7c2f Author: Bram Moolenaar <Bram@vim.org> Date: Sat Feb 16 15:10:30 2019 +0100 patch 8.1.0932: Farsi support is outdated and unused Problem: Farsi support is outdated and unused. Solution: Delete the Farsi support.
author Bram Moolenaar <Bram@vim.org>
date Sat, 16 Feb 2019 15:15:07 +0100
parents 536dd2bc5ac9
children 7fad90423bd2
comparison
equal deleted inserted replaced
15849:c478f5603556 15850:a6ca8cf07a98
77 static int hist_char2type(int c); 77 static int hist_char2type(int c);
78 #endif 78 #endif
79 79
80 #ifdef FEAT_RIGHTLEFT 80 #ifdef FEAT_RIGHTLEFT
81 static int cmd_hkmap = 0; /* Hebrew mapping during command line */ 81 static int cmd_hkmap = 0; /* Hebrew mapping during command line */
82 #endif
83
84 #ifdef FEAT_FKMAP
85 static int cmd_fkmap = 0; /* Farsi mapping during command line */
86 #endif 82 #endif
87 83
88 static char_u *getcmdline_int(int firstc, long count, int indent, int init_ccline); 84 static char_u *getcmdline_int(int firstc, long count, int indent, int init_ccline);
89 static int cmdline_charsize(int idx); 85 static int cmdline_charsize(int idx);
90 static void set_cmdspos(void); 86 static void set_cmdspos(void);
1041 { 1037 {
1042 some_key_typed = TRUE; 1038 some_key_typed = TRUE;
1043 #ifdef FEAT_RIGHTLEFT 1039 #ifdef FEAT_RIGHTLEFT
1044 if (cmd_hkmap) 1040 if (cmd_hkmap)
1045 c = hkmap(c); 1041 c = hkmap(c);
1046 # ifdef FEAT_FKMAP
1047 if (cmd_fkmap)
1048 c = cmdl_fkmap(c);
1049 # endif
1050 if (cmdmsg_rl && !KeyStuffed) 1042 if (cmdmsg_rl && !KeyStuffed)
1051 { 1043 {
1052 /* Invert horizontal movements and operations. Only when 1044 /* Invert horizontal movements and operations. Only when
1053 * typed by the user directly, not when the result of a 1045 * typed by the user directly, not when the result of a
1054 * mapping. */ 1046 * mapping. */
1593 case K_BS: 1585 case K_BS:
1594 case Ctrl_H: 1586 case Ctrl_H:
1595 case K_DEL: 1587 case K_DEL:
1596 case K_KDEL: 1588 case K_KDEL:
1597 case Ctrl_W: 1589 case Ctrl_W:
1598 #ifdef FEAT_FKMAP
1599 if (cmd_fkmap && c == K_BS)
1600 c = K_DEL;
1601 #endif
1602 if (c == K_KDEL) 1590 if (c == K_KDEL)
1603 c = K_DEL; 1591 c = K_DEL;
1604 1592
1605 /* 1593 /*
1606 * delete current character is the same as backspace on next 1594 * delete current character is the same as backspace on next
1692 } 1680 }
1693 goto cmdline_changed; 1681 goto cmdline_changed;
1694 1682
1695 case K_INS: 1683 case K_INS:
1696 case K_KINS: 1684 case K_KINS:
1697 #ifdef FEAT_FKMAP
1698 /* if Farsi mode set, we are in reverse insert mode -
1699 Do not change the mode */
1700 if (cmd_fkmap)
1701 beep_flush();
1702 else
1703 #endif
1704 ccline.overstrike = !ccline.overstrike; 1685 ccline.overstrike = !ccline.overstrike;
1705 #ifdef CURSOR_SHAPE 1686 #ifdef CURSOR_SHAPE
1706 ui_cursor_shape(); /* may show different cursor shape */ 1687 ui_cursor_shape(); /* may show different cursor shape */
1707 #endif 1688 #endif
1708 goto cmdline_not_changed; 1689 goto cmdline_not_changed;
2307 2288
2308 #ifdef FEAT_RIGHTLEFT 2289 #ifdef FEAT_RIGHTLEFT
2309 case Ctrl__: /* CTRL-_: switch language mode */ 2290 case Ctrl__: /* CTRL-_: switch language mode */
2310 if (!p_ari) 2291 if (!p_ari)
2311 break; 2292 break;
2312 # ifdef FEAT_FKMAP 2293 cmd_hkmap = !cmd_hkmap;
2313 if (p_altkeymap)
2314 {
2315 cmd_fkmap = !cmd_fkmap;
2316 if (cmd_fkmap) /* in Farsi always in Insert mode */
2317 ccline.overstrike = FALSE;
2318 }
2319 else /* Hebrew is default */
2320 # endif
2321 cmd_hkmap = !cmd_hkmap;
2322 goto cmdline_not_changed; 2294 goto cmdline_not_changed;
2323 #endif 2295 #endif
2324 2296
2325 case K_PS: 2297 case K_PS:
2326 bracketed_paste(PASTE_CMDLINE, FALSE, NULL); 2298 bracketed_paste(PASTE_CMDLINE, FALSE, NULL);
2417 2389
2418 returncmd: 2390 returncmd:
2419 2391
2420 #ifdef FEAT_RIGHTLEFT 2392 #ifdef FEAT_RIGHTLEFT
2421 cmdmsg_rl = FALSE; 2393 cmdmsg_rl = FALSE;
2422 #endif
2423
2424 #ifdef FEAT_FKMAP
2425 cmd_fkmap = 0;
2426 #endif 2394 #endif
2427 2395
2428 ExpandCleanup(&xpc); 2396 ExpandCleanup(&xpc);
2429 ccline.xpc = NULL; 2397 ccline.xpc = NULL;
2430 2398
3461 /* Avoid clearing the rest of the line too often. */ 3429 /* Avoid clearing the rest of the line too often. */
3462 if (cmdline_row != i || ccline.overstrike) 3430 if (cmdline_row != i || ccline.overstrike)
3463 msg_clr_eos(); 3431 msg_clr_eos();
3464 msg_no_more = FALSE; 3432 msg_no_more = FALSE;
3465 } 3433 }
3466 #ifdef FEAT_FKMAP 3434 if (KeyTyped)
3467 /* 3435 {
3468 * If we are in Farsi command mode, the character input must be in 3436 m = Columns * Rows;
3469 * Insert mode. So do not advance the cmdpos. 3437 if (m < 0) /* overflow, Columns or Rows at weird value */
3470 */
3471 if (!cmd_fkmap)
3472 #endif
3473 {
3474 if (KeyTyped)
3475 {
3476 m = Columns * Rows;
3477 if (m < 0) /* overflow, Columns or Rows at weird value */
3478 m = MAXCOL;
3479 }
3480 else
3481 m = MAXCOL; 3438 m = MAXCOL;
3482 for (i = 0; i < len; ++i) 3439 }
3483 { 3440 else
3484 c = cmdline_charsize(ccline.cmdpos); 3441 m = MAXCOL;
3485 /* count ">" for a double-wide char that doesn't fit. */ 3442 for (i = 0; i < len; ++i)
3486 if (has_mbyte) 3443 {
3487 correct_cmdspos(ccline.cmdpos, c); 3444 c = cmdline_charsize(ccline.cmdpos);
3488 /* Stop cursor at the end of the screen, but do increment the 3445 /* count ">" for a double-wide char that doesn't fit. */
3489 * insert position, so that entering a very long command 3446 if (has_mbyte)
3490 * works, even though you can't see it. */ 3447 correct_cmdspos(ccline.cmdpos, c);
3491 if (ccline.cmdspos + c < m) 3448 /* Stop cursor at the end of the screen, but do increment the
3492 ccline.cmdspos += c; 3449 * insert position, so that entering a very long command
3493 3450 * works, even though you can't see it. */
3494 if (has_mbyte) 3451 if (ccline.cmdspos + c < m)
3495 { 3452 ccline.cmdspos += c;
3496 c = (*mb_ptr2len)(ccline.cmdbuff + ccline.cmdpos) - 1; 3453
3497 if (c > len - i - 1) 3454 if (has_mbyte)
3498 c = len - i - 1; 3455 {
3499 ccline.cmdpos += c; 3456 c = (*mb_ptr2len)(ccline.cmdbuff + ccline.cmdpos) - 1;
3500 i += c; 3457 if (c > len - i - 1)
3501 } 3458 c = len - i - 1;
3502 ++ccline.cmdpos; 3459 ccline.cmdpos += c;
3503 } 3460 i += c;
3461 }
3462 ++ccline.cmdpos;
3504 } 3463 }
3505 } 3464 }
3506 if (redraw) 3465 if (redraw)
3507 msg_check(); 3466 msg_check();
3508 return retval; 3467 return retval;
7124 viminfo_hisidx[type] = 0; 7083 viminfo_hisidx[type] = 0;
7125 } 7084 }
7126 } 7085 }
7127 #endif /* FEAT_VIMINFO */ 7086 #endif /* FEAT_VIMINFO */
7128 7087
7129 #if defined(FEAT_FKMAP) || defined(PROTO)
7130 /*
7131 * Write a character at the current cursor+offset position.
7132 * It is directly written into the command buffer block.
7133 */
7134 void
7135 cmd_pchar(int c, int offset)
7136 {
7137 if (ccline.cmdpos + offset >= ccline.cmdlen || ccline.cmdpos + offset < 0)
7138 {
7139 emsg(_("E198: cmd_pchar beyond the command length"));
7140 return;
7141 }
7142 ccline.cmdbuff[ccline.cmdpos + offset] = (char_u)c;
7143 ccline.cmdbuff[ccline.cmdlen] = NUL;
7144 }
7145
7146 int
7147 cmd_gchar(int offset)
7148 {
7149 if (ccline.cmdpos + offset >= ccline.cmdlen || ccline.cmdpos + offset < 0)
7150 {
7151 // emsg(_("cmd_gchar beyond the command length"));
7152 return NUL;
7153 }
7154 return (int)ccline.cmdbuff[ccline.cmdpos + offset];
7155 }
7156 #endif
7157
7158 #if defined(FEAT_CMDWIN) || defined(PROTO) 7088 #if defined(FEAT_CMDWIN) || defined(PROTO)
7159 /* 7089 /*
7160 * Open a window on the current command line and history. Allow editing in 7090 * Open a window on the current command line and history. Allow editing in
7161 * the window. Returns when the window is closed. 7091 * the window. Returns when the window is closed.
7162 * Returns: 7092 * Returns: