changeset 45:ceec75116aa7

Improved editing commands ctrl+<left/right>
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 28 Oct 2008 00:33:10 +0200
parents dfe6b835a745
children 65b1ac6a1e2e
files nnchat.c
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/nnchat.c	Mon Oct 27 01:31:53 2008 +0200
+++ b/nnchat.c	Tue Oct 28 00:33:10 2008 +0200
@@ -1075,7 +1075,7 @@
 	memset(histBuf, 0, sizeof(histBuf));
 	
 	/* Initialize */
-	th_init("NNChat", "Newbie Nudes chat client", "0.6.1",
+	th_init("NNChat", "Newbie Nudes chat client", "0.6.2",
 		"Written and designed by Anonymous Finnish Guy (C) 2008",
 		"This software is freeware, use and distribute as you wish.");
 	th_verbosityLevel = 0;
@@ -1310,16 +1310,16 @@
 				break;
 				
 			case 0x204: /* ctrl+left */
-				editBuf->pos--;
-				while (editBuf->pos > 0 && !isspace(editBuf->data[editBuf->pos]))
+				while (editBuf->pos > 0 && isspace(editBuf->data[editBuf->pos - 1]))
 					editBuf->pos--;
-				if (editBuf->pos < 0)
-					editBuf->pos = 0;
+				while (editBuf->pos > 0 && !isspace(editBuf->data[editBuf->pos - 1]))
+					editBuf->pos--;
 				update = TRUE;
 				break;
 			
 			case 0x206: /* ctrl+right */
-				editBuf->pos++;
+				while (editBuf->pos < editBuf->len && isspace(editBuf->data[editBuf->pos]))
+					editBuf->pos++;
 				while (editBuf->pos < editBuf->len && !isspace(editBuf->data[editBuf->pos]))
 					editBuf->pos++;
 				if (editBuf->pos > editBuf->len)