From 784a2ea862fb824a6f76191591590689fc704ac8 Mon Sep 17 00:00:00 2001 From: James Booth Date: Fri, 30 Jan 2015 23:44:17 +0000 Subject: [PATCH] Removed commented code --- src/ui/inputwin.c | 216 ---------------------------------------------- 1 file changed, 216 deletions(-) diff --git a/src/ui/inputwin.c b/src/ui/inputwin.c index d669f67b..501ae95f 100644 --- a/src/ui/inputwin.c +++ b/src/ui/inputwin.c @@ -165,13 +165,6 @@ void inp_write(char *line, int offset) { int col = offset_to_col(line, offset); - - cons_debug("LEN BYTES: %d", strlen(line)); - cons_debug("LEN UTF8 : %d", g_utf8_strlen(line, -1)); - cons_debug("OFFSET : %d", offset); - cons_debug("COL : %d", col); - cons_debug(""); - werase(inp_win); waddstr(inp_win, line); wmove(inp_win, 0, col); @@ -218,69 +211,6 @@ inp_close(void) rl_callback_handler_remove(); } -//char * -//inp_read(int *key_type, wint_t *ch) -//{ -// // echo off, and get some more input -// noecho(); -// *key_type = wget_wch(inp_win, ch); -// -// int bytes_len = strlen(line); -// -// gboolean in_command = FALSE; -// if ((bytes_len > 0 && line[0] == '/') || -// (bytes_len == 0 && *ch == '/')) { -// in_command = TRUE; -// } -// -// if (*key_type == ERR) { -// prof_handle_idle(); -// } -// if ((*key_type != ERR) && (*key_type != KEY_CODE_YES) && !in_command && utf8_is_printable(*ch)) { -// prof_handle_activity(); -// } -// -// // if it wasn't an arrow key etc -// if (!_handle_edit(*key_type, *ch)) { -// if (utf8_is_printable(*ch) && *key_type != KEY_CODE_YES) { -// if (bytes_len >= INP_WIN_MAX) { -// *ch = ERR; -// return NULL; -// } -// -// int col = getcurx(inp_win); -// int maxx = getmaxx(stdscr); -// key_printable(line, &line_utf8_pos, &col, &pad_start, *ch, maxx); -// -// werase(inp_win); -// waddstr(inp_win, line); -// wmove(inp_win, 0, col); -// _inp_win_update_virtual(); -// -// cmd_reset_autocomplete(); -// } -// } -// -// echo(); -// -// char *result = NULL; -// if (*ch == '\n') { -// result = strdup(line); -// line[0] = '\0'; -// line_utf8_pos = 0; -// } -// -// if (*ch != ERR && *key_type != ERR) { -// cons_debug("BYTE LEN = %d", strlen(line)); -// cons_debug("UTF8 LEN = %d", utf8_display_len(line)); -// cons_debug("CURR COL = %d", getcurx(inp_win)); -// cons_debug("CURR UNI = %d", line_utf8_pos); -// cons_debug(""); -// } -// -// return result; -//} - void inp_get_password(char *passwd) { @@ -315,152 +245,6 @@ inp_win_clear(void) _inp_win_update_virtual(); } -/* - * Deal with command editing, return 1 if ch was an edit - * key press: up, down, left, right or backspace - * return 0 if it wasn't - */ -//static int -//_handle_edit(int key_type, const wint_t ch) -//{ -// // ALT-LEFT -// if ((key_type == KEY_CODE_YES) && (ch == 537 || ch == 542)) { -// ui_previous_win(); -// return 1; -// -// // ALT-RIGHT -// } else if ((key_type == KEY_CODE_YES) && (ch == 552 || ch == 557)) { -// ui_next_win(); -// return 1; -// -// // other editing keys -// } else { -// int bytes_len = strlen(line); -// int next_ch; -// -// switch(ch) { -// -// case 27: // ESC -// // check for ALT-key -// next_ch = wgetch(inp_win); -// if (next_ch != ERR) { -// return _handle_alt_key(next_ch); -// } else { -// werase(inp_win); -// wmove(inp_win, 0, 0); -// pad_start = 0; -// line[0] = '\0'; -// line_utf8_pos = 0; -// _inp_win_update_virtual(); -// return 1; -// } -// -// case 9: // tab -// if (bytes_len != 0) { -// line[bytes_len] = '\0'; -// if ((strncmp(line, "/", 1) != 0) && (ui_current_win_type() == WIN_MUC)) { -// char *result = muc_autocomplete(line); -// if (result) { -// werase(inp_win); -// wmove(inp_win, 0, 0); -// pad_start = 0; -// line[0] = '\0'; -// line_utf8_pos = 0; -// strncpy(line, result, INP_WIN_MAX); -// waddstr(inp_win, line); -// -// int display_len = utf8_display_len(line); -// wmove(inp_win, 0, display_len); -// line_utf8_pos = g_utf8_strlen(line, -1); -// -// int wcols = getmaxx(stdscr); -// if (display_len > wcols-2) { -// pad_start = display_len - wcols + 1; -// _inp_win_update_virtual(); -// } -// -// free(result); -// } -// } else if (strncmp(line, "/", 1) == 0) { -// char *result = cmd_autocomplete(line); -// if (result) { -// werase(inp_win); -// wmove(inp_win, 0, 0); -// pad_start = 0; -// line[0] = '\0'; -// line_utf8_pos = 0; -// strncpy(line, result, INP_WIN_MAX); -// waddstr(inp_win, line); -// -// int display_len = utf8_display_len(line); -// wmove(inp_win, 0, display_len); -// line_utf8_pos = g_utf8_strlen(line, -1); -// -// int wcols = getmaxx(stdscr); -// if (display_len > wcols-2) { -// pad_start = display_len - wcols + 1; -// _inp_win_update_virtual(); -// } -// -// free(result); -// } -// } -// } -// return 1; -// -// default: -// return 0; -// } -// } -//} - -//static int -//_handle_alt_key(int key) -//{ -// switch (key) -// { -// case '1': -// ui_switch_win(1); -// break; -// case '2': -// ui_switch_win(2); -// break; -// case '3': -// ui_switch_win(3); -// break; -// case '4': -// ui_switch_win(4); -// break; -// case '5': -// ui_switch_win(5); -// break; -// case '6': -// ui_switch_win(6); -// break; -// case '7': -// ui_switch_win(7); -// break; -// case '8': -// ui_switch_win(8); -// break; -// case '9': -// ui_switch_win(9); -// break; -// case '0': -// ui_switch_win(0); -// break; -// case KEY_LEFT: -// ui_previous_win(); -// break; -// case KEY_RIGHT: -// ui_next_win(); -// break; -// default: -// break; -// } -// return 1; -//} -// static void _inp_win_update_virtual(void) {