comparison src/input.cc @ 1358:dc9c01f66a19

[project @ 1995-09-05 21:10:01 by jwe]
author jwe
date Tue, 05 Sep 1995 21:12:04 +0000
parents 19c10b8657d5
children ed5757e3333b
comparison
equal deleted inserted replaced
1357:749071f48336 1358:dc9c01f66a19
316 { 316 {
317 char t_string[MAXPATHLEN]; 317 char t_string[MAXPATHLEN];
318 #define EFFICIENT 318 #define EFFICIENT
319 #ifdef EFFICIENT 319 #ifdef EFFICIENT
320 320
321 // Use the value of PWD because it is much more effecient. 321 // Use the value of PWD because it is much more
322 // effecient.
322 323
323 temp = user_pref.pwd; 324 temp = user_pref.pwd;
324 325
325 if (! temp) 326 if (! temp)
326 octave_getcwd (t_string, MAXPATHLEN); 327 octave_getcwd (t_string, MAXPATHLEN);
417 result[result_index] = '\0'; 418 result[result_index] = '\0';
418 } 419 }
419 } 420 }
420 421
421 #if 0 422 #if 0
422 // I don't really think that this is a good idea. Do you? 423 // I don't really think that this is a good idea. Do you?
424
423 if (! find_variable ("NO_PROMPT_VARS")) 425 if (! find_variable ("NO_PROMPT_VARS"))
424 { 426 {
425 WORD_LIST *expand_string (), *list; 427 WORD_LIST *expand_string (), *list;
426 char *string_list (); 428 char *string_list ();
427 429
561 if (reading_fcn_file || reading_script_file) 563 if (reading_fcn_file || reading_script_file)
562 curr_stream = ff_instream; 564 curr_stream = ff_instream;
563 565
564 assert (curr_stream); 566 assert (curr_stream);
565 567
566 // Why is this required? 568 // Why is this required?
567 buf[0] = '\0'; 569 buf[0] = '\0';
568 570
569 if (fgets (buf, max_size, curr_stream)) 571 if (fgets (buf, max_size, curr_stream))
570 { 572 {
571 int len = strlen (buf); 573 int len = strlen (buf);
878 h = current_history (); 880 h = current_history ();
879 if (h) 881 if (h)
880 { 882 {
881 rl_insert_text (h->line); 883 rl_insert_text (h->line);
882 884
883 // Get rid of any undo list created by the previous insert, so the 885 // Get rid of any undo list created by the previous
884 // line won't totally be erased when the edits are undone (they will 886 // insert, so the line won't totally be erased when the
885 // be normally, because this is a history line -- cf. readline.c: 887 // edits are undone (they will be normally, because this
886 // line 380 or so). 888 // is a history line -- cf. readline.c: line 380 or
889 // so).
890
887 if (rl_undo_list) 891 if (rl_undo_list)
888 { 892 {
889 free_undo_list (); 893 free_undo_list ();
890 rl_undo_list = 0; 894 rl_undo_list = 0;
891 } 895 }
900 operate_and_get_next (int count, int c) 904 operate_and_get_next (int count, int c)
901 { 905 {
902 int where; 906 int where;
903 extern int history_stifled, history_length, max_input_history; 907 extern int history_stifled, history_length, max_input_history;
904 908
905 // Accept the current line. 909 // Accept the current line.
910
906 rl_newline (); 911 rl_newline ();
907 912
908 // Find the current line, and find the next line to use. 913 // Find the current line, and find the next line to use.
914
909 where = where_history (); 915 where = where_history ();
910 916
911 if (history_stifled && (history_length >= max_input_history)) 917 if (history_stifled && (history_length >= max_input_history))
912 saved_history_line_to_use = where; 918 saved_history_line_to_use = where;
913 else 919 else
918 } 924 }
919 925
920 void 926 void
921 initialize_readline (void) 927 initialize_readline (void)
922 { 928 {
923 // Allow conditional parsing of the ~/.inputrc file 929 // Allow conditional parsing of the ~/.inputrc file
930
924 rl_readline_name = "Octave"; 931 rl_readline_name = "Octave";
925 932
926 // Tell the completer that we want to try first. 933 // Tell the completer that we want to try first.
934
927 rl_attempted_completion_function = (CPPFunction *) command_completer; 935 rl_attempted_completion_function = (CPPFunction *) command_completer;
928 936
929 // Bind operate-and-get-next. 937 // Bind operate-and-get-next.
938
930 rl_add_defun ("operate-and-get-next", 939 rl_add_defun ("operate-and-get-next",
931 (Function *) operate_and_get_next, CTRL ('O')); 940 (Function *) operate_and_get_next, CTRL ('O'));
932 } 941 }
933 942
934 static int 943 static int