question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to access Atom via atomID?

See original GitHub issue

Is there currently any function/method in the source code of MathLive that returns the atom (or atoms in the case of highlighting) for a specified atom ID? I can’t seem to find a way of accessing the Atom object corresponding to a particular span by the current implementation of ModelPrivate. What is the best way to go about achieving this?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:20 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
arnogcommented, Jun 8, 2020

The intent of MathLive is to replicate the layout that TeX implements. Certainly not the internal data structures which were conceived when the computing environments where extremely different. And as Neil points out, TeX was never meant to be interactive. I initially avoided introducing a tree structure (specifically a parent pointer in Atom) because TeX did not have it and does not need it for its layout (which is basically one pass without the need to backtrack to the ancestors). However, it is very convenient to have when you need to frequently traverse the data structure, in particular for editing. As both Neil and I have demonstrated it is possible to live without it (using a separate “path” structure), but the code is both simpler and easier to maintain when using an actual parent pointer.

1reaction
NSoiffercommented, Jun 7, 2020

Back in the 90s when I wrote the math editor for Mathematica, I used shared nodes and relative positions to save space: 8mb RAM was a lot and Mathematica generates lots of shareable subexpressions. It did save *a lot *of space for larger outputs, but keeping track of the path (I used a depth first count to produce a selection range) added a ton of complexity to the code. The code has since been converted to use parent pointers and I suspect it got much shorter. I believe the cursor/selection is now represented by simple pointers to the first/last char node that is selected.

That’s my history 😃

Neil

On Sat, Jun 6, 2020 at 8:50 PM Arno Gourdol notifications@github.com wrote:

Also, just to make sure I understood it right: so parent() and siblings() always refer to the parent and siblings (respectively) of the atom that is currently “adressed” via path?

Yes. The path represent the current insertion point (or head of the selection), and ancestor(), parent(), siblings() etc… refer to the “relatives” of the atom pointed at by path.

Since you mentioned it: how else would you implement it this time?

I would add a parent field to Atom so that a tree (graph) of atoms can easily be navigated and I would use a simple offset counting scheme to represent the caret.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/arnog/mathlive/issues/479#issuecomment-640152796, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALZM3ASZ5APAVLHUA7EAL3RVMFAJANCNFSM4NV7HFKA .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Atom IDs for Atom entries - IBM
Each Atom entry has a unique Atom ID that must remain the same for the ... the Atom feed, using information that you...
Read more >
Sunsetting Atom - The GitHub Blog
We are archiving Atom and all projects under the Atom organization for an official sunset on December 15, 2022.
Read more >
How to run Python on Atom Editor - YouTube
Learn how to run Python on Atom IDE. Atom is an open source source code editor wherein you can run different technologies using...
Read more >
How To Install and Use Atom IDE on Windows 10 - YouTube
Atom is opensource source code and text editor. Atom can be installed on Windows, Linux and OS X. Atom supports plugins written in...
Read more >
How to run PHP on Atom Editor - YouTube
Learn how to run PHP on Atom IDE. Atom is an open source source code editor wherein you can run different technologies using...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found