comparison nnchat.c @ 45:ceec75116aa7

Improved editing commands ctrl+<left/right>
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 28 Oct 2008 00:33:10 +0200
parents 40ba8cdcf03a
children 65b1ac6a1e2e
comparison
equal deleted inserted replaced
44:dfe6b835a745 45:ceec75116aa7
1073 int histPos = 0, histMax = 0; 1073 int histPos = 0, histMax = 0;
1074 1074
1075 memset(histBuf, 0, sizeof(histBuf)); 1075 memset(histBuf, 0, sizeof(histBuf));
1076 1076
1077 /* Initialize */ 1077 /* Initialize */
1078 th_init("NNChat", "Newbie Nudes chat client", "0.6.1", 1078 th_init("NNChat", "Newbie Nudes chat client", "0.6.2",
1079 "Written and designed by Anonymous Finnish Guy (C) 2008", 1079 "Written and designed by Anonymous Finnish Guy (C) 2008",
1080 "This software is freeware, use and distribute as you wish."); 1080 "This software is freeware, use and distribute as you wish.");
1081 th_verbosityLevel = 0; 1081 th_verbosityLevel = 0;
1082 1082
1083 /* Parse arguments */ 1083 /* Parse arguments */
1308 update = TRUE; 1308 update = TRUE;
1309 } 1309 }
1310 break; 1310 break;
1311 1311
1312 case 0x204: /* ctrl+left */ 1312 case 0x204: /* ctrl+left */
1313 editBuf->pos--; 1313 while (editBuf->pos > 0 && isspace(editBuf->data[editBuf->pos - 1]))
1314 while (editBuf->pos > 0 && !isspace(editBuf->data[editBuf->pos]))
1315 editBuf->pos--; 1314 editBuf->pos--;
1316 if (editBuf->pos < 0) 1315 while (editBuf->pos > 0 && !isspace(editBuf->data[editBuf->pos - 1]))
1317 editBuf->pos = 0; 1316 editBuf->pos--;
1318 update = TRUE; 1317 update = TRUE;
1319 break; 1318 break;
1320 1319
1321 case 0x206: /* ctrl+right */ 1320 case 0x206: /* ctrl+right */
1322 editBuf->pos++; 1321 while (editBuf->pos < editBuf->len && isspace(editBuf->data[editBuf->pos]))
1322 editBuf->pos++;
1323 while (editBuf->pos < editBuf->len && !isspace(editBuf->data[editBuf->pos])) 1323 while (editBuf->pos < editBuf->len && !isspace(editBuf->data[editBuf->pos]))
1324 editBuf->pos++; 1324 editBuf->pos++;
1325 if (editBuf->pos > editBuf->len) 1325 if (editBuf->pos > editBuf->len)
1326 editBuf->pos = editBuf->len; 1326 editBuf->pos = editBuf->len;
1327 update = TRUE; 1327 update = TRUE;