v_txt.c (19305) | v_txt.c (208612) |
---|---|
1/*- 2 * Copyright (c) 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * Copyright (c) 1992, 1993, 1994, 1995, 1996 5 * Keith Bostic. All rights reserved. 6 * 7 * See the LICENSE file for redistribution information. 8 */ --- 496 unchanged lines hidden (view full) --- 505 /* Deal with all non-character events. */ 506 switch (evp->e_event) { 507 case E_CHARACTER: 508 break; 509 case E_ERR: 510 case E_EOF: 511 F_SET(sp, SC_EXIT_FORCE); 512 return (1); | 1/*- 2 * Copyright (c) 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * Copyright (c) 1992, 1993, 1994, 1995, 1996 5 * Keith Bostic. All rights reserved. 6 * 7 * See the LICENSE file for redistribution information. 8 */ --- 496 unchanged lines hidden (view full) --- 505 /* Deal with all non-character events. */ 506 switch (evp->e_event) { 507 case E_CHARACTER: 508 break; 509 case E_ERR: 510 case E_EOF: 511 F_SET(sp, SC_EXIT_FORCE); 512 return (1); |
513 case E_INTERRUPT: 514 /* 515 * !!! 516 * Historically, <interrupt> exited the user from text input 517 * mode or cancelled a colon command, and returned to command 518 * mode. It also beeped the terminal, but that seems a bit 519 * excessive. 520 */ 521 goto k_escape; | |
522 case E_REPAINT: 523 if (vs_repaint(sp, &ev)) 524 return (1); 525 goto next; 526 case E_WRESIZE: 527 /* <resize> interrupts the input mode. */ 528 v_emsg(sp, NULL, VIM_WRESIZE); | 513 case E_REPAINT: 514 if (vs_repaint(sp, &ev)) 515 return (1); 516 goto next; 517 case E_WRESIZE: 518 /* <resize> interrupts the input mode. */ 519 v_emsg(sp, NULL, VIM_WRESIZE); |
529 goto k_escape; | 520 /* FALLTHROUGH */ |
530 default: | 521 default: |
531 v_event_err(sp, evp); 532 goto k_escape; | 522 if (evp->e_event != E_INTERRUPT && evp->e_event != E_WRESIZE) 523 v_event_err(sp, evp); 524 /* 525 * !!! 526 * Historically, <interrupt> exited the user from text input 527 * mode or cancelled a colon command, and returned to command 528 * mode. It also beeped the terminal, but that seems a bit 529 * excessive. 530 */ 531 /* 532 * If we are recording, morph into <escape> key so that 533 * we can repeat the command safely: there is no way to 534 * invalidate the repetition of an instance of a command, 535 * which would be the alternative possibility. 536 * If we are not recording (most likely on the command line), 537 * simply discard the input and return to command mode 538 * so that an INTERRUPT doesn't become for example a file 539 * completion request. -aymeric 540 */ 541 if (LF_ISSET(TXT_RECORD)) { 542 evp->e_event = E_CHARACTER; 543 evp->e_c = 033; 544 evp->e_flags = 0; 545 evp->e_value = K_ESCAPE; 546 break; 547 } else { 548 tp->term = TERM_ESC; 549 goto k_escape; 550 } |
533 } 534 535 /* 536 * !!! 537 * If the first character of the input is a nul, replay the previous 538 * input. (Historically, it's okay to replay non-existent input.) 539 * This was not documented as far as I know, and is a great test of vi 540 * clones. 541 */ | 551 } 552 553 /* 554 * !!! 555 * If the first character of the input is a nul, replay the previous 556 * input. (Historically, it's okay to replay non-existent input.) 557 * This was not documented as far as I know, and is a great test of vi 558 * clones. 559 */ |
542 if (rcol == 0 && !LF_ISSET(TXT_REPLAY) && evp->e_c == '\0') { | 560 if (LF_ISSET(TXT_RECORD) && rcol == 0 && evp->e_c == '\0') { |
543 if (vip->rep == NULL) 544 goto done; 545 546 abb = AB_NOTSET; 547 LF_CLR(TXT_RECORD); 548 LF_SET(TXT_REPLAY); 549 goto replay; 550 } --- 900 unchanged lines hidden (view full) --- 1451 if (!F_ISSET(sp, SC_TINPUT_INFO)) { 1452 vp->m_final.lno = tp->lno; 1453 vp->m_final.cno = tp->cno; 1454 } 1455 return (0); 1456 1457err: 1458alloc_err: | 561 if (vip->rep == NULL) 562 goto done; 563 564 abb = AB_NOTSET; 565 LF_CLR(TXT_RECORD); 566 LF_SET(TXT_REPLAY); 567 goto replay; 568 } --- 900 unchanged lines hidden (view full) --- 1469 if (!F_ISSET(sp, SC_TINPUT_INFO)) { 1470 vp->m_final.lno = tp->lno; 1471 vp->m_final.cno = tp->cno; 1472 } 1473 return (0); 1474 1475err: 1476alloc_err: |
1477 F_CLR(sp, SC_TINPUT); |
|
1459 txt_err(sp, &sp->tiq); 1460 return (1); 1461} 1462 1463/* 1464 * txt_abbrev -- 1465 * Handle abbreviations. 1466 */ --- 744 unchanged lines hidden (view full) --- 2211 reset = 0; 2212 2213#define CHK_INTR \ 2214 if (F_ISSET(gp, G_INTERRUPTED)) \ 2215 goto intr; 2216 2217 /* If the largest file name is too large, just print them. */ 2218 if (colwidth > sp->cols) { | 1478 txt_err(sp, &sp->tiq); 1479 return (1); 1480} 1481 1482/* 1483 * txt_abbrev -- 1484 * Handle abbreviations. 1485 */ --- 744 unchanged lines hidden (view full) --- 2230 reset = 0; 2231 2232#define CHK_INTR \ 2233 if (F_ISSET(gp, G_INTERRUPTED)) \ 2234 goto intr; 2235 2236 /* If the largest file name is too large, just print them. */ 2237 if (colwidth > sp->cols) { |
2219 p = msg_print(sp, av[0]->bp + prefix, &nf); | |
2220 for (ac = argc, av = argv; ac > 0; --ac, ++av) { | 2238 for (ac = argc, av = argv; ac > 0; --ac, ++av) { |
2239 p = msg_print(sp, av[0]->bp + prefix, &nf); |
|
2221 (void)ex_printf(sp, "%s\n", p); 2222 if (F_ISSET(gp, G_INTERRUPTED)) 2223 break; 2224 } 2225 if (nf) 2226 FREE_SPACE(sp, p, 0); 2227 CHK_INTR; 2228 } else { --- 722 unchanged lines hidden --- | 2240 (void)ex_printf(sp, "%s\n", p); 2241 if (F_ISSET(gp, G_INTERRUPTED)) 2242 break; 2243 } 2244 if (nf) 2245 FREE_SPACE(sp, p, 0); 2246 CHK_INTR; 2247 } else { --- 722 unchanged lines hidden --- |