Unified · Split
| @@ -303,10 +303,9 @@ orcathread(void *drawchan) · 302 unmodified lines | ||
| 303 | 303 | static void |
| 304 | 304 | redraw(void) |
| 305 | 305 | { |
| 306 | − Rectangle r; | |
| 307 | 306 | Point p, top, bot; |
| 308 | 307 | int x, y, len, rx, ry; |
| 309 | − int bg, fg, attr; | |
| 308 | + int bg, fg, attr, selected; | |
| 310 | 309 | Rune c; |
| 311 | 310 | |
| 312 | 311 | draw(screen, screen->r, color[Dback], nil, ZP); |
| @@ -317,17 +316,6 @@ redraw(void) · 4 unmodified lines | ||
| 317 | 316 | bot.x = top.x; |
| 318 | 317 | bot.y = screen->r.max.y - Txtoff - charh*2; |
| 319 | 318 | |
| 320 | − /* cursor bg */ | |
| 321 | − p.x += curx * charw; | |
| 322 | − p.y += cury * charh; | |
| 323 | − r.min = p; | |
| 324 | − r.max = p; | |
| 325 | − r.max.x += selw * charw; | |
| 326 | − r.max.y += selh * charh; | |
| 327 | − draw(screen, r, color[Dbinv], nil, ZP); | |
| 328 | − | |
| 329 | − p = top; | |
| 330 | − | |
| 331 | 319 | for (y = 0; y < field.height && p.y < bot.y-charh; y++) { |
| 332 | 320 | for (x = 0; x < field.width; x++) { |
| 333 | 321 | c = field.buffer[field.width*y + x]; |
| @@ -336,19 +324,18 @@ redraw(void) · 2 unmodified lines | ||
| 336 | 324 | if (c == '.') |
| 337 | 325 | c = dot[dotstyle]; |
| 338 | 326 | |
| 327 | + selected = x >= curx && y >= cury && x < curx+selw && y < cury+selh; | |
| 328 | + bg = selected ? Dbinv : Dback; | |
| 329 | + fg = selected ? Dfinv : Dfhigh; | |
| 330 | + | |
| 339 | 331 | if (c == dot[dotstyle] && attr == 0) { |
| 340 | 332 | if ((x % gridw) == 0 && (y % gridh) == 0) { |
| 341 | 333 | rx = !!x + (x + 1) / field.width; |
| 342 | 334 | ry = !!y + (y + 1) / field.height; |
| 343 | 335 | c = ruler[rulerstyle][ry*3+rx]; |
| 344 | 336 | } |
| 345 | − runestringn(screen, p, color[Dflow], ZP, font, &c, 1); | |
| 346 | − } else if (x >= curx && y >= cury && x < curx+selw && y < cury+selh) { | |
| 347 | − runestringn(screen, p, color[Dfinv], ZP, font, &c, 1); | |
| 348 | − } else { | |
| 349 | − bg = Dback; | |
| 350 | − fg = Dfhigh; | |
| 351 | − | |
| 337 | + fg = Dflow; | |
| 338 | + } else if (!selected) { | |
| 352 | 339 | if (c == '#') { |
| 353 | 340 | fg = Dfmed; |
| 354 | 341 | } else { |
| @@ -372,8 +359,8 @@ redraw(void) · 17 unmodified lines | ||
| 372 | 359 | bg = Dback; |
| 373 | 360 | fg = Dbmed; |
| 374 | 361 | } |
| 375 | − runestringnbg(screen, p, color[fg], ZP, font, &c, 1, color[bg], ZP); | |
| 376 | 362 | } |
| 363 | + runestringnbg(screen, p, color[fg], ZP, font, &c, 1, color[bg], ZP); | |
| 377 | 364 | p.x += charw; |
| 378 | 365 | } |
| 379 | 366 | p.y += font->height; |