1
0
mirror of synced 2026-02-26 17:13:17 +00:00

Fix a glitch in Tedit screen-update (#1984)

Fixes a screen-update glitch in Tedit
This commit is contained in:
rmkaplan
2025-01-27 11:48:53 -08:00
committed by GitHub
parent 292a7cd787
commit 188895c7e9
2 changed files with 67 additions and 56 deletions

View File

@@ -1,12 +1,13 @@
(DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
(FILECREATED " 6-Jan-2025 23:41:58" {WMEDLEY}<library>TEDIT>TEDIT-SCREEN.;847 185662
(FILECREATED "21-Jan-2025 16:05:23" {WMEDLEY}<library>TEDIT>TEDIT-SCREEN.;849 186170
:EDIT-BY rmk
:CHANGES-TO (FNS \TEDIT.UPDATE.LINES \TEDIT.VALID.LINES)
:CHANGES-TO (FNS \TEDIT.UPDATE.LINES \TEDIT.MEASURED.LINES \TEDIT.LINES.BELOW
\TEDIT.VALID.LINES \TEDIT.NEXTVALIDLINE)
:PREVIOUS-DATE "24-Dec-2024 22:16:22" {WMEDLEY}<library>TEDIT>TEDIT-SCREEN.;845)
:PREVIOUS-DATE " 7-Jan-2025 11:56:35" {WMEDLEY}<library>TEDIT>TEDIT-SCREEN.;848)
(PRETTYCOMPRINT TEDIT-SCREENCOMS)
@@ -2322,7 +2323,8 @@
1)])
(\TEDIT.UPDATE.LINES
[LAMBDA (TEXTOBJ REASON FIRSTCHANGEDCHNO NCHARSCHANGED) (* ; "Edited 6-Jan-2025 23:37 by rmk")
[LAMBDA (TEXTOBJ REASON FIRSTCHANGEDCHNO NCHARSCHANGED) (* ; "Edited 21-Jan-2025 13:25 by rmk")
(* ; "Edited 7-Jan-2025 11:55 by rmk")
(* ; "Edited 7-Dec-2024 21:52 by rmk")
(* ; "Edited 29-Nov-2024 22:56 by rmk")
(* ; "Edited 26-Nov-2024 03:35 by rmk")
@@ -2364,10 +2366,10 @@
(SETQ LASTVALID (CAR VALIDS))
(SETQ NEXTVALID (CDR VALIDS)) (* ; "MEASURED.LINES creates, measures, and links the lines from LASTVALID to the last pre-NEXTVALID character, without displaying. They may be in the bitmap.")
(SETQ LASTGAPLINE (\TEDIT.MEASURED.LINES LASTVALID (CL:IF NEXTVALID
(SUB1 (FGETLD NEXTVALID LCHAR1))
(TEXTLEN TEXTOBJ))
PANE TEXTOBJ))
[SETQ LASTGAPLINE (\TEDIT.MEASURED.LINES LASTVALID PANE TEXTOBJ
(CL:IF NEXTVALID
(SUB1 (FGETLD NEXTVALID LCHAR1))
(TEXTLEN TEXTOBJ))]
(* ;;
 "The chain that ended at LASTVALID now continues thru LASTGAPLINE to NEXVALID and below.")
@@ -2375,7 +2377,14 @@
(LINKLD LASTGAPLINE NEXTVALID)
(if NEXTVALID
then (SETQ BITMAPLINES (\TEDIT.BITMAPLINES PANE NEXTVALID))
else (\TEDIT.SUFFIXLINE.CREATE PANE TEXTOBJ LASTGAPLINE))
else (\TEDIT.SUFFIXLINE.CREATE PANE TEXTOBJ LASTGAPLINE))
(* ;; "If LASTVALID is not visible (above the pane), make sure that its NEXT is linked to the PANE's prefix")
(CL:WHEN (IGEQ (FGETLD LASTVALID YBOT)
(PANETOP PANE))
(LINKLD (PANEPREFIX PANE)
(FGETLD LASTVALID NEXTLINE)))
(\TEDIT.SHIFTLINES LASTVALID (FGETLD LASTVALID NEXTLINE)
PANE TEXTOBJ BITMAPLINES UPPERBITMAPLINES)))])
@@ -2453,7 +2462,8 @@
SUFFIX])
(\TEDIT.LINES.BELOW
[LAMBDA (PREVLINE PANE TEXTOBJ) (* ; "Edited 24-Nov-2024 14:57 by rmk")
[LAMBDA (PREVLINE PANE TEXTOBJ) (* ; "Edited 21-Jan-2025 13:31 by rmk")
(* ; "Edited 24-Nov-2024 14:57 by rmk")
(* ; "Edited 22-Nov-2024 00:53 by rmk")
(* ; "Edited 20-Nov-2024 12:37 by rmk")
(* ; "Edited 18-Nov-2024 21:12 by rmk")
@@ -2473,26 +2483,27 @@
(* ; "Edited 15-Mar-2024 19:22 by rmk")
(* ; "Edited 23-Dec-2023 23:38 by rmk")
(* ; "Edited 14-Dec-2023 12:46 by rmk")
(CL:UNLESS PREVLINE
(SETQ PREVLINE (PANEPREFIX PANE)))
(* ;; "Formats and displays lines after PREVLINE down to the one is at least partially visible at the bottom of PANE. Each line is positioned with respect to its predecessor and linked to it. The last visible line is set as the BOTTOMLINE of PANE, PANE's suffix is adjusted to cover the bitmap and all the unseen later characters. Returns the last displayed line.")
(for L NEXT YBOT (BOTTOM _ (\TEDIT.ONSCREEN? PANE 'BOTTOM)) inlines (OR PREVLINE (PANEPREFIX
PANE))
(for L NEXT YBOT (BOTTOM _ (\TEDIT.ONSCREEN? PANE 'BOTTOM)) inlines PREVLINE
eachtime (SETQ NEXT (\TEDIT.FORMATLINE TEXTOBJ (FGETLD L LCHARLIM)))
until (FGETLD NEXT LDUMMY) do (SETQ YBOT (\TEDIT.LINE.BOTTOM L NEXT))
(SETYBOT NEXT YBOT)
(CL:WHEN (ILESSP YBOT BOTTOM)
(* ; "Ran off the bottom")
(RETURN (if (\TEDIT.SHOW.AT.BOTTOMP NEXT PANE)
then (LINKLD L NEXT)
(* ; "Keep it with partial display")
(\TEDIT.DISPLAYLINE TEXTOBJ NEXT PANE)
then (\TEDIT.DISPLAYLINE TEXTOBJ NEXT PANE)
(LINKLD L NEXT)
(* ; "Keep NEXT with partial display")
NEXT
else (* ; "Overshot")
else (* ; "Overshot, throw NEXT away")
L)))
(LINKLD L NEXT)
(CL:WHEN (FGETLD NEXT LDUMMY)
(* ; "Suffix line")
(* ; "Suffix line: end of pane")
(RETURN L))
(\TEDIT.DISPLAYLINE TEXTOBJ NEXT PANE)
(* ;
@@ -2504,7 +2515,8 @@
(RETURN L])
(\TEDIT.MEASURED.LINES
[LAMBDA (PREVLINE LASTCHAR PANE TEXTOBJ DONTDISPLAY) (* ; "Edited 7-Dec-2024 16:55 by rmk")
[LAMBDA (PREVLINE PANE TEXTOBJ LASTCHAR) (* ; "Edited 21-Jan-2025 13:30 by rmk")
(* ; "Edited 7-Dec-2024 16:55 by rmk")
(* ; "Edited 1-Dec-2024 11:26 by rmk")
(* ; "Edited 20-Nov-2024 12:37 by rmk")
(* ; "Edited 18-Nov-2024 20:01 by rmk")
@@ -2519,9 +2531,9 @@
(SETYBOT NEXT YBOT)
(CL:WHEN (ILESSP YBOT PBOTTOM) (* ; "NEXT runs off the bottom")
(RETURN (if (\TEDIT.SHOW.AT.BOTTOMP NEXT PANE)
then (LINKLD L NEXT) (* ; "Keep it with partial display")
then (LINKLD L NEXT) (* ; "Keep NEXT with partial display")
NEXT
else (* ; "Overshot")
else (* ; "Overshot, throw NEXT away")
L)))
(LINKLD L NEXT) (* ; "Keeps the iteration going")
finally
@@ -2532,18 +2544,14 @@
(\TEDIT.VALID.LINES
[LAMBDA (PANE FIRSTCHANGEDCHNO NCHARSCHANGED REASON TSTREAM)
(* ; "Edited 21-Jan-2025 15:22 by rmk")
(* ; "Edited 6-Jan-2025 15:19 by rmk")
(* ; "Edited 22-Nov-2024 16:54 by rmk")
(* ; "Edited 20-Nov-2024 12:37 by rmk")
(* ; "Edited 21-Oct-2024 00:33 by rmk")
(* ; "Edited 5-Jul-2024 22:58 by rmk")
(* ; "Edited 4-Jul-2024 10:48 by rmk")
(* ; "Edited 28-Jun-2024 15:27 by rmk")
(* ; "Edited 15-Jun-2024 17:32 by rmk")
(* ; "Edited 12-Jun-2024 23:59 by rmk")
(* ; "Edited 23-May-2024 12:48 by rmk")
(* ; "Edited 20-Apr-2024 22:11 by rmk")
(* ; "Edited 20-Mar-2024 06:46 by rmk")
(* ; "Edited 22-Feb-2024 01:05 by rmk")
(* ; "Edited 3-Nov-2023 12:07 by rmk")
(* ; "Edited 14-Jun-2023 15:55 by rmk")
@@ -2552,18 +2560,18 @@
(* ;; "Called when changes have been made to the document that affect the lines displayed in PANE. Return NIL if the change is not visible in PANE. Otherwise, this divides the lines in PANE into 3 segments:")
(* ;; " 1. a prefix of lines from the top visible line (next of PREFIXLINE) to the LASTVALID line, the line just before the first changed line.")
(* ;; " 1. a prefix of lines from the top visible line (next of PANEPREFIX) to the LASTVALID line, the line just before the first changed line.")
(* ;; " 2. an intermediate sequence of lines that are (or may be) no longer valid because of the change.")
(* ;;
 " 3. a suffix of post-chamge lines, starting with NEXTVALID, that are known still to be valid.")
 " 3. a suffix of post-change lines, starting with NEXTVALID, that are known still to be valid.")
(* ;; "A line is %"valid%" if its line breaking is unaffected by the change and the bits in the screen bitmap that represented it before the change are still correct.")
(* ;; "")
(* ;; "The segmentation information is returned to the caller as a pair of lines (LASTVALID . NEXTVALID). Segment 1 is then the sequence of lines chained from PREFIXLINE to LASTVALID, segment 3 is the sequence beginning at NEXTVALID. The segment 2 lines originally between LASTVALID and NEXTVALID are useless, so here we just nuke them out (by smashing the NEXTLINE of LASTVALID).")
(* ;; "The segmentation information is returned to the caller as a pair of lines (LASTVALID . NEXTVALID). Segment 1 is then the sequence of lines chained from the prefix line to LASTVALID, segment 3 is the sequence beginning at NEXTVALID. The segment 2 lines originally between LASTVALID and NEXTVALID are useless, so here we just nuke them out (by smashing the NEXTLINE of LASTVALID and PREVLINE of NEXTVALID).")
(* ;; "")
@@ -2615,7 +2623,7 @@
SUFFIXLINE))
(SETQ FIRSTVISIBLECHNO (FGETLD PREFIXLINE LCHARLIM))
(SETQ FIRSTCHANGEDLINE (find L inlines (FGETLD PREFIXLINE NEXTLINE)
suchthat (FWITHINLINEP FIRSTVISIBLECHNO L)))
suchthat (FWITHINLINEP FIRSTCHANGEDCHNO L)))
(CL:UNLESS FIRSTCHANGEDLINE (* ; "Changes are not visible")
(RETURN NIL))
@@ -2633,19 +2641,21 @@
 "Last changed line is visible, its changes may cause character to shift to or from lower lines.")
(SETQ NEXTVALIDLINE (\TEDIT.NEXTVALIDLINE LASTCHANGEDLINE TSTREAM)))
(CL:WHEN (AND NEXTVALIDLINE DELTA)
(CL:WHEN NEXTVALIDLINE
(FSETLD NEXTVALIDLINE PREVLINE NIL)
(CL:WHEN DELTA
(* ;; "If the modification added or substracted to the number of characters, translate the character positions of the still-valid lines that are visible later than the change. ")
(* ;; "If the modification added or substracted to the number of characters, translate the character positions of the still-valid lines that are visible later than the change. ")
(for L inlines NEXTVALIDLINE do (add (FGETLD L LCHAR1)
DELTA)
(add (FGETLD L LCHARLAST)
DELTA)))
(for L inlines NEXTVALIDLINE do (add (FGETLD L LCHAR1)
DELTA)
(add (FGETLD L LCHARLAST)
DELTA))))
(* ;; "")
(CL:WHEN LASTVALIDLINE
(FSETLD LASTVALIDLINE NEXTLINE NIL) (* ; "Chop off the now useless lines")
(FSETLD LASTVALIDLINE NEXTLINE NIL) (* ; "Chop out the now useless lines")
(RETURN (CONS LASTVALIDLINE NEXTVALIDLINE)))])
(\TEDIT.LASTVALIDLINE
@@ -2705,18 +2715,19 @@
PTOP])
(\TEDIT.NEXTVALIDLINE
[LAMBDA (LASTCHANGEDLINE TSTREAM) (* ; "Edited 29-Nov-2024 23:31 by rmk")
[LAMBDA (LASTCHANGEDLINE TSTREAM) (* ; "Edited 21-Jan-2025 15:27 by rmk")
(* ; "Edited 29-Nov-2024 23:31 by rmk")
(* ; "Edited 16-Nov-2024 11:00 by rmk")
(* ;; "We know we can stop when we see a forced end-- characters won't move around after that. In the usual case, the forced-end is a also the last line of a paragraph, but we can't just take the first line of the next paragraph because we can't deal here with whatever paragraph leading it might have (and the venue sysout also screwed up in that case).")
(* ;; "So we got for the second line of the next paragraph, if there is one")
(* ;; "So we go for the second line of the next paragraph, if there is one")
(* ;; "The line after a forced end is valid. But maybe we can figure out how to stop sooner?")
(for L inlines LASTCHANGEDLINE when (FGETLD L FORCED-END)
do
(* ;; "If we reach the end of a paragraph, the next line may be the start of the next paragraph. We skip that one, because we don't know how to deal here with its paragraph leading. If forced but not last, presumably it was a meta-EOL linebreak, no special leading.")
(* ;; "A forced end is usually the last line of a paragraph, and its next line is probably valid. But we skip that one, because we don't know how to deal here with its paragraph leading. If forced but not last, presumably it was a meta-EOL linebreak, no special leading to worry about.")
(CL:WHEN (FGETLD L LSTLN)
(SETQ L (FGETLD L NEXTLINE)))
@@ -2849,21 +2860,21 @@
(\TEDIT.LINE.TALLP LINE PHEIGHT))))])
)
(DECLARE%: DONTCOPY
(FILEMAP (NIL (28000 30216 (\TEDIT.LINEDESCRIPTOR.DEFPRINT 28010 . 30214)) (37621 118381 (
\TEDIT.FORMATLINE 37631 . 72371) (\TEDIT.FORMATLINE.SETUP.PARA 72373 . 77196) (
\TEDIT.FORMATLINE.HORIZONTAL 77198 . 81594) (\TEDIT.FORMATLINE.VERTICAL 81596 . 83813) (
\TEDIT.FORMATLINE.JUSTIFY 83815 . 89836) (\TEDIT.FORMATLINE.TABS 89838 . 97638) (\TEDIT.SCALE.TABS
97640 . 98431) (\TEDIT.FORMATLINE.PURGE.SPACES 98433 . 99860) (\TEDIT.FORMATLINE.FLUSH.SOFTHYPHEN
99862 . 100763) (\TEDIT.FORMATLINE.EMPTY 100765 . 105451) (\TEDIT.FORMATLINE.UPDATELOOKS 105453 .
111575) (\TEDIT.FORMATLINE.LASTLEGAL 111577 . 115117) (\TEDIT.LINES.ABOVE 115119 . 118379)) (118498
120413 (\TLVALIDATE 118508 . 120411)) (120607 141771 (\TEDIT.DISPLAYLINE 120617 . 134064) (
\TEDIT.DISPLAYLINE.TABS 134066 . 136689) (\TEDIT.LINECACHE 136691 . 137419) (\TEDIT.CREATE.LINECACHE
137421 . 138257) (\TEDIT.BLTCHAR 138259 . 140886) (\TEDIT.DIACRITIC.SHIFT 140888 . 141769)) (142386
185639 (\TEDIT.BACKFORMAT 142396 . 144950) (\TEDIT.PREVIOUS.LINEBREAK 144952 . 147675) (
\TEDIT.UPDATE.LINES 147677 . 152103) (\TEDIT.PANE.CREATELINES 152105 . 155097) (
\TEDIT.SUFFIXLINE.CREATE 155099 . 156474) (\TEDIT.LINES.BELOW 156476 . 160838) (\TEDIT.MEASURED.LINES
160840 . 162612) (\TEDIT.VALID.LINES 162614 . 171192) (\TEDIT.LASTVALIDLINE 171194 . 176016) (
\TEDIT.NEXTVALIDLINE 176018 . 177320) (\TEDIT.CLEARPANE.BELOW.LINE 177322 . 179428) (\TEDIT.INSERTLINE
179430 . 180816) (\TEDIT.LINE.BOTTOM 180818 . 183814) (\TEDIT.SHOW.AT.BOTTOMP 183816 . 184926) (
\TEDIT.SHOW.AT.TOPP 184928 . 185637)))))
(FILEMAP (NIL (28086 30302 (\TEDIT.LINEDESCRIPTOR.DEFPRINT 28096 . 30300)) (37707 118467 (
\TEDIT.FORMATLINE 37717 . 72457) (\TEDIT.FORMATLINE.SETUP.PARA 72459 . 77282) (
\TEDIT.FORMATLINE.HORIZONTAL 77284 . 81680) (\TEDIT.FORMATLINE.VERTICAL 81682 . 83899) (
\TEDIT.FORMATLINE.JUSTIFY 83901 . 89922) (\TEDIT.FORMATLINE.TABS 89924 . 97724) (\TEDIT.SCALE.TABS
97726 . 98517) (\TEDIT.FORMATLINE.PURGE.SPACES 98519 . 99946) (\TEDIT.FORMATLINE.FLUSH.SOFTHYPHEN
99948 . 100849) (\TEDIT.FORMATLINE.EMPTY 100851 . 105537) (\TEDIT.FORMATLINE.UPDATELOOKS 105539 .
111661) (\TEDIT.FORMATLINE.LASTLEGAL 111663 . 115203) (\TEDIT.LINES.ABOVE 115205 . 118465)) (118584
120499 (\TLVALIDATE 118594 . 120497)) (120693 141857 (\TEDIT.DISPLAYLINE 120703 . 134150) (
\TEDIT.DISPLAYLINE.TABS 134152 . 136775) (\TEDIT.LINECACHE 136777 . 137505) (\TEDIT.CREATE.LINECACHE
137507 . 138343) (\TEDIT.BLTCHAR 138345 . 140972) (\TEDIT.DIACRITIC.SHIFT 140974 . 141855)) (142472
186147 (\TEDIT.BACKFORMAT 142482 . 145036) (\TEDIT.PREVIOUS.LINEBREAK 145038 . 147761) (
\TEDIT.UPDATE.LINES 147763 . 152573) (\TEDIT.PANE.CREATELINES 152575 . 155567) (
\TEDIT.SUFFIXLINE.CREATE 155569 . 156944) (\TEDIT.LINES.BELOW 156946 . 161407) (\TEDIT.MEASURED.LINES
161409 . 163309) (\TEDIT.VALID.LINES 163311 . 171572) (\TEDIT.LASTVALIDLINE 171574 . 176396) (
\TEDIT.NEXTVALIDLINE 176398 . 177828) (\TEDIT.CLEARPANE.BELOW.LINE 177830 . 179936) (\TEDIT.INSERTLINE
179938 . 181324) (\TEDIT.LINE.BOTTOM 181326 . 184322) (\TEDIT.SHOW.AT.BOTTOMP 184324 . 185434) (
\TEDIT.SHOW.AT.TOPP 185436 . 186145)))))
STOP

Binary file not shown.