- Timestamp:
- May 20, 2007, 12:51:27 AM (18 years ago)
- File:
-
- 1 edited
-
branches/ide-1.0/ccl/hemlock/src/linimage.lisp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/ide-1.0/ccl/hemlock/src/linimage.lisp
r60 r6574 339 339 ;;; Like compute-normal-line-image, only works on the cached line. 340 340 ;;; 341 (defun compute-cached-line-image ( index dis-line xpos width)341 (defun compute-cached-line-image (buffer index dis-line xpos width) 342 342 (declare (fixnum index width) (type (or fixnum null) xpos)) 343 (prog ((gap (- *right-open-pos* *left-open-pos*))343 (prog ((gap (- (buffer-right-open-pos buffer) (buffer-left-open-pos buffer))) 344 344 (dest (dis-line-chars dis-line)) 345 (done-p (= *right-open-pos* *line-cache-length*)) 345 (done-p (= (buffer-right-open-pos buffer) 346 (buffer-line-cache-length buffer))) 346 347 (losing 0) 347 348 string underhang) … … 354 355 ((null xpos) 355 356 (update-and-punt dis-line width nil 0 index)) 356 ((>= index *left-open-pos*)357 ((>= index (buffer-left-open-pos buffer)) 357 358 (go RIGHT-START))) 358 (setq losing (%fcwa *open-chars* index *left-open-pos*losing-char))359 (setq losing (%fcwa (buffer-open-chars buffer) index (buffer-left-open-pos buffer) losing-char)) 359 360 (cond 360 361 (losing 361 (display-some-chars *open-chars*index losing dest xpos width nil)362 (display-some-chars (buffer-open-chars buffer) index losing dest xpos width nil) 362 363 ;; If we we didn't wrap then display some losers... 363 364 (if xpos 364 (display-losing-chars *open-chars* index *left-open-pos*dest xpos365 (display-losing-chars (buffer-open-chars buffer) index (buffer-left-open-pos buffer) dest xpos 365 366 width string underhang string-get-rep 366 (and done-p (= index *left-open-pos*)))367 (and done-p (= index (buffer-left-open-pos buffer)))) 367 368 (update-and-punt dis-line width nil 0 index))) 368 369 (t 369 (display-some-chars *open-chars* index *left-open-pos*dest xpos width done-p)))370 (display-some-chars (buffer-open-chars buffer) index (buffer-left-open-pos buffer) dest xpos width done-p))) 370 371 (go LEFT-LOOP) 371 372 … … 378 379 ((null xpos) 379 380 (update-and-punt dis-line width nil 0 (- index gap))) 380 ((= index *line-cache-length*)381 ((= index (buffer-line-cache-length buffer)) 381 382 (update-and-punt dis-line xpos nil nil (- index gap)))) 382 (setq losing (%fcwa *open-chars* index *line-cache-length*losing-char))383 (setq losing (%fcwa (buffer-open-chars buffer) index (buffer-line-cache-length buffer) losing-char)) 383 384 (cond 384 385 (losing 385 (display-some-chars *open-chars*index losing dest xpos width nil)386 (display-some-chars (buffer-open-chars buffer) index losing dest xpos width nil) 386 387 (cond 387 388 ;; Did we wrap? … … 389 390 (update-and-punt dis-line width nil 0 (- index gap))) 390 391 (t 391 (display-losing-chars *open-chars* index *line-cache-length*dest xpos392 (display-losing-chars (buffer-open-chars buffer) index (buffer-line-cache-length buffer) dest xpos 392 393 width string underhang string-get-rep)))) 393 394 (t 394 (display-some-chars *open-chars* index *line-cache-length*dest xpos width t)))395 (go RIGHT-LOOP))) 395 (display-some-chars (buffer-open-chars buffer) index (buffer-line-cache-length buffer) dest xpos width t))) 396 (go RIGHT-LOOP))) 396 397 397 398 … … 442 443 ;;; 443 444 (defun compute-line-image (string underhang line offset dis-line width) 444 ;; 445 ;; Release any old font-changes. 446 (let ((changes (dis-line-font-changes dis-line))) 447 (when changes 448 (do ((prev changes current) 449 (current (font-change-next changes) 450 (font-change-next current))) 451 ((null current) 452 (setf (dis-line-font-changes dis-line) nil) 453 (shiftf (font-change-next prev) *free-font-changes* changes)) 454 (setf (font-change-mark current) nil)))) 455 ;; 456 ;; If the line has any Font-Marks, add Font-Changes for them. 457 (let ((marks (line-marks line))) 458 (when (dolist (m marks nil) 459 (when (fast-font-mark-p m) (return t))) 460 (let ((prev nil)) 461 ;; 462 ;; Find the last Font-Mark with charpos less than Offset. If there is 463 ;; such a Font-Mark, then there is a font-change to this font at X = 0. 464 (let ((max -1) 465 (max-mark nil)) 466 (dolist (m marks) 467 (when (fast-font-mark-p m) 468 (let ((charpos (mark-charpos m))) 469 (when (and (< charpos offset) (> charpos max)) 470 (setq max charpos max-mark m))))) 471 (when max-mark 472 (setq prev (alloc-font-change 0 (font-mark-font max-mark) max-mark)) 473 (setf (dis-line-font-changes dis-line) prev))) 474 ;; 475 ;; Repeatedly scan through marks, adding a font-change for the 476 ;; smallest Font-Mark with a charpos greater than Bound, until 477 ;; we find no such mark. 478 (do ((bound (1- offset) min) 479 (min most-positive-fixnum most-positive-fixnum) 480 (min-mark nil nil)) 481 (()) 482 (dolist (m marks) 483 (when (fast-font-mark-p m) 484 (let ((charpos (mark-charpos m))) 485 (when (and (> charpos bound) (< charpos min)) 486 (setq min charpos min-mark m))))) 487 (unless min-mark (return nil)) 488 (let ((len (if (eq line *open-line*) 445 (let* ((buffer (line-%buffer line))) 446 ;; 447 ;; Release any old font-changes. 448 (let ((changes (dis-line-font-changes dis-line))) 449 (when changes 450 (do ((prev changes current) 451 (current (font-change-next changes) 452 (font-change-next current))) 453 ((null current) 454 (setf (dis-line-font-changes dis-line) nil) 455 (shiftf (font-change-next prev) *free-font-changes* changes)) 456 (setf (font-change-mark current) nil)))) 457 ;; 458 ;; If the line has any Font-Marks, add Font-Changes for them. 459 (let ((marks (line-marks line))) 460 (when (dolist (m marks nil) 461 (when (fast-font-mark-p m) (return t))) 462 (let ((prev nil)) 463 ;; 464 ;; Find the last Font-Mark with charpos less than Offset. If there is 465 ;; such a Font-Mark, then there is a font-change to this font at X = 0. 466 (let ((max -1) 467 (max-mark nil)) 468 (dolist (m marks) 469 (when (fast-font-mark-p m) 470 (let ((charpos (mark-charpos m))) 471 (when (and (< charpos offset) (> charpos max)) 472 (setq max charpos max-mark m))))) 473 (when max-mark 474 (setq prev (alloc-font-change 0 (font-mark-font max-mark) max-mark)) 475 (setf (dis-line-font-changes dis-line) prev))) 476 ;; 477 ;; Repeatedly scan through marks, adding a font-change for the 478 ;; smallest Font-Mark with a charpos greater than Bound, until 479 ;; we find no such mark. 480 (do ((bound (1- offset) min) 481 (min most-positive-fixnum most-positive-fixnum) 482 (min-mark nil nil)) 483 (()) 484 (dolist (m marks) 485 (when (fast-font-mark-p m) 486 (let ((charpos (mark-charpos m))) 487 (when (and (> charpos bound) (< charpos min)) 488 (setq min charpos min-mark m))))) 489 (unless min-mark (return nil)) 490 (let ((len (if (eq line (buffer-open-line buffer)) 489 491 (cached-real-line-length line 10000 offset min) 490 492 (real-line-length line 10000 offset min)))) 491 (when (< len width)492 (let ((new (alloc-font-change493 (+ len494 (if string493 (when (< len width) 494 (let ((new (alloc-font-change 495 (+ len 496 (if string 495 497 (- (length (the simple-string string)) underhang) 496 498 0)) 497 (font-mark-font min-mark)498 min-mark)))499 (if prev499 (font-mark-font min-mark) 500 min-mark))) 501 (if prev 500 502 (setf (font-change-next prev) new) 501 503 (setf (dis-line-font-changes dis-line) new)) 502 (setq prev new))))))))503 ;;504 ;; Recompute the line image.505 (cond506 (string507 (let ((len (strlen string))508 (chars (dis-line-chars dis-line))509 (xpos 0))510 (declare (type (or fixnum null) xpos) (simple-string chars))511 (display-some-chars string underhang len chars xpos width nil)512 (cond513 ((null xpos)514 (values string underhang offset))515 ((eq line *open-line*)516 (compute-cached-line-imageoffset dis-line xpos width))517 ((line-buffered-p line)518 (compute-buffered-line-image line offset dis-line xpos width))519 (t520 (compute-normal-line-image line offset dis-line xpos width)))))521 ((eq line *open-line*)522 (compute-cached-line-image offset dis-line 0 width))523 ((line-buffered-p line)524 (compute-buffered-line-image line offset dis-line 0 width))525 (t526 (compute-normal-line-image line offset dis-line 0 width))))504 (setq prev new)))))))) 505 ;; 506 ;; Recompute the line image. 507 (cond 508 (string 509 (let ((len (strlen string)) 510 (chars (dis-line-chars dis-line)) 511 (xpos 0)) 512 (declare (type (or fixnum null) xpos) (simple-string chars)) 513 (display-some-chars string underhang len chars xpos width nil) 514 (cond 515 ((null xpos) 516 (values string underhang offset)) 517 ((eq line (buffer-open-line buffer)) 518 (compute-cached-line-image buffer offset dis-line xpos width)) 519 ((line-buffered-p line) 520 (compute-buffered-line-image line offset dis-line xpos width)) 521 (t 522 (compute-normal-line-image line offset dis-line xpos width))))) 523 ((eq line (buffer-open-line buffer)) 524 (compute-cached-line-image offset dis-line 0 width)) 525 ((line-buffered-p line) 526 (compute-buffered-line-image line offset dis-line 0 width)) 527 (t 528 (compute-normal-line-image line offset dis-line 0 width)))))
Note:
See TracChangeset
for help on using the changeset viewer.
