varkor / quiver

A modern commutative diagram editor for the web.
https://q.uiver.app
MIT License
2.39k stars 78 forks source link

Search and replace #81

Closed edvardak closed 10 months ago

edvardak commented 3 years ago

Thank you for the awesome website, my productivity has shot up!

If I may however come with a suggestion, it would be to implement a simple search and replace. I often find myself wanting to change, say, all the instances of \tau with \sigma and other relatively simple substitutions. Adding such a search and replace feature would be another massive productivity booster!

varkor commented 3 years ago

I've wanted the same feature. I wonder whether it might be worth subsuming this feature in https://github.com/varkor/quiver/issues/40. This way, you could export a diagram to tikz-cd, edit it, and then import it again. It wouldn't quite be as smooth as search and replace in-app, but it might be sufficient for most use-cases.

edvardak commented 3 years ago

Agreed, that would absolutely be a very good solution (can't imagine implementing regex matching would be much fun), though I suppose parsing tikz-cd would be quite hard.

I suppose one could also somehow expose all the the text from vertex.label and edge.label in some sort of pop-up, with a simple search & replace function there/ some way to copy out all that text, edit it, then paste it back in, refusing to proceed unless the same number of rows is present or some similar guarantee of consistency is present.

enjoysmath commented 2 years ago

Here's an auto-indexing widget I wrote for a PyQt5-based diagram editor for desktops. I currently have the project on the backburner and have moved Quiver Database to the front. image

The user makes a selection in the scene, types in a label, selects a substring in the text edit box on the right, clicks set index, then clicks "set selected items" and the diagram gets auto labeled for you (overwritten). The label could be an integer and can go into the negatives when it is. The ranges that the latin letters cycle through are A-Z back to A, and a-z back to a in the "increase direction", but for all other unicode indices, I have a data structure mapping the letter to its Unicode range. The unicode range is created at startup from a space-separated string list of Unicode chars I copied from the math blocks on Wikipedia. You simply copy / paste the symbol blocks, do a strip and throw everything into a dictionary structure that maps to range.

In Quiver, the user should also have a "Auto-index upon placement" option that will take what's in the edit box and index it to the next index and when you click to place a node in the scene, the node takes on that label with increased index. You need an auto-indexing widget for Nodes and a separate one for Arrows.

That way there's only an editing of text made if really necessary. Well, Abstract Spacecraft (the PyQt5 version) uses unicode. So you'd have to do the indexing but with \alpha, \beta, \gamma and so on.

varkor commented 10 months ago

I'm going to close this feature, since, now that #40 has been implemented, one can use the search-and-replace features of a text editor, import the modified diagram, and then immediately export it again. This is not quite as smooth as having search-and-replace as a native feature, but it is not far off.