Re: word completion



Hi,

the calculation of the dialog metrics is not correct --- a remnant of
the nocturnal development ;-)

Here is the patch.

Bye,
Matthias
--- editcmd.c	Thu Jan  3 01:37:23 2002
+++ editcmd.c	Thu Jan  3 01:34:10 2002
@@ -2519,33 +2519,24 @@
     WListbox *compl_list;
     	    
 /* calculate the dialog metrics */
-    start_x = edit->curs_col - ((max_len + 4) / 2);
-    start_y = edit->curs_row + 2;
-	
     compl_dlg_h = num_compl + 2;
     compl_dlg_w = max_len + 4;
+    start_x = edit->curs_col + edit->start_col - (compl_dlg_w / 2);
+    start_y = edit->curs_row + EDIT_TEXT_VERTICAL_OFFSET + 1;
 
-    if (start_x <= 0) 
+    if (start_x < 0) 
         start_x = 0;
-
-    if (compl_dlg_w >= COLS) 
+    if (compl_dlg_w > COLS) 
         compl_dlg_w = COLS;
+    if (compl_dlg_h > LINES - 2) 
+        compl_dlg_h = LINES - 2;
 
-    if (start_x + compl_dlg_w >= COLS) {
-        offset = start_x + compl_dlg_w - COLS;
+    offset = start_x + compl_dlg_w - COLS;
+    if (offset > 0)
         start_x -= offset;
-        if (start_x <= 0) 
-    	    start_x = 0;
-    }
-	    
-    if (start_y + compl_dlg_h >= LINES) {
-        offset = start_y + compl_dlg_h - LINES;
-        start_y -= offset;
-        if (start_y <= 0) 
-    	    start_y = 1;
-	if (start_y + compl_dlg_h >= LINES)
-	    compl_dlg_h = LINES - 2;
-    }
+    offset = start_y + compl_dlg_h - LINES;
+    if (offset > 0)
+        start_y -= (offset + 1);
 
 /* create the dialog */    
     compl_dlg = create_dlg (start_y, start_x, compl_dlg_h, compl_dlg_w,


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