Interlisp / medley

The main repo for the Medley Interlisp project. Wiki, Issues are here. Other repositories include maiko (the VM implementation) and Interlisp.github.io (web site sources)
https://Interlisp.org
MIT License
373 stars 19 forks source link

Lisp code text formatting broken when SEEing source files in TEdit #1700

Closed pamoroso closed 1 week ago

pamoroso commented 5 months ago

Describe the bug When viewing Interlisp source files with TEDIT-SEE text formatting in the TEdit window is broken. Control characters look like black boxes and code is not styled with the usual attributes such as bold.

To Reproduce Steps to reproduce the behavior:

  1. sign into your Interlisp Online account
  2. under Initial Exec, select Interlisp
  3. click Run Medley
  4. evaluate (TEDIT-SEE 'INIT)

Expected behavior Lisp code appears formatted as usual such as with function names in bold.

Screenshots The TEDIT-SEE window:

tedit-see1

The full desktop with the TEdit window (to the bottom right of the browser) created by the File Browser command See > Scrollable & Pretty:

tedit-see2

Context (please complete the following information):

Additional context Text formatting is similarly broken when viewing files with the File Browser command See > Scrollable & Pretty.

rmkaplan commented 5 months ago

I see the problem online, but not on my mac. On my mac the font changes are properly interpreted.

I think the problem is that the variable TEDIT.INPUT.FORMATS is NIL online, instead of what it should be:

((TEDIT.BRAVOFILE? TEDITFROMBRAVO) (LISPSOURCEFILEP TEDITFROMLISPSOURCE))

This is how it determines what to do with non-Tedit files (in particular, Bravo and Lisp source). If LISPSOURCEFILEP is true, it applies TEDITFROMLISPSOURCE, which interprets the font changes. Otherwise, it sees them as ordinary (black-box) characters.

So why isn’t that variable set? What about the other platforms?

On May 7, 2024, at 12:36 PM, Paolo Amoroso @.***> wrote:

Describe the bug When viewing Interlisp source files with TEDIT-SEE text formatting in the TEdit window is broken. Control characters look like black boxes and code is not styled with the usual attributes such as bold.

To Reproduce Steps to reproduce the behavior:

sign into your Interlisp Online account under Initial Exec, select Interlisp click Run Medley evaluate (TEDIT-SEE 'INIT) Expected behavior Lisp code appears formatted as usual such as with function names in bold.

Screenshots The TEDIT-SEE window:

tedit-see1.png (view on web) https://github.com/Interlisp/medley/assets/10342479/b3d0b149-58b3-4de5-a6ab-3ab992598d3e The full desktop with the TEdit window (to the bottom right of the browser) created by the File Browser command See > Scrollable & Pretty:

tedit-see2.png (view on web) https://github.com/Interlisp/medley/assets/10342479/71a75e69-828f-4ffa-b903-3ed600ab2c49 Context (please complete the following information):

OS: chromeOS Stable OS Version: 124.0.6367.95 Host arch: x86_64 (ASUS Chromebox 3) Maiko version: N/A IL:MAKESYSDATE: 22-Apr-2024 02:03:43 Additional context Text formatting is similarly broken when viewing files with the File Browser command See > Scrollable & Pretty.

— Reply to this email directly, view it on GitHub https://github.com/Interlisp/medley/issues/1700, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQSTUJPRU2PAISB3L6QPI3DZBEUNFAVCNFSM6AAAAABHLTXIZKVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI4DIMBYGU2TKMQ. You are receiving this because you are subscribed to this thread.

nbriggs commented 5 months ago

Odd. If you reload TEDIT-FILE.LCOM it will reset TEDIT.INPUT.FORMATS.

rmkaplan commented 5 months ago

The value is correct in the release full sysout even without my INIT (on my mac).

On May 7, 2024, at 2:30 PM, Nick Briggs @.***> wrote:

Odd. If you reload TEDIT-FILE.LCOM it will reset TEDIT.INPUT.FORMATS.

— Reply to this email directly, view it on GitHub https://github.com/Interlisp/medley/issues/1700#issuecomment-2099343144, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQSTUJKSESQZHTW76IHPBODZBFBYRAVCNFSM6AAAAABHLTXIZKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJZGM2DGMJUGQ. You are receiving this because you commented.

pamoroso commented 5 months ago

I confirm TEDIT.INPUT.FORMATS is NIL online. But setting TEDIT.INPUT.FORMATS to ((TEDIT.BRAVOFILE? TEDITFROMBRAVO) (LISPSOURCEFILEP TEDITFROMLISPSOURCE)) or loading TEDIT-FILE.LCOM restores formatting only in part:

tedit-see3

nbriggs commented 5 months ago

The black-boxes in the DEFINE-FILE-INFO are not totally unexpected - they're the package delimiter in the INTERLISP file readtable which I think is 0x1E, the ASCII RS (record separator) character - so there really is no meaningful printable form.

pamoroso commented 5 months ago

I copied the same INIT file to my local Linux, which runs an old Medley build, and it looks like this with no black boxes:

tedit-see-old

fghalasz commented 1 week ago

I fixed the issue that Notecards was setting TEDIT.INPUT.FORMATS to NIL. This fix should appear online after the next release build. To fix the apps.sysout created by a local loadup, do a git pull of main in the Notecards directory and rerun loadup-all.sh -apps.

The issue with the black boxes remains - but note that it only occurs in the first (DEFINE-FILE-INFO) line. Subsequent lines are formatted correctly.

@pamoroso In your example of it working correctly in an old Medley build, note that there is no DEFINE-FILE-INFO line in the TEDIT-SEE window - or at least it is not showing in your screenshot. Are you sure that it used to work without black boxes in the DEFINE-FILE-INFO line?

pamoroso commented 1 week ago

To make the latest build I git pulled main of NoteCards (along with Medley and Maiko) and rerun loadup-all.sh -apps.

In my example of the feature working correctly in an old Medley build there is no DEFINE-FILE-INFO line because TEdit didn't show the line by design. Instead TEdit displayed the information in the DEFINE-FILE-INFO expression (readtable, package) and some other metadata (datestamp, changed symbols) as a nicely formatted list of fields with the key in italics and the value in regular type. It looked like this:

changes to: (VARS INITCOMS)

Readt Table: INTERLISP

Package: INTERLISP

As the screenshot of the latest buikd shows, now TEdit doesn't display such a list but includes the full DEFINE-FILE-INFO expression (unformatted and with black boxes) and renders the other metadata as unformatted code like this:

:CHANGES-TO (VARS INITCOMS)

Something may have changed between December 1, 2023, when my old build worked correctly, and May 7, 2024 when I reported the issue.

rmkaplan commented 1 week ago

This is known behavior, because the SEE keyboard command (and maybe the FB See item in earlier loadups) and the Tedit transform the file in different ways.

The SEE command calls PRETTYFILEINDEX, which reads the expressions on the file and puts them out in a nicer format. Among other things, it decodes the DEFINE-FILE-INFO and puts out those nice header lines (it would also build an index of the file, if going to a printer).

Tedit calls the function TEDITFROMLISPSOURCEFILE (from the list TEDIT.INPUT.FORMATS), which copies the file character by character to a Tedit image stream.

If Tedit were to use PRETTYFILEINDEX the output would in principle be nicer to view. But there is a technical problem: PRETTYFILEINDEX thinks that the target is a full image stream, with the ability in particular to move the X and Y coordinates arbitrarily, to do the formatting. Tedit is character/line oriented: internally it moves around on the display, but it doesn’t really support the DSPXPOSITION and DSPYPOSITION functions for external clients, other than to return current (scroll-dependent) values.

Maybe PRETTYFILEINDEX could be rewritten to not depend on coordinates. Or maybe Tedit could be reworked to support coordinate shifts on the current display surface. But for now, if you swap in PRETTYFILEINDEX the careful formatting gets destroyed.

On Sep 24, 2024, at 3:17 AM, Paolo Amoroso @.***> wrote:

To make the latest build I git pulled main of NoteCards (along with Medley and Maiko) and rerun loadup-all.sh -apps.

In my example https://github.com/Interlisp/medley/issues/1700#issuecomment-2100943452 of the feature working correctly in an old Medley build there is no DEFINE-FILE-INFO line because TEdit didn't show the line by design. Instead TEdit displayed the information in the DEFINE-FILE-INFO expression (readtable, package) and some other metadata (datestamp, changed symbols) as a nicely formatted list of fields with the key in italics and the value in regular type. It looked like this:

changes to: (VARS INITCOMS)

Readt Table: INTERLISP

Package: INTERLISP

As the screenshot of the latest buikd https://github.com/Interlisp/notecards/pull/11#issuecomment-2369276170 shows, now TEdit doesn't display such a list but includes the full DEFINE-FILE-INFO expression (unformatted and with black boxes) and renders the other metadata as unformatted code like this:

:CHANGES-TO (VARS INITCOMS)

Something may have changed between December 1, 2023, when my old build worked correctly https://github.com/Interlisp/medley/issues/1700#issuecomment-2100943452, and May 7, 2024 when I reported the issue https://github.com/Interlisp/medley/issues/1700#issue-2284085552.

— Reply to this email directly, view it on GitHub https://github.com/Interlisp/medley/issues/1700#issuecomment-2370860627, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQSTUJOLQZ7FGJIFM5WOR4DZYE33PAVCNFSM6AAAAABHLTXIZKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZQHA3DANRSG4. You are receiving this because you commented.

pamoroso commented 1 week ago

As far as I can remember, prior to the issue the See > Scrollable & Pretty File Browser menu option has always displayed the formatted header.

rmkaplan commented 1 week ago

In the venue sysout, See scrollable and Pretty does not display the reformatted header, just shows the DEFINE-FILE-INFO.

On Sep 24, 2024, at 11:59 PM, Paolo Amoroso @.***> wrote:

As far as I can remember, prior to the issue the See > Scrollable & Pretty File Browser menu option has always displayed the formatted header.

— Reply to this email directly, view it on GitHub https://github.com/Interlisp/medley/issues/1700#issuecomment-2373200381, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQSTUJKGPWIFVQVGX3GPKTDZYJNOLAVCNFSM6AAAAABHLTXIZKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZTGIYDAMZYGE. You are receiving this because you commented.

masinter commented 1 week ago

My reading of the situation is that the original problem (TEDIT.INPUT.FORMATS set to NIL) has been fixed. If there are still problems, please reopen.