cursor at EOL in input widget



This patch move cursor in input fields to end of line and change color of 
this text if it will be disappear on typing.


ChangeLog:
---------------------------------
2001-08-19  Max Schedriviy  <max tavrida net>
	* color.[ch], main.c, text.c: Defined color for not changed text
	in WInput widget (INPUT_COLOR_NOTCH). Default color is gray on cyan.

	* wtools.c (quick_dialog_skip): Move cursor position on creation
	WInput widget to end of line. Set text color to INPUT_COLOR_NOTCH.
	
	* widget.c (handle_char): Set color to INPUT_COLOR if color is
	INPUT_COLOR_NOTCH.
---------------------------------


input_EOL.diff
---------------------------------
diff -Naur src/color.c src_new/color.c
--- src/color.c	Tue Jul 31 13:32:50 2001
+++ src_new/color.c	Sun Aug 19 17:46:31 2001
@@ -104,7 +104,7 @@
     { "core=",       0, 0 }, /* core files */              /* 29 */
 
     { 0,             0, 0 }, /* not usable (DEFAULT_COLOR_INDEX) *//* 30 */
-    { 0,             0, 0 }, /* unused */
+    { "inputnotch=", 0, 0 }, /* not changed input field */
     { 0,             0, 0 }, /* not usable (A_REVERSE) */
     { 0,             0, 0 }, /* not usable (A_REVERSE_BOLD) */
 
diff -Naur src/color.h src_new/color.h
--- src/color.h	Tue May 29 20:02:28 2001
+++ src_new/color.h	Sun Aug 19 17:44:36 2001
@@ -80,6 +80,7 @@
 /* For the default color any unused index may be chosen. */
 #define DEFAULT_COLOR_INDEX   30
 #define DEFAULT_COLOR  (PORT_COLOR (MY_COLOR_PAIR(DEFAULT_COLOR_INDEX),0))
+#define INPUT_COLOR_NOTCH (PORT_COLOR 
(MY_COLOR_PAIR(DEFAULT_COLOR_INDEX+1),0))
 
 /*
  * editor colors - only 3 for normal, search->found, and select, respectively
diff -Naur src/main.c src_new/main.c
--- src/main.c	Sat Aug 18 18:18:56 2001
+++ src_new/main.c	Sun Aug 19 19:00:46 2001
@@ -2551,7 +2551,7 @@
 	     "{FORE} and {BACK} can be ommited, and the default will be used\n"
 	     "\n"
 	     "Keywords:\n"
-	     "   Global:       errors, reverse, gauge, input\n"
+	     "   Global:       errors, reverse, gauge, input, inputnotch\n"
 	     "   File display: normal, selected, marked, markselect\n"
 	     "   Dialog boxes: dnormal, dfocus, dhotnormal, dhotfocus\n"
 	     "   Menus:        menu, menuhot, menusel, menuhotsel\n"
diff -Naur src/text.c src_new/text.c
--- src/text.c	Thu Jun 14 18:59:52 2001
+++ src_new/text.c	Sun Aug 19 17:40:28 2001
@@ -39,6 +39,7 @@
 "helpslink=yellow,blue:"
 "gauge=white,black:"
 "input=black,cyan:"
+"inputnotch=gray,cyan:"
 "directory=white,blue:"
 "executable=brightgreen,blue:"
 "link=lightgray,blue:"
diff -Naur src/widget.c src_new/widget.c
--- src/widget.c	Tue Jul 31 14:04:21 2001
+++ src_new/widget.c	Sun Aug 19 18:58:09 2001
@@ -1584,6 +1584,9 @@
 
     v = 0;
 
+    if (in->color == INPUT_COLOR_NOTCH)
+	in->color = INPUT_COLOR;
+
     if (quote){
     	free_completions (in);
 	v = insert_char (in, c_code);
diff -Naur src/wtools.c src_new/wtools.c
--- src/wtools.c	Wed Jun 20 20:12:47 2001
+++ src_new/wtools.c	Sun Aug 19 17:47:36 2001
@@ -476,10 +476,13 @@
 
 	    /* We use the hotkey pos as the field length */
 	case quick_input:
-	    input = input_new (ypos, xpos, INPUT_COLOR,
+	    input = input_new (ypos, xpos, INPUT_COLOR_NOTCH,
 			       qw->hotkey_pos, qw->text, qw->tkname);
 	    input->is_password = qw->value == 1;
-	    input->point = 0;
+	    if (qw->text)
+ 		input->point = strlen(qw->text);
+	    else
+ 		input->point = 0;
 	    if (qw->value & 2)
 	        input->completion_flags |= INPUT_COMPLETE_CD;
 	    widget = input;
---------------------------------

-- 
C U L8er!
Max Schedriviy                  mailto:max tavrida net




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]