mirror of
				https://github.com/janet-lang/janet
				synced 2025-10-31 15:43:01 +00:00 
			
		
		
		
	Use stderr for getline output instead of stdout.
This commit is contained in:
		| @@ -67,7 +67,7 @@ void janet_line_deinit() { | |||||||
| } | } | ||||||
|  |  | ||||||
| void janet_line_get(const char *p, JanetBuffer *buffer) { | void janet_line_get(const char *p, JanetBuffer *buffer) { | ||||||
|     FILE *out = janet_dynfile("out", stdout); |     FILE *out = janet_dynfile("err", stderr); | ||||||
|     fputs(p, out); |     fputs(p, out); | ||||||
|     fflush(out); |     fflush(out); | ||||||
|     simpleline(buffer); |     simpleline(buffer); | ||||||
| @@ -492,16 +492,16 @@ static void kshowcomp(void) { | |||||||
|         if (cols == 0) cols = 1; |         if (cols == 0) cols = 1; | ||||||
|         int current_col = 0; |         int current_col = 0; | ||||||
|         for (int i = 0; i < gbl_match_count; i++) { |         for (int i = 0; i < gbl_match_count; i++) { | ||||||
|             if (current_col == 0) putc('\n', stdout); |             if (current_col == 0) putc('\n', stderr); | ||||||
|             JanetByteView s = gbl_matches[i]; |             JanetByteView s = gbl_matches[i]; | ||||||
|             printf("%s", (const char *) s.bytes); |             fprintf(stderr, "%s", (const char *) s.bytes); | ||||||
|             for (int j = s.len; j < col_width; j++) { |             for (int j = s.len; j < col_width; j++) { | ||||||
|                 putc(' ', stdout); |                 putc(' ', stderr); | ||||||
|             } |             } | ||||||
|             current_col = (current_col + 1) % cols; |             current_col = (current_col + 1) % cols; | ||||||
|         } |         } | ||||||
|         putc('\n', stdout); |         putc('\n', stderr); | ||||||
|         fflush(stdout); |         fflush(stderr); | ||||||
|  |  | ||||||
|         rawmode(); |         rawmode(); | ||||||
|     } |     } | ||||||
| @@ -665,7 +665,7 @@ void janet_line_get(const char *p, JanetBuffer *buffer) { | |||||||
|     gbl_prompt = p; |     gbl_prompt = p; | ||||||
|     buffer->count = 0; |     buffer->count = 0; | ||||||
|     gbl_historyi = 0; |     gbl_historyi = 0; | ||||||
|     FILE *out = janet_dynfile("out", stdout); |     FILE *out = janet_dynfile("err", stderr); | ||||||
|     if (!isatty(STDIN_FILENO) || !checktermsupport()) { |     if (!isatty(STDIN_FILENO) || !checktermsupport()) { | ||||||
|         simpleline(buffer); |         simpleline(buffer); | ||||||
|         return; |         return; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Calvin Rose
					Calvin Rose