From 6c8630a7ff8af9f01fdeb79c99fa360d29b0c293 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 15 Jun 2022 18:14:06 -0700 Subject: Regression: command histories conflated. --- pw.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'pw.c') diff --git a/pw.c b/pw.c index b675a4d..ff4b352 100644 --- a/pw.c +++ b/pw.c @@ -1887,10 +1887,10 @@ int main(int argc, char **argv) if (ch == CR) { int count = (cmdcount == INT_MAX) ? 0 : cmdcount; if (pw.cmdbuf[1]) { - int *pnhist = (kbd_state == kbd_lcmd ? &ncmdhist : &npathist); + int iscolon = pw.cmdbuf[0] == ':'; + int *pnhist = (iscolon ? &ncmdhist : &npathist); int nhist = *pnhist; - char ***hist = (kbd_state == kbd_lcmd ? - &cmdhist : &pathist); + char ***hist = (iscolon ? &cmdhist : &pathist); if (nhist == 0 || strcmp(pw.cmdbuf, (*hist)[0]) != 0) { if ((*hist = resizebuf(*hist, nhist, nhist + 1)) == 0) @@ -1977,8 +1977,9 @@ int main(int argc, char **argv) case ctrl('p'): case ctrl('n'): { - int nhist = (kbd_state == kbd_lcmd ? ncmdhist : npathist); - char ***hist = (kbd_state == kbd_lcmd ? &cmdhist : &pathist); + int iscolon = pw.cmdbuf[0] == ':'; + int nhist = (iscolon ? ncmdhist : npathist); + char ***hist = (iscolon ? &cmdhist : &pathist); if (ch == ctrl('p')) { if (histpos == 0) { -- cgit v1.2.3