@@ -103,58 +103,58 @@ char *readline_tty(char *input, int size, char *prompt)
103103 }
104104
105105 if (ret > 3 ) {
106- if ((got [0 ] == 0x1B ) && (got [2 ] == 0x33 ) && (got [3 ] == 0x7E )) {
107- if (pos < len ) {
108- //write(STDOUT_FILENO, &del, 1);
109- //printf( " ");
110- //write(STDOUT_FILENO, &del, 1);
111- pos -- ;
112- len -- ;
113- if (pos < len ) {
114- for ( i = pos + 1 ; i < len ; i ++ ) {
115- input [i ] = input [i + 1 ];
116- write (STDOUT_FILENO , & input [i ], 1 );
117- }
118- write (STDOUT_FILENO , & space , 1 );
119- i = len - pos ;
120- while (i > 0 ) {
121- write (STDOUT_FILENO , & del , 1 );
122- i -- ;
123- }
106+ if ((got [0 ] == 0x1B ) && (got [2 ] == 0x33 ) && (got [3 ] == 0x7E )) {
107+ if (pos < len ) {
108+ //write(STDOUT_FILENO, &del, 1);
109+ //printf( " ");
110+ //write(STDOUT_FILENO, &del, 1);
111+ pos -- ;
112+ len -- ;
113+ if (pos < len ) {
114+ for ( i = pos + 1 ; i < len ; i ++ ) {
115+ input [i ] = input [i + 1 ];
116+ write (STDOUT_FILENO , & input [i ], 1 );
117+ }
118+ write (STDOUT_FILENO , & space , 1 );
119+ i = len - pos ;
120+ while (i > 0 ) {
121+ write (STDOUT_FILENO , & del , 1 );
122+ i -- ;
123+ }
124124
125- } else {
126- input [pos ] = 0x00 ;
127- pos -- ;
128- len -- ;
129- }
125+ } else {
126+ input [pos ] = 0x00 ;
127+ pos -- ;
128+ len -- ;
129+ }
130130
131- continue ;
131+ continue ;
132+ }
132133 }
133- }
134134 continue ;
135135 }
136136 if ((ret > 0 ) && (got [0 ] >= 0x20 ) && (got [0 ] <= 0x7e )) {
137137 for (i = 0 ; i < ret ; i ++ ) {
138138 /* Echo to terminal */
139- if (got [i ] >= 0x20 && got [i ] <= 0x7e )
139+ if (( got [i ] >= 0x20 ) && ( got [i ] <= 0x7e ) )
140140 write (STDOUT_FILENO , & got [i ], 1 );
141- if (pos < len ) {
142- for (j = len + 1 ; j > pos ; j -- ) {
143- input [j ] = input [j - 1 ];
144- }
145- input [pos ] = got [i ];
146- for ( j = pos + 1 ; j < len + 1 ; j ++ ) {
141+ if (pos < len ) {
142+ for (j = len + 1 ; j > pos ; j -- ) {
143+ input [j ] = input [j - 1 ];
144+ }
145+ input [pos ] = got [i ];
146+ for ( j = pos + 1 ; j < len + 1 ; j ++ ) {
147147 write (STDOUT_FILENO , & input [j ], 1 );
148- }
148+ }
149149 write (STDOUT_FILENO , & input [i ], 1 );
150- j = len - pos + 1 ;
151- while (j > 0 ) {
152- write (STDOUT_FILENO , & del , 1 );
153- j -- ;
154- }
155- } else {
156- input [pos ] = got [i ];
157- }
150+ j = len - pos + 1 ;
151+ while (j > 0 ) {
152+ write (STDOUT_FILENO , & del , 1 );
153+ j -- ;
154+ }
155+ } else {
156+ input [pos ] = got [i ];
157+ }
158158
159159 len ++ ;
160160 pos ++ ;
0 commit comments