<commit_before>diff --git a/llwe.c b/llwe.c
index 48598c9..01e33be 100644
--- a/llwe.c
+++ b/llwe.c
@@ -121,7 +121,7 @@ loop:	if (isend(end))
 	if (c == 0)
 		r++;
 	end++;
-	if (r < LINES)
+	if (r < LINES - 1)
 		goto loop;
 	else
 		end--;
@@ -256,7 +256,7 @@ static int insertmode(char *t)
 			c = '\n';
 		if (c == C_D)
 			return 1;
-		if (c == KEY_BACKSPACE) {
+		if (c == '\b' || c == 127) {
 			if (t <= buffer)
 				continue;
 			t--;
@@ -294,14 +294,10 @@ static int cmdloop(void)
 		c = getch();
 		switch (c) {
 		case C_D:
-		case KEY_DOWN:
-		case KEY_NPAGE:
 		case 'j':
 			doscrl(LINES / 2);
 			break;
 		case C_U:
-		case KEY_UP:
-		case KEY_PPAGE:
 		case 'k':
 			doscrl(-LINES / 2);
 			break;
@@ -370,8 +366,6 @@ int main(int argc, char **argv)
 		cbreak();
 		noecho();
 		nonl();
-		intrflush(stdscr, FALSE);
-		keypad(stdscr, TRUE);
 		filename = argv[1];
 		ed();
 		endwin();
diff --git a/vms.patch b/vms.patch
index cda4e57..e69de29 100644
--- a/vms.patch
+++ b/vms.patch
@@ -1,37 +0,0 @@
-diff --git a/llwe.c b/llwe.c
-index 48598c9..f402e47 100644
---- a/llwe.c
-+++ b/llwe.c
-@@ -256,7 +256,7 @@ static int insertmode(char *t)
- 			c = '\n';
- 		if (c == C_D)
- 			return 1;
--		if (c == KEY_BACKSPACE) {
-+		if (c == '\b') {
- 			if (t <= buffer)
- 				continue;
- 			t--;
-@@ -294,14 +294,10 @@ static int cmdloop(void)
- 		c = getch();
- 		switch (c) {
- 		case C_D:
--		case KEY_DOWN:
--		case KEY_NPAGE:
- 		case 'j':
- 			doscrl(LINES / 2);
- 			break;
- 		case C_U:
--		case KEY_UP:
--		case KEY_PPAGE:
- 		case 'k':
- 			doscrl(-LINES / 2);
- 			break;
-@@ -370,8 +366,6 @@ int main(int argc, char **argv)
- 		cbreak();
- 		noecho();
- 		nonl();
--		intrflush(stdscr, FALSE);
--		keypad(stdscr, TRUE);
- 		filename = argv[1];
- 		ed();
- 		endwin();<commit_msg>Cleaning up vms patch<commit_after>diff --git a/llwe.c b/llwe.c
index 48598c9..01e33be 100644
--- a/llwe.c
+++ b/llwe.c
@@ -121,7 +121,7 @@ loop:	if (isend(end))
 	if (c == 0)
 		r++;
 	end++;
-	if (r < LINES)
+	if (r < LINES - 1)
 		goto loop;
 	else
 		end--;
@@ -256,7 +256,7 @@ static int insertmode(char *t)
 			c = '\n';
 		if (c == C_D)
 			return 1;
-		if (c == KEY_BACKSPACE) {
+		if (c == '\b' || c == 127) {
 			if (t <= buffer)
 				continue;
 			t--;
@@ -294,14 +294,10 @@ static int cmdloop(void)
 		c = getch();
 		switch (c) {
 		case C_D:
-		case KEY_DOWN:
-		case KEY_NPAGE:
 		case 'j':
 			doscrl(LINES / 2);
 			break;
 		case C_U:
-		case KEY_UP:
-		case KEY_PPAGE:
 		case 'k':
 			doscrl(-LINES / 2);
 			break;
@@ -370,8 +366,6 @@ int main(int argc, char **argv)
 		cbreak();
 		noecho();
 		nonl();
-		intrflush(stdscr, FALSE);
-		keypad(stdscr, TRUE);
 		filename = argv[1];
 		ed();
 		endwin();
{'fraction_non_alphanumeric': 0.21769456681350954, 'fraction_numerical': 0.0671806167400881, 'mean_word_length': 2.190866510538642, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '849481', 'n_tokens_mistral': 1569, 'n_tokens_neox': 1341, 'n_words': 305}