Skip to content

Conversation

smj-edison
Copy link
Collaborator

No description provided.

@osnr
Copy link
Collaborator

osnr commented May 16, 2025

Will look at this on Monday I think!

@cwervo cwervo requested review from cwervo, Copilot and osnr May 21, 2025 13:25
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request introduces enhancements for code viewing and interactive program editing by updating text drawing options, improving keyboard event filtering, and adding support for loading edited program code.

  • Added anchor and font parameters for text drawing in shapes.
  • Implemented loading of edited program code and updated keyboard event handling.
  • Improved code view functionality with enhanced text viewport and cursor calculations.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
virtual-programs/shapes.folk Added "anchor" and "font" options for drawing text.
virtual-programs/programs.folk Added logic to load and handle edited program code from disk.
virtual-programs/print-blank.folk Introduced new logic for printing blank pages via keyboard events.
virtual-programs/points-at.folk Modified outline color logic and added extra handling for outline updates.
virtual-programs/keyboard.folk Updated key event retraction logic with an additional condition.
virtual-programs/editor.folk Adjusted editor detection logic based on claim conditions.
virtual-programs/code-view.folk Overhauled code view handling including text viewport and cursor management.
main.tcl Minor adjustments for backward compatibility.
Comments suppressed due to low confidence (1)

virtual-programs/keyboard.folk:139

  • Since newKeyState is set equal to keyState on line 134, the condition '$keyState != $newKeyState' will always be false. Please verify if this additional check is necessary or if it needs to compare against a different value.
if {$now - $timestamp > 5000 || $keyState != $newKeyState} {

Copy link
Collaborator

@osnr osnr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should definitely have page-editing support built in, but I don't know if I like this hard separation (and duplication of logic) between code-view and editor. code-view also seems like it's an editor!

@cwervo do you have thoughts on this?

@@ -0,0 +1,269 @@
# helper functions
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this works well for me, but is there a reason it's basically a completely separate editor to the existing editor?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Three reasons:

  1. The existing editor always owns a program. I couldn't figure out how to get it to attach to an external program without some major logic changes.
  2. The existing editor's code window is tiny on a 1080p projector. I wanted to have an external code window to 1. have larger programs and 2. have multiplexing with a single keyboard.
  3. I was initially going to reuse a lot of the editor's functions, but the current editor tracks the cursor by an x+y pair, and that made the logic unnecessarily complex. I opted to track the cursor by its character position instead.

@osnr
Copy link
Collaborator

osnr commented May 22, 2025

successfully used 1 editor to make a code-view and disable the other keyboard editor, then used the other keyboard to edit a page

IMG_1128

@cwervo
Copy link
Collaborator

cwervo commented Sep 10, 2025

This code has diverged too much from folk2 to be merged — I talked to @smj-edison and we'll close this for now and I'll patch the folk2 editor with the main refactoring changes in this PR (refactoring the logic from x,y to character edits + refactoring to use the .tcl utils in this PR)

One blocker is that code views in folk2 will depend on extending the render texture of the editor — need to figure out how to make this happen.

@cwervo cwervo closed this Sep 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants