7
$\begingroup$

If I've written some code followed by a comment, like this:

x(*y*)

and I remove the comment by first removing the right delimiter and then the left, my undo history is cleared. Here are some conditions for this to occur:

  • It doesn't matter whether I remove the * or the parentheses, or both

  • Some code must precede the comment. Brackets, semicolons and commas don't seem to count.

  • The comment cannot be empty.

Has anyone else experienced this? Is there a way to fix it?

I'm on 10.1, Student Edition.

$\endgroup$
  • $\begingroup$ Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory Tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. $\endgroup$ – bbgodfrey May 23 '15 at 23:12
  • $\begingroup$ What, precisely, is the issue? $\endgroup$ – bbgodfrey May 23 '15 at 23:16
  • $\begingroup$ It's right there in the title. $\endgroup$ – Blrp May 23 '15 at 23:21
  • $\begingroup$ Can you post the output of $Version? $\endgroup$ – Bichoy May 23 '15 at 23:54
  • $\begingroup$ "10.1.0 for Microsoft Windows (64-bit) (March 24, 2015)" $\endgroup$ – Blrp May 23 '15 at 23:59
5
$\begingroup$

In an attempt to reproduce this issue, I began with

$Version
(* "10.1.0  for Microsoft Windows (64-bit) (March 24, 2015)" *)

I then typed

x(*y*)

and deleted by hand the left asterisk, right asterisk, left parenthesis, and right parenthesis in turn.

xy

Next I began Edit>Undo until I reached

x (y*)

At that point, Undo was not grayed out, so the queue presumably was not empty. Nonetheless, the final Undo was greeted by a beep, and the final asterisk was not restored. Moreover, Undo became grayed out. Selecting Help>Why the Beep? returned the message, Cannot undo the last operation. So, I did not reproduce the issue given in the question, but I certainly obtained unexpected results.

On the other hand, when I deleted first the parentheses and then the asterisks in turn, I was able to restore all four characters using Edit>Undo.

$\endgroup$
  • $\begingroup$ By "second delimiter" I meant the right one. You have to remove either the right asterisk or parenthesis (or both), and then either the left asterisk or parenthesis (or both). I made some edits to OP to clarify. $\endgroup$ – Blrp May 24 '15 at 11:30
2
$\begingroup$

If I use menu Edit > Un/Comment Selection (Windows: Alt+/) the operation can be reversed with the Undo command. This is faster anyway and prevents broken syntax and syntax highlighting that occurs when you remove half a comment marker.

(I post this as an answer because I hope it is pragmatically just that.)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.