Fixed door for direct serial
[tpg/opendispense2.git] / src / client / main.c
index b71975a..bf04443 100644 (file)
@@ -854,7 +854,7 @@ int ShowNCursesUI(void)
         int    ch;
         int    i, times;
         int    xBase, yBase;
-       const int       displayMinWidth = 40;
+       const int       displayMinWidth = 50;
        char    *titleString = "Dispense";
         int    items_in_view;
         int    maxItemIndex;
@@ -1112,7 +1112,7 @@ int ShowItemAt(int Row, int Col, int Width, int Index, int bHilighted)
        if( Width > 0 )
        {
                // 4 preceding, 5 price
-               int nameWidth = Width - 4 - 5;
+               int nameWidth = Width - 4 - snprintf(NULL, 0, " %4i", price);
                move( Row, Col );
                
                if( Index >= 0 )
@@ -1136,16 +1136,8 @@ int ShowItemAt(int Row, int Col, int Width, int Index, int bHilighted)
                                break;
                        }
                        
-                       if( price > 100*100 ) {
-                               nameWidth --;
-                       }
-                       if( price > 1000*100 ) {
-                               nameWidth --;
-                       }
-                       
                        printw("%-*.*s", nameWidth, nameWidth, name);
                
-                       // 99.99 should be enough
                        printw(" %4i", price);
                }
                else
@@ -2261,9 +2253,10 @@ char *ReadLine(int Socket)
                if( newline ) {
                         int    newLen = newline - (buf+bufPos) + 1;
                        bufValid = len - newLen;
-                       bufPos += newLen;
+                       len = newLen;
                }
                if( len + bufPos == BUFSIZ - 1 )        bufPos = 0;
+               else    bufPos += len;
        }
        
        #if DEBUG_TRACE_SERVER

UCC git Repository :: git.ucc.asn.au