-
Notifications
You must be signed in to change notification settings - Fork 103
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
Some short-cut keys don't work in the script window #8301
Comments
I tested and confirmed the same behaviour. These short cuts used to be provided by the third-party control I used for the text part. I'll investigate and add the functionality myself if needed.
For the examples you gave, I think the script window's behaviour is correct. However the behaviour is far from perfect. Currently ctrl-Enter just adds the current line to a buffer. If it thinks the buffer is a valid R statement, then it executes it and clears the buffer. It uses heuristics (such as hanging binary operators, missing brackets etc.) to judge if the buffer contains a valid statement. However this sometimes fails. I plan to improve the script window's back-end so that it uses the RScript library to find the complete statement at the cursor, execute the statement and then move the cursor to the start of the next statement. This is also what RStudio does and should solve the issues related to multi-line statements. This is documented in issue #7989. |
@lloyddewit I am adding a different question here as perhaps it could be considered at the same time that you fix the keys above. And I am not even sure it is much of an issue. This is the Save and Save As keys/facilities. We have 3 main bits to save in R-Instat, namely data, output and scripts. Now, saving the data is simple in that it saves all the Tabs (data frames). We have the File > Save As > Save Data As, and that works almost fine. There is also a Save Button on the Toolbar and that is a Save, rather than Save As. And I use it, and would like to encourage others users to also do that regularly. Now the script and output windows are both now tabbed! You have a Save button (and Save Script is also on the right-click). And the output Windows also have a Save button, and may have a right-click later. I am probably making a meal of this, but I would like to make sure I have understood correctly and be able to explain this all to users. And I think we are pretty unusual in having so many separate bits to perhaps save, or not? As I write this, I wonder whether each of the Script and Output Windows should have both a Save As and also a Save button. In each case Save As is just (as the Save now) for that Tab, while the Save is (as usual) the same as Save As if the current Tab has not been saved, but is also an update of all the previously saved tabs? For most users this will be a no change, but it will mean there are just 3 well defined parts to save - I wonder what RStudio does? I am probably getting carried away now, but (if we go further, then we could add a down arrow to the Save button. This would then have 3 (or perhaps 4) options, namely
The Save All would then be a Save As for the data and each tab in each of the 3 windows. If they have all been previously saved, then it would just be a Save and would update them all! (By the way, when we next change the toolbar, I would like to widen all the down arrows and also delete the Copy and Paste items. (We don't encourage that! - even though I am very keen that Patrick completes his current Paste pull request. One of the top items for the sprint!) |
@lloyddewit I also find that the |
@lloyddewit I wonder what remains here. Should this issue be re-titled or perhaps closed? |
Most of the above is implemented. I moved the non-implemented part to issue #8454 . |
@lloyddewit I have been using multiple script windows recently and all seems to be going well.
But C for copy and X for cut don't seem to work. I think all the others are ok.
And, though I know it is a different topic I have found a very nice discussion on splitting a long line into multiple lines. I think this will work nicely in R-Instat, but I wonder what to do in "the opposite situation".
So first what I think works well. Namely you can split over multiple lines as long as R knows the command isn't finished.
So x <- 2 + 3 +
4
Is fine and R is happy, but don't do:
x <- 2 + 3
A second example is
x <- ( 2 + 3
)/4
but not x <- (2 + 3)
/4
I like all this. But sometimes the code I run has accidentally more open brackets than closed brackets. Then, of course, R-Instat "appears to hang". Then I need to put a line with just a close bracket by itself and - then relief - I usually get an error.
Am I right that absence of a close bracket is the usual reason for hanging oddly like this? And also that the "solution" when you think it is hanging - because it might just be slow in executing - is to add a close bracket, because there is no other indication that it is waiting for me - rather than me waiting for it to execute?
The text was updated successfully, but these errors were encountered: