atom-julia-client icon indicating copy to clipboard operation
atom-julia-client copied to clipboard

Cursor jumps away when running selected text

Open gustafsson opened this issue 6 years ago • 5 comments

If I select a piece of text and hit Shift+Enter that piece of text is executed and I get the result displayed after that selection. This is all good. But the cursor doesn't stay at the end of the selection but instead jumps to the end of the block. It seems to me that it jumps to the same place it would jump if I hit Sift+Enter without selecting any text.

I don't think the cursor should jump when running selected text.

gustafsson avatar Apr 07 '18 10:04 gustafsson

Unless I'm not understanding you correctly, that's the point of that keybinding. If you don't want the cursor to move, then use Ctrl-Enter to eval.

pfitzseb avatar Apr 07 '18 12:04 pfitzseb

Thanks. I guess Ctrl+Enter does "Julia Client: Run Block" on Windows and Linux? (I only know about OS X where it's Cmd+Enter).

I was referring to the behaviour of "Julia Client: Run And Move" when some text is selected. I was trying to create a minimal example and I think there's an issue with how "and Move" interprets indentation when text is selected. Consider this example:

rund and move with selection

When I do "Julia Client: Run And Move" the cursor moves to the end of row 4. But the output is displayed on row 2. I.e it skips all rows until the end of the block (which in this example is only row 3 but it could be an arbitrary number of rows).

So the "Run" part and the "Move" part in "Run And Move" are inconsistent when there is both a selection and indentation, imho.

I think it would be neat if "Run And Move" stayed at the same level of indentation as it was invoked. So that in the example above it would move from line 2 to line 3 even if there was no selection. But if I invoke it at line 1 it would run and move over the whole block (line 1-4).

gustafsson avatar Apr 08 '18 08:04 gustafsson

I'm seeing the same behavior (on OS X). "Run and Move" used to make the cursor jump to the end of the executed block of code, and now it will sometimes jump many lines beyond it.

For example, if you evaluate the first line of the block of code, it behaves as expected with the cursor jumping to the end of the line. But if you evaluate the first and second lines together, the cursor jumps to the end of xyz function, which hasn't been evaluated.

`abc = "a" def = "b"

function xyz() abc = "c" end`

Conleigh avatar Mar 24 '20 15:03 Conleigh

Not sure what's the problem in that case. You can still evaluate xyz when a cursor is at the end of it.

aviatesk avatar Mar 24 '20 15:03 aviatesk

@Conleigh What you're describing is intended -- the idea is that you can keep pressing Shift-Enter and eval the whole file.

And FWIW, I can't repro the original issue anymore, so I guess it's gotten fixed in the meantime.

pfitzseb avatar Mar 24 '20 15:03 pfitzseb