rem: case 68:
add: case 'D':
context: read_line(char *buf, int max_len){	char c;	int position = 0;	bool done = false;	int cur_history_spot = cur_line;	char (*readChar)(void);	if (sBlueScreenEnabled)		readChar = blue_screen_getchar;	else		readChar = arch_debug_serial_getchar;	while (!done) {		c = readChar();		switch (c) {			case '\n':			case '\r':				buf[position++] = '\0';				kputchar('\n');				done = true;				break;			case 8: // backspace				if (position > 0) {					kputs("\x1b[1D"); // move to the left one					kputchar(' ');					kputs("\x1b[1D"); // move to the left one					position--;				}				break;			case 27: // escape sequence				c = readChar(); // should be '['				c = readChar();				switch (c) {					case 67: // right arrow acts like space						buf[position++] = ' ';						kputchar(' ');						break;					case 68: // left arrow acts like backspace						if (position > 0) {							kputs("\x1b[1D"); // move to the left one							kputchar(' ');							kputs("\x1b[1D"); // move to the left one							position--;						}						break;					case 65: // up arrow					case 66: // down arrow					{						int history_line = 0;//						dprintf("1c %d h %d ch %d\n", cur_line, history_line, cur_history_spot);						if (c == 65) {							// up arrow							history_line = cur_history_spot - 1;							if (history_line < 0)								history_line = HISTORY_SIZE - 1;						} else {							// down arrow							if (cur_history_spot != cur_line) {								history_line = cur_history_spot + 1;								if (history_line >= HISTORY_SIZE)									history_line = 0;							} else								break; // nothing to do here						}//						dprintf("2c %d h %d ch %d\n", cur_line, history_line, cur_history_spot);						// swap the current line with something from the history						if (position > 0)							kprintf("\x1b[%dD", position); // move to beginning of line						strcpy(buf, line_buf[history_line]);						position = strlen(buf);						kprintf("%s\x1b[K", buf); // print the line and clear the rest						cur_history_spot = history_line;						break;					}					default:						break;				}				break;			case '$':			case '+':				if (!sBlueScreenEnabled) {					/* HACK ALERT!!!					 *					 * If we get a $ at the beginning of the line					 * we assume we are talking with GDB					 */					if (position == 0) {						strcpy(buf, "gdb");						position = 4;						done = true;						break;					} 				}				/* supposed to fall through */			default:				buf[position++] = c;				kputchar(c);		}		if (position >= max_len - 2) {			buf[position++] = '\0';			kputchar('\n');			done = true;			break;		}	}	return position;}