Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relax Edit command ordering constraints #236

Open
rjkroege opened this issue Jun 1, 2019 · 0 comments
Open

Relax Edit command ordering constraints #236

rjkroege opened this issue Jun 1, 2019 · 0 comments

Comments

@rjkroege
Copy link
Owner

rjkroege commented Jun 1, 2019

It wasn't obvious to me (at first) what the b edit command was actually for until I read the code. It sets the target Text instance for the subsequent sequence of sam commands inside a single exec of Edit. For example, have a convenient scratch buffer with something like this:

Edit
b <already loaded filename with more than 3 lines>
1 a/hello/
2 a/there/

So I got excited about this and thought "ah ha!", made myself a scratch buffer and wrote a bunch of sam commands to edit some code and middle clicked the whole thing. Edwood promptly crashed:

panic: Changes not in order

goroutine 23 [running]:
main.(*Elog).Insert(0xc00014e148, 0x35, 0xc000383e40, 0x3, 0x20)
	/Users/rjkroege/tools/gopkg/src/github.com/rjkroege/edwood/elog.go:151 +0x474
main.appendx(0xc00014e100, 0xc0000c0140, 0x35, 0x124ad48)
	/Users/rjkroege/tools/gopkg/src/github.com/rjkroege/edwood/ecmd.go:655 +0xdc
main.i_cmd(0xc00036a518, 0xc0000c0140, 0x7b)
	/Users/rjkroege/tools/gopkg/src/github.com/rjkroege/edwood/ecmd.go:297 +0x45
main.cmdexec(0xc00036a518, 0xc0000c0140, 0xc0000c0140)
	/Users/rjkroege/tools/gopkg/src/github.com/rjkroege/edwood/ecmd.go:109 +0x3a2
main.editthread(0xc00029f440)
	/Users/rjkroege/tools/gopkg/src/github.com/rjkroege/edwood/edit.go:153 +0xbd
created by main.editcmd
	/Users/rjkroege/tools/gopkg/src/github.com/rjkroege/edwood/edit.go:221 +0x1d5
testedwood.sh : exit status 2

While the above example would work, this slightly different example below replicates the out-of-order crash.

Edit
b <already loaded filename with more than 3 lines>
2 a/there/
1 a/hello/

So there are several distinct issues here that I'd like to fix:

  • user input to Edit should never bring down Edwood
  • sam would treat each of these commands as separate and apply them. If they were enclosed in { }, then sam would (silently) ignore out-of-order commands. I think Edwood should warn and ignore in that case.
This was referenced Jun 1, 2019
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

No branches or pull requests

1 participant