1
0
mirror of https://github.com/janet-lang/janet synced 2024-06-17 10:49:56 +00:00

Add history first and history last shortcuts.

Alt-, and Alt-.
This commit is contained in:
Calvin Rose 2020-01-19 15:43:47 -06:00
parent 693c6d63d4
commit 68a5667a1a
2 changed files with 8 additions and 3 deletions

View File

@ -19,7 +19,8 @@ All notable changes to this project will be documented in this file.
- Add `assert` - Add `assert`
- Add `when-with` - Add `when-with`
- Add `if-with` - Add `if-with`
- Add completion to the default repl based on currently defined bindings. - Add completion to the default repl based on currently defined bindings. Also generally improve
the repl keybindings.
- Add `eachk` - Add `eachk`
- Add `eachp` - Add `eachp`
- Improve functionality of the `next` function. `next` now works on many different - Improve functionality of the `next` function. `next` now works on many different

View File

@ -280,10 +280,8 @@ static void historymove(int delta) {
gbl_historyi += delta; gbl_historyi += delta;
if (gbl_historyi < 0) { if (gbl_historyi < 0) {
gbl_historyi = 0; gbl_historyi = 0;
return;
} else if (gbl_historyi >= gbl_history_count) { } else if (gbl_historyi >= gbl_history_count) {
gbl_historyi = gbl_history_count - 1; gbl_historyi = gbl_history_count - 1;
return;
} }
strncpy(gbl_buf, gbl_history[gbl_historyi], JANET_LINE_MAX - 1); strncpy(gbl_buf, gbl_history[gbl_historyi], JANET_LINE_MAX - 1);
gbl_pos = gbl_len = strlen(gbl_buf); gbl_pos = gbl_len = strlen(gbl_buf);
@ -720,6 +718,12 @@ static int line() {
case 'f': case 'f':
krightw(); krightw();
break; break;
case ',':
historymove(JANET_HISTORY_MAX);
break;
case '.':
historymove(-JANET_HISTORY_MAX);
break;
} }
} }
break; break;