re_refresh(): * draws the new virtual screen image from the current input * line, then goes line-by-line changing the real image to the new * virtual image. The routine to re-draw a line can be replaced * easily in hopes of a smarter one being placed there. */
| 197 | * easily in hopes of a smarter one being placed there. |
| 198 | */ |
| 199 | protected void |
| 200 | re_refresh(EditLine *el) |
| 201 | { |
| 202 | int i, rhdiff; |
| 203 | Char *cp, *st; |
| 204 | coord_t cur; |
| 205 | #ifdef notyet |
| 206 | size_t termsz; |
| 207 | #endif |
| 208 | |
| 209 | ELRE_DEBUG(1, (__F, "el->el_line.buffer = :%s:\r\n", |
| 210 | el->el_line.buffer)); |
| 211 | |
| 212 | /* reset the Drawing cursor */ |
| 213 | el->el_refresh.r_cursor.h = 0; |
| 214 | el->el_refresh.r_cursor.v = 0; |
| 215 | |
| 216 | /* temporarily draw rprompt to calculate its size */ |
| 217 | prompt_print(el, EL_RPROMPT); |
| 218 | |
| 219 | /* reset the Drawing cursor */ |
| 220 | el->el_refresh.r_cursor.h = 0; |
| 221 | el->el_refresh.r_cursor.v = 0; |
| 222 | |
| 223 | if (el->el_line.cursor >= el->el_line.lastchar) { |
| 224 | if (el->el_map.current == el->el_map.alt |
| 225 | && el->el_line.lastchar != el->el_line.buffer) |
| 226 | el->el_line.cursor = el->el_line.lastchar - 1; |
| 227 | else |
| 228 | el->el_line.cursor = el->el_line.lastchar; |
| 229 | } |
| 230 | |
| 231 | cur.h = -1; /* set flag in case I'm not set */ |
| 232 | cur.v = 0; |
| 233 | |
| 234 | prompt_print(el, EL_PROMPT); |
| 235 | |
| 236 | /* draw the current input buffer */ |
| 237 | #if notyet |
| 238 | termsz = el->el_terminal.t_size.h * el->el_terminal.t_size.v; |
| 239 | if (el->el_line.lastchar - el->el_line.buffer > termsz) { |
| 240 | /* |
| 241 | * If line is longer than terminal, process only part |
| 242 | * of line which would influence display. |
| 243 | */ |
| 244 | size_t rem = (el->el_line.lastchar-el->el_line.buffer)%termsz; |
| 245 | |
| 246 | st = el->el_line.lastchar - rem |
| 247 | - (termsz - (((rem / el->el_terminal.t_size.v) - 1) |
| 248 | * el->el_terminal.t_size.v)); |
| 249 | } else |
| 250 | #endif |
| 251 | st = el->el_line.buffer; |
| 252 | |
| 253 | for (cp = st; cp < el->el_line.lastchar; cp++) { |
| 254 | if (cp == el->el_line.cursor) { |
| 255 | int w = Width(*cp); |
| 256 | /* save for later */ |
no test coverage detected