Changes in uspace/app/edit/edit.c [b67c7d64:1352fc1] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/edit/edit.c
rb67c7d64 r1352fc1 102 102 #define ED_INFTY 65536 103 103 104 /** Maximum filename length that can be entered. */105 #define INFNAME_MAX_LEN 128106 107 104 static void key_handle_unmod(console_event_t const *ev); 108 105 static void key_handle_ctrl(console_event_t const *ev); … … 334 331 } 335 332 333 #define INPUT_MAX_LEN 64 334 336 335 /** Ask for a file name. */ 337 336 static char *filename_prompt(char const *prompt, char const *init_value) … … 339 338 console_event_t ev; 340 339 char *str; 341 wchar_t buffer[INFNAME_MAX_LEN + 1]; 342 int max_len; 340 wchar_t buffer[INPUT_MAX_LEN + 1]; 343 341 int nc; 344 342 bool done; … … 351 349 console_set_color(con, COLOR_WHITE, COLOR_BLACK, 0); 352 350 353 max_len = min(INFNAME_MAX_LEN, scr_columns - 4 - str_length(prompt)); 354 str_to_wstr(buffer, max_len + 1, init_value); 351 str_to_wstr(buffer, INPUT_MAX_LEN + 1, init_value); 355 352 nc = wstr_length(buffer); 356 353 done = false; … … 379 376 break; 380 377 default: 381 if (ev.c >= 32 && nc < max_len) {378 if (ev.c >= 32 && nc < INPUT_MAX_LEN) { 382 379 putchar(ev.c); 383 380 fflush(stdout); … … 391 388 392 389 buffer[nc] = '\0'; 393 str = wstr_to_astr(buffer); 390 391 str = malloc(STR_BOUNDS(wstr_length(buffer)) + 1); 392 if (str == NULL) 393 return NULL; 394 395 wstr_nstr(str, buffer, STR_BOUNDS(wstr_length(buffer)) + 1); 394 396 395 397 console_set_color(con, COLOR_BLACK, COLOR_WHITE, 0);
Note:
See TracChangeset
for help on using the changeset viewer.