2 * Copyright (C) 1984-2017 Mark Nudelman
4 * You may distribute under the terms of either the GNU General Public
5 * License or the Less License, as specified in the README file.
7 * For more information, see the README file.
12 * User-level command processor.
16 #if MSDOS_COMPILER==WIN32C
23 extern int erase_char, erase2_char, kill_char;
25 extern int quit_if_one_screen;
31 extern int jump_sline;
34 extern int top_scroll;
35 extern int ignore_eoi;
40 extern int status_col;
41 extern POSITION highest_hilite;
42 extern POSITION start_attnpos;
43 extern POSITION end_attnpos;
44 extern char *every_first_cmd;
45 extern char version[];
46 extern struct scrpos initial_scrpos;
47 extern IFILE curr_ifile;
48 extern void *ml_search;
49 extern void *ml_examine;
50 #if SHELL_ESCAPE || PIPEC
51 extern void *ml_shell;
55 extern char *editproto;
57 extern int screen_trashed; /* The screen has been overwritten */
58 extern int shift_count;
60 extern int forw_prompt;
63 static char *shellcmd = NULL; /* For holding last shell command for "!!" */
65 static int mca; /* The multicharacter command (action) */
66 static int search_type; /* The previous type of search */
67 static LINENUM number; /* The number typed by the user */
68 static long fraction; /* The fractional part of the number */
69 static struct loption *curropt;
72 static int optgetname;
73 static POSITION bottompos;
74 static int save_hshift;
75 static int save_bs_mode;
80 /* Stack of ungotten chars (via ungetcc) */
82 struct ungot *ug_next;
85 static struct ungot* ungot = NULL;
87 static void multi_search();
90 * Move the cursor to start of prompt line before executing a command.
91 * This looks nicer if the command takes a long time before
92 * updating the screen.
103 * Set up the display to start a new multi-character command.
106 start_mca(action, prompt, mlist, cmdflags)
108 constant char *prompt;
116 set_mlist(mlist, cmdflags);
122 return (mca != 0 && mca != A_PREFIX);
126 * Set up the display to start a new search command.
132 if (search_type & SRCH_FILTER)
136 if (search_type & SRCH_FORW)
144 if (search_type & SRCH_NO_MATCH)
145 cmd_putstr("Non-match ");
146 if (search_type & SRCH_FIRST_FILE)
147 cmd_putstr("First-file ");
148 if (search_type & SRCH_PAST_EOF)
149 cmd_putstr("EOF-ignore ");
150 if (search_type & SRCH_NO_MOVE)
151 cmd_putstr("Keep-pos ");
152 if (search_type & SRCH_NO_REGEX)
153 cmd_putstr("Regex-off ");
156 if (search_type & SRCH_FILTER)
160 if (search_type & SRCH_FORW)
165 set_mlist(ml_search, 0);
169 * Set up the display to start a new toggle-option command.
178 no_prompt = (optflag & OPT_NO_PROMPT);
179 flag = (optflag & ~OPT_NO_PROMPT);
180 dash = (flag == OPT_NO_TOGGLE) ? "_" : "-";
204 * Execute a multicharacter command.
218 multi_search(cbuf, (int) number, 0);
222 search_type ^= SRCH_NO_MATCH;
223 set_filter_pattern(cbuf, search_type);
228 * Skip leading spaces or + signs in the string.
230 while (*cbuf == '+' || *cbuf == ' ')
232 if (every_first_cmd != NULL)
233 free(every_first_cmd);
235 every_first_cmd = NULL;
237 every_first_cmd = save(cbuf);
240 toggle_option(curropt, opt_lower, cbuf, optflag);
244 match_brac(cbuf[0], cbuf[1], 1, (int) number);
247 match_brac(cbuf[1], cbuf[0], 0, (int) number);
255 /* If tag structure is loaded then clean it up. */
263 * !! just uses whatever is in shellcmd.
264 * Otherwise, copy cmdbuf to shellcmd,
265 * expanding any special characters ("%" or "#").
269 if (shellcmd != NULL)
271 shellcmd = fexpand(cbuf);
276 if (shellcmd == NULL)
277 lsystem("", "!done");
279 lsystem(shellcmd, "!done");
286 (void) pipe_mark(pipec, cbuf);
287 error("|done", NULL_PARG);
294 * Is a character an erase or kill char?
300 return (c == erase_char || c == erase2_char || c == kill_char);
304 * Is a character a carriage return or newline?
310 return (c == '\n' || c == '\r');
314 * Handle the first char of an option (after the initial dash).
317 mca_opt_first_char(c)
320 int flag = (optflag & ~OPT_NO_PROMPT);
321 if (flag == OPT_NO_TOGGLE)
326 /* "__" = long option name. */
337 optflag = (flag == OPT_UNSET) ?
338 OPT_TOGGLE : OPT_UNSET;
343 optflag = (flag == OPT_SET) ?
344 OPT_TOGGLE : OPT_SET;
348 optflag ^= OPT_NO_PROMPT;
352 /* "--" = long option name. */
358 /* Char was not handled here. */
363 * Add a char to a long option name.
364 * See if we've got a match for an option name yet.
365 * If so, display the complete name and stop
366 * accepting chars until user hits RETURN.
369 mca_opt_nonfirst_char(c)
378 * Already have a match for the name.
379 * Don't accept anything but erase/kill.
381 if (is_erase_char(c))
386 * Add char to cmd buffer and try to match
389 if (cmd_char(c) == CC_QUIT)
392 opt_lower = ASCII_IS_LOWER(p[0]);
393 curropt = findopt_name(&p, &oname, NULL);
398 * Remember the option and
399 * display the full option name.
403 for (p = oname; *p != '\0'; p++)
406 if (!opt_lower && ASCII_IS_LOWER(c))
407 c = ASCII_TO_UPPER(c);
408 if (cmd_char(c) != CC_OK)
416 * Handle a char of an option toggle command.
425 * This may be a short option (single char),
426 * or one char of a long option name,
427 * or one char of the option parameter.
429 if (curropt == NULL && len_cmdbuf() == 0)
431 int ret = mca_opt_first_char(c);
437 /* We're getting a long option name. */
438 if (!is_newline_char(c))
439 return (mca_opt_nonfirst_char(c));
442 parg.p_string = get_cmdbuf();
443 error("There is no --%s option", &parg);
450 if (is_erase_char(c))
453 /* We're getting the option parameter. */
455 curropt = findopt(c);
458 parg.p_string = propt(c);
459 error("There is no %s option", &parg);
464 * If the option which was entered does not take a
465 * parameter, toggle the option immediately,
466 * so user doesn't have to hit RETURN.
468 if ((optflag & ~OPT_NO_PROMPT) != OPT_TOGGLE ||
469 !opt_has_param(curropt))
471 toggle_option(curropt, ASCII_IS_LOWER(c), "", optflag);
475 * Display a prompt appropriate for the option parameter.
477 start_mca(A_OPT_TOGGLE, opt_prompt(curropt), (void*)NULL, 0);
482 * Handle a char of a search command.
491 * Certain characters as the first char of
492 * the pattern have special meaning:
493 * ! Toggle the NO_MATCH flag
494 * * Toggle the PAST_EOF flag
495 * @ Toggle the FIRST_FILE flag
497 if (len_cmdbuf() > 0)
502 case CONTROL('E'): /* ignore END of file */
505 flag = SRCH_PAST_EOF;
507 case CONTROL('F'): /* FIRST file */
510 flag = SRCH_FIRST_FILE;
512 case CONTROL('K'): /* KEEP position */
516 case CONTROL('R'): /* Don't use REGULAR EXPRESSIONS */
517 flag = SRCH_NO_REGEX;
519 case CONTROL('N'): /* NOT match */
521 flag = SRCH_NO_MATCH;
535 * Handle a character of a multi-character command.
547 * We're not in a multicharacter command.
553 * In the prefix of a command.
554 * This not considered a multichar command
555 * (even tho it uses cmdbuf, etc.).
556 * It is handled in the commands() switch.
562 * Entering digits of a number.
563 * Terminated by a non-digit.
565 if (!((c >= '0' && c <= '9') || c == '.') &&
566 editchar(c, EC_PEEK|EC_NOHISTORY|EC_NOCOMPLETE|EC_NORIGHTLEFT) == A_INVALID)
569 * Not part of the number.
570 * End the number and treat this char
571 * as a normal command character.
573 number = cmd_int(&fraction);
581 ret = mca_opt_char(c);
589 ret = mca_search_char(c);
595 /* Other multicharacter command. */
600 * The multichar command is terminated by a newline.
602 if (is_newline_char(c))
605 * Execute the command.
612 * Append the char to the command buffer.
614 if (cmd_char(c) == CC_QUIT)
616 * Abort the multi-char command.
620 if ((mca == A_F_BRACKET || mca == A_B_BRACKET) && len_cmdbuf() >= 2)
623 * Special case for the bracket-matching commands.
624 * Execute the command after getting exactly two
625 * characters from the user.
632 * Need another character.
638 * Discard any buffered file data.
643 if (!(ch_getflags() & CH_CANSEEK))
653 * Make sure the screen is displayed.
659 * If nothing is displayed yet, display starting from initial_scrpos.
663 if (initial_scrpos.pos == NULL_POSITION)
665 * {{ Maybe this should be:
666 * jump_loc(ch_zero(), jump_sline);
667 * but this behavior seems rather unexpected
668 * on the first screen. }}
670 jump_loc(ch_zero(), 1);
672 jump_loc(initial_scrpos.pos, initial_scrpos.ln);
673 } else if (screen_trashed)
675 int save_top_scroll = top_scroll;
676 int save_ignore_eoi = ignore_eoi;
679 if (screen_trashed == 2)
681 /* Special case used by ignore_eoi: re-open the input file
682 * and jump to the end of the file. */
687 top_scroll = save_top_scroll;
688 ignore_eoi = save_ignore_eoi;
693 * Display the appropriate prompt.
700 if (ungot != NULL && ungot->ug_char != CHAR_END_COMMAND)
703 * No prompt necessary if commands are from
704 * ungotten chars rather than from the user.
710 * Make sure the screen is displayed.
713 bottompos = position(BOTTOM_PLUS_ONE);
716 * If we've hit EOF on the last file and the -E flag is set, quit.
718 if (get_quit_at_eof() == OPT_ONPLUS &&
719 eof_displayed() && !(ch_getflags() & CH_HELPFILE) &&
720 next_ifile(curr_ifile) == NULL_IFILE)
724 * If the entire file is displayed and the -F flag is set, quit.
726 if (quit_if_one_screen &&
727 entire_file_displayed() && !(ch_getflags() & CH_HELPFILE) &&
728 next_ifile(curr_ifile) == NULL_IFILE)
731 #if MSDOS_COMPILER==WIN32C
733 * In Win32, display the file name in the window title.
735 if (!(ch_getflags() & CH_HELPFILE))
736 SetConsoleTitle(pr_expand("Less?f - %f.", 0));
739 * Select the proper prompt and display it.
742 * If the previous action was a forward movement,
743 * don't clear the bottom line of the display;
744 * just print the prompt since the forward movement guarantees
745 * that we're in the right position to display the prompt.
746 * Clearing the line could cause a problem: for example, if the last
747 * line displayed ended at the right screen edge without a newline,
748 * then clearing would clear the last displayed line rather than
758 if (p == NULL || *p == '\0')
762 at_enter(AT_STANDOUT);
770 * Display the less version message.
777 parg.p_string = version;
778 error("less %s", &parg);
782 * Return a character to complete a partial command, if possible.
790 /* We have a number but no command. Treat as #g. */
794 /* We have "/string" but no newline. Add the \n. */
797 /* Some other incomplete command. Let user complete it. */
803 * Get command character.
804 * The character normally comes from the keyboard,
805 * but may come from ungotten characters
806 * (characters previously given to ungetcc or ungetsc).
814 /* Normal case: no ungotten chars.
815 * Get char from the user. */
819 /* Ungotten chars available:
820 * Take the top of stack (most recent). */
821 struct ungot *ug = ungot;
826 if (c == CHAR_END_COMMAND)
827 c = getcc_end_command();
833 * Get a command character, but if we receive the orig sequence,
834 * convert it to the repl sequence.
837 getcc_repl(orig, repl, gr_getc, gr_ungetc)
840 LWCHAR (*gr_getc)(VOID_PARAM);
841 void (*gr_ungetc)(LWCHAR);
848 if (orig == NULL || orig[0] == '\0')
853 if (c != orig[ki] || ki >= sizeof(keys)-1)
855 /* This is not orig we have been receiving.
856 * If we have stashed chars in keys[],
857 * unget them and return the first one. */
859 (*gr_ungetc)(keys[ki--]);
862 if (orig[++ki] == '\0')
864 /* We've received the full orig sequence.
865 * Return the repl sequence. */
868 (*gr_ungetc)(repl[ki--]);
871 /* We've received a partial orig sequence (ki chars of it).
872 * Get next char and see if it continues to match orig. */
878 * Get command character.
883 /* Replace kent (keypad Enter) with a newline. */
884 return getcc_repl(kent, "\n", getccu, ungetcc);
888 * "Unget" a command character.
889 * The next getcc() will return this character.
895 struct ungot *ug = (struct ungot *) ecalloc(1, sizeof(struct ungot));
903 * Unget a whole string of command characters.
904 * The next sequence of getcc()'s will return this string.
912 for (p = s + strlen(s) - 1; p >= s; p--)
917 * Peek the next command character, without consuming it.
928 * Search for a pattern, possibly in multiple files.
929 * If SRCH_FIRST_FILE is set, begin searching at the first file.
930 * If SRCH_PAST_EOF is set, continue the search thru multiple files.
933 multi_search(pattern, n, silent)
943 save_ifile = save_curr_ifile();
945 if (search_type & SRCH_FIRST_FILE)
948 * Start at the first (or last) file
949 * in the command line list.
951 if (search_type & SRCH_FORW)
952 nomore = edit_first();
954 nomore = edit_last();
957 unsave_ifile(save_ifile);
961 search_type &= ~SRCH_FIRST_FILE;
966 n = search(search_type, pattern, n);
968 * The SRCH_NO_MOVE flag doesn't "stick": it gets cleared
969 * after being used once. This allows "n" to work after
970 * using a /@@ search.
972 search_type &= ~SRCH_NO_MOVE;
978 unsave_ifile(save_ifile);
984 * Some kind of error in the search.
985 * Error message has been printed by search().
989 if ((search_type & SRCH_PAST_EOF) == 0)
991 * We didn't find a match, but we're
992 * supposed to search only one file.
996 * Move on to the next file.
998 if (search_type & SRCH_FORW)
999 nomore = edit_next(1);
1001 nomore = edit_prev(1);
1009 * Print an error message if we haven't already.
1011 if (n > 0 && !silent)
1012 error("Pattern not found", NULL_PARG);
1017 * Restore the file we were originally viewing.
1019 reedit_ifile(save_ifile);
1022 unsave_ifile(save_ifile);
1027 * Forward forever, or until a highlighted line appears.
1030 forw_loop(until_hilite)
1035 if (ch_getflags() & CH_HELPFILE)
1036 return (A_NOACTION);
1039 jump_forw_buffered();
1040 curr_len = ch_length();
1041 highest_hilite = until_hilite ? curr_len : NULL_POSITION;
1045 if (until_hilite && highest_hilite > curr_len)
1057 * This gets us back in "F mode" after processing
1058 * a non-abort signal (e.g. window-change).
1060 if (sigs && !ABORT_SIGS())
1061 return (until_hilite ? A_F_UNTIL_HILITE : A_F_FOREVER);
1063 return (A_NOACTION);
1067 * Main command processor.
1068 * Accept and execute commands until a quit command.
1077 int save_search_type;
1085 search_type = SRCH_FORW;
1086 wscroll = (sc_height + 1) / 2;
1087 newaction = A_NOACTION;
1097 * See if any signals need processing.
1103 quit(QUIT_SAVED_STATUS);
1107 * See if window size changed, for systems that don't
1108 * generate SIGWINCH.
1113 * Display prompt and accept a character.
1119 if (newaction == A_NOACTION)
1126 if (newaction != A_NOACTION)
1129 newaction = A_NOACTION;
1133 * If we are in a multicharacter command, call mca_char.
1134 * Otherwise we call fcmd_decode to determine the
1135 * action to be performed.
1138 switch (mca_char(c))
1142 * Need another character.
1148 * Command has been handled by mca_char.
1149 * Start clean with a prompt.
1154 * Not a multi-char command
1155 * (at least, not anymore).
1161 * Decode the command character and decide what to do.
1166 * We're in a multichar command.
1167 * Add the character to the command buffer
1168 * and display it on the screen.
1169 * If the user backspaces past the start
1170 * of the line, abort the command.
1172 if (cmd_char(c) == CC_QUIT || len_cmdbuf() == 0)
1174 cbuf = get_cmdbuf();
1178 * Don't use cmd_char if we're starting fresh
1179 * at the beginning of a command, because we
1180 * don't want to echo the command until we know
1181 * it is a multichar command. We also don't
1182 * want erase_char/kill_char to be treated
1183 * as line editing characters.
1190 action = fcmd_decode(cbuf, &extra);
1192 * If an "extra" string was returned,
1193 * process it as a string of command characters.
1199 * Clear the cmdbuf string.
1200 * (But not if we're in the prefix of a command,
1201 * because the partial command string is kept there.)
1203 if (action != A_PREFIX)
1210 * First digit of a number.
1212 start_mca(A_DIGIT, ":", (void*)NULL, CF_QUIT_ON_ERASE);
1217 * Forward one window (and set the window size).
1220 swindow = (int) number;
1224 * Forward one screen.
1227 number = get_swindow();
1230 set_attnpos(bottompos);
1231 forward((int) number, 0, 1);
1236 * Backward one window (and set the window size).
1239 swindow = (int) number;
1243 * Backward one screen.
1246 number = get_swindow();
1248 backward((int) number, 0, 1);
1253 * Forward N (default 1) line.
1258 if (show_attn == OPT_ONPLUS && number > 1)
1259 set_attnpos(bottompos);
1260 forward((int) number, 0, 0);
1265 * Backward N (default 1) line.
1270 backward((int) number, 0, 0);
1275 * Force forward N (default 1) line.
1280 if (show_attn == OPT_ONPLUS && number > 1)
1281 set_attnpos(bottompos);
1282 forward((int) number, 1, 0);
1287 * Force backward N (default 1) line.
1292 backward((int) number, 1, 0);
1297 * Force forward one screen.
1300 number = get_swindow();
1302 if (show_attn == OPT_ONPLUS)
1303 set_attnpos(bottompos);
1304 forward((int) number, 1, 0);
1309 * Forward forever, ignoring EOF.
1312 set_attnpos(bottompos);
1313 newaction = forw_loop(0);
1316 case A_F_UNTIL_HILITE:
1317 newaction = forw_loop(1);
1323 * (default same as last 'd' or 'u' command).
1326 wscroll = (int) number;
1328 if (show_attn == OPT_ONPLUS)
1329 set_attnpos(bottompos);
1330 forward(wscroll, 0, 0);
1336 * (default same as last 'd' or 'u' command).
1339 wscroll = (int) number;
1341 backward(wscroll, 0, 0);
1346 * Flush buffers, then repaint screen.
1347 * Don't flush the buffers on a pipe!
1361 * Go to line N, default beginning of file.
1371 * Go to a specified percentage into the file.
1384 jump_percent((int) number, fraction);
1389 * Go to line N, default end of file.
1400 * Go to line N, default last buffered byte.
1404 jump_forw_buffered();
1411 * Go to a specified byte position in the file.
1416 jump_line_loc((POSITION) number, jump_sline);
1421 * Print file name, etc.
1423 if (ch_getflags() & CH_HELPFILE)
1426 parg.p_string = eq_message();
1432 * Print version number, without the "@(#)".
1442 if (curr_ifile != NULL_IFILE &&
1443 ch_getflags() & CH_HELPFILE)
1446 * Quit while viewing the help file
1447 * just means return to viewing the
1450 hshift = save_hshift;
1451 bs_mode = save_bs_mode;
1452 if (edit_prev(1) == 0)
1461 * Define abbreviation for a commonly used sequence below.
1463 #define DO_SEARCH() \
1464 if (number <= 0) number = 1; \
1467 multi_search((char *)NULL, (int) number, 0);
1472 * Search forward for a pattern.
1473 * Get the first char of the pattern.
1475 search_type = SRCH_FORW;
1484 * Search backward for a pattern.
1485 * Get the first char of the pattern.
1487 search_type = SRCH_BACK;
1496 search_type = SRCH_FORW | SRCH_FILTER;
1501 error("Command not available", NULL_PARG);
1505 case A_AGAIN_SEARCH:
1507 * Repeat previous search.
1512 case A_T_AGAIN_SEARCH:
1514 * Repeat previous search, multiple files.
1516 search_type |= SRCH_PAST_EOF;
1520 case A_REVERSE_SEARCH:
1522 * Repeat previous search, in reverse direction.
1524 save_search_type = search_type;
1525 search_type = SRCH_REVERSE(search_type);
1527 search_type = save_search_type;
1530 case A_T_REVERSE_SEARCH:
1532 * Repeat previous search,
1533 * multiple files in reverse direction.
1535 save_search_type = search_type;
1536 search_type = SRCH_REVERSE(search_type);
1537 search_type |= SRCH_PAST_EOF;
1539 search_type = save_search_type;
1544 * Clear search string highlighting.
1553 if (ch_getflags() & CH_HELPFILE)
1556 save_hshift = hshift;
1558 save_bs_mode = bs_mode;
1559 bs_mode = BS_SPECIAL;
1560 (void) edit(FAKE_HELPFILE);
1565 * Edit a new file. Get the filename.
1570 start_mca(A_EXAMINE, "Examine: ", ml_examine, 0);
1575 error("Command not available", NULL_PARG);
1580 * Invoke an editor on the input file.
1585 if (ch_getflags() & CH_HELPFILE)
1587 if (strcmp(get_filename(curr_ifile), "-") == 0)
1589 error("Cannot edit standard input", NULL_PARG);
1592 if (get_altfilename(curr_ifile) != NULL)
1594 error("WARNING: This file was viewed via LESSOPEN",
1597 start_mca(A_SHELL, "!", ml_shell, 0);
1599 * Expand the editor prototype string
1600 * and pass it to the system to execute.
1601 * (Make sure the screen is displayed so the
1602 * expansion of "+%lm" works.)
1606 lsystem(pr_expand(editproto, 0), (char*)NULL);
1610 error("Command not available", NULL_PARG);
1615 * Examine next file.
1620 error("No next file", NULL_PARG);
1626 if (edit_next((int) number))
1628 if (get_quit_at_eof() && eof_displayed() &&
1629 !(ch_getflags() & CH_HELPFILE))
1631 parg.p_string = (number > 1) ? "(N-th) " : "";
1632 error("No %snext file", &parg);
1638 * Examine previous file.
1643 error("No previous file", NULL_PARG);
1649 if (edit_prev((int) number))
1651 parg.p_string = (number > 1) ? "(N-th) " : "";
1652 error("No %sprevious file", &parg);
1658 * Jump to the next tag in the current tag list.
1663 tagfile = nexttag((int) number);
1664 if (tagfile == NULL)
1666 error("No next tag", NULL_PARG);
1670 if (edit(tagfile) == 0)
1672 POSITION pos = tagsearch();
1673 if (pos != NULL_POSITION)
1674 jump_loc(pos, jump_sline);
1677 error("Command not available", NULL_PARG);
1683 * Jump to the previous tag in the current tag list.
1688 tagfile = prevtag((int) number);
1689 if (tagfile == NULL)
1691 error("No previous tag", NULL_PARG);
1695 if (edit(tagfile) == 0)
1697 POSITION pos = tagsearch();
1698 if (pos != NULL_POSITION)
1699 jump_loc(pos, jump_sline);
1702 error("Command not available", NULL_PARG);
1708 * Examine a particular file.
1712 if (edit_index((int) number))
1713 error("No such file", NULL_PARG);
1718 * Remove a file from the input file list.
1720 if (ch_getflags() & CH_HELPFILE)
1722 old_ifile = curr_ifile;
1723 new_ifile = getoff_ifile(curr_ifile);
1724 if (new_ifile == NULL_IFILE)
1729 if (edit_ifile(new_ifile) != 0)
1731 reedit_ifile(old_ifile);
1734 del_ifile(old_ifile);
1739 * Change the setting of an option.
1741 optflag = OPT_TOGGLE;
1749 * Report the setting of an option.
1751 optflag = OPT_NO_TOGGLE;
1759 * Set an initial command for new files.
1761 start_mca(A_FIRSTCMD, "+", (void*)NULL, 0);
1772 start_mca(A_SHELL, "!", ml_shell, 0);
1777 error("Command not available", NULL_PARG);
1785 if (ch_getflags() & CH_HELPFILE)
1787 start_mca(A_SETMARK, "set mark: ", (void*)NULL, 0);
1789 if (is_erase_char(c) || is_newline_char(c))
1791 setmark(c, action == A_SETMARKBOT ? BOTTOM : TOP);
1799 start_mca(A_CLRMARK, "clear mark: ", (void*)NULL, 0);
1801 if (is_erase_char(c) || is_newline_char(c))
1809 * Jump to a marked position.
1811 start_mca(A_GOMARK, "goto mark: ", (void*)NULL, 0);
1813 if (is_erase_char(c) || is_newline_char(c))
1821 * Write part of the input to a pipe to a shell command.
1826 start_mca(A_PIPE, "|mark: ", (void*)NULL, 0);
1828 if (is_erase_char(c))
1830 if (is_newline_char(c))
1835 start_mca(A_PIPE, "!", ml_shell, 0);
1840 error("Command not available", NULL_PARG);
1845 start_mca(action, "Brackets: ", (void*)NULL, 0);
1854 shift_count = number;
1856 number = (shift_count > 0) ?
1857 shift_count : sc_width / 2;
1858 if (number > hshift)
1869 shift_count = number;
1871 number = (shift_count > 0) ?
1872 shift_count : sc_width / 2;
1879 * Shift view left to margin.
1887 * Shift view right to view rightmost char on screen.
1895 * The command is incomplete (more chars are needed).
1896 * Display the current char, so the user knows
1897 * what's going on, and get another character.
1899 if (mca != A_PREFIX)
1902 start_mca(A_PREFIX, " ", (void*)NULL,