Skip to content

Commit

Permalink
Revert "WIP: Refactor"
Browse files Browse the repository at this point in the history
This reverts commit 8d6f2c7.
  • Loading branch information
magicant committed Apr 16, 2024
1 parent 2ebed7d commit 76dfa0e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions input.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,20 +254,16 @@ inputresult_T input_interactive(struct xwcsbuf_T *buf, void *inputinfo)

// FIXME

#if YASH_ENABLE_HISTORY
size_t oldbuflen = buf->length;
#endif
wchar_t *line;
inputresult_T result;

#if YASH_ENABLE_LINEEDIT
/* read a line using line editing */
if (info->fileinfo->fd == STDIN_FILENO
&& shopt_lineedit != SHOPT_NOLINEEDIT) {
wchar_t *line;
result = le_readline(prompt, true, &line);
switch (result) {
case INPUT_OK:
wb_catfree(buf, line);
goto success;
case INPUT_EOF:
case INPUT_INTERRUPTED:
Expand All @@ -282,7 +278,10 @@ inputresult_T input_interactive(struct xwcsbuf_T *buf, void *inputinfo)
print_prompt(prompt.main);
print_prompt(prompt.styler);

result = input_file(buf, info->fileinfo);
xwcsbuf_T linebuf;
wb_init(&linebuf);
result = input_file(&linebuf, info->fileinfo);
line = wb_towcs(&linebuf);

print_prompt(PROMPT_RESET);

Expand All @@ -292,8 +291,9 @@ inputresult_T input_interactive(struct xwcsbuf_T *buf, void *inputinfo)
if (info->prompttype == 1)
info->prompttype = 2;
#if YASH_ENABLE_HISTORY
add_history(&buf->contents[oldbuflen]);
add_history(line);
#endif
wb_catfree(buf, line);
#if YASH_ENABLE_LINEEDIT
done:
#endif
Expand Down

0 comments on commit 76dfa0e

Please sign in to comment.