MCPcopy Create free account
hub / github.com/gwsw/less / prompt

Function prompt

command.c:752–843  ·  view source on GitHub ↗

* Display the appropriate prompt. */

Source from the content-addressed store, hash-verified

750 * Display the appropriate prompt.
751 */
752 static void
753prompt(VOID_PARAM)
754{
755 constant char *p;
756
757 if (ungot != NULL && ungot->ug_char != CHAR_END_COMMAND)
758 {
759 /*
760 * No prompt necessary if commands are from
761 * ungotten chars rather than from the user.
762 */
763 return;
764 }
765
766 /*
767 * Make sure the screen is displayed.
768 */
769 make_display();
770 bottompos = position(BOTTOM_PLUS_ONE);
771
772 /*
773 * If we've hit EOF on the last file and the -E flag is set, quit.
774 */
775 if (get_quit_at_eof() == OPT_ONPLUS &&
776 eof_displayed() && !(ch_getflags() & CH_HELPFILE) &&
777 next_ifile(curr_ifile) == NULL_IFILE)
778 quit(QUIT_OK);
779
780 /*
781 * If the entire file is displayed and the -F flag is set, quit.
782 */
783 if (quit_if_one_screen &&
784 entire_file_displayed() && !(ch_getflags() & CH_HELPFILE) &&
785 next_ifile(curr_ifile) == NULL_IFILE)
786 quit(QUIT_OK);
787
788#if MSDOS_COMPILER==WIN32C
789 /*
790 * In Win32, display the file name in the window title.
791 */
792 if (!(ch_getflags() & CH_HELPFILE))
793 {
794 WCHAR w[MAX_PATH+16];
795 p = pr_expand("Less?f - %f.", 0);
796 MultiByteToWideChar(CP_ACP, 0, p, -1, w, sizeof(w)/sizeof(*w));
797 SetConsoleTitleW(w);
798 }
799#endif
800
801 /*
802 * Select the proper prompt and display it.
803 */
804 /*
805 * If the previous action was a forward movement,
806 * don't clear the bottom line of the display;
807 * just print the prompt since the forward movement guarantees
808 * that we're in the right position to display the prompt.
809 * Clearing the line could cause a problem: for example, if the last

Callers 1

commandsFunction · 0.85

Calls 15

make_displayFunction · 0.85
positionFunction · 0.85
get_quit_at_eofFunction · 0.85
eof_displayedFunction · 0.85
ch_getflagsFunction · 0.85
next_ifileFunction · 0.85
quitFunction · 0.85
entire_file_displayedFunction · 0.85
clear_botFunction · 0.85
clear_cmdFunction · 0.85
pr_stringFunction · 0.85
is_filteringFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…