0
$\begingroup$

When one clicks Shift+Enter on or evaluates a cell, it prevents you from typing/editing it, so it was thought

How can I prevent SHIFT-ENTER moving the editing cursor?

would stop this, but it did not. Then, a link in a comment below its answer was tested from

Make cursor stay in input cell.

The referenced code evaluated was

 With[
  { nb := EvaluationNotebook[]
  , c := EvaluationCell[]
  }
, With[
    { cv := CurrentValue[nb, {"TaggingRules", "LastCursorPosition"}]
    , pos := FrontEndExecute@FrontEnd`UndocumentedGetSelectionPacket[nb]
    }
  , With[
      { savePosition := (
          cv = If[MemberQ[pos, "CharacterRange" -> _], Last["CharacterRange" /. pos], False]
        )
      }
    , SetOptions[nb
      , CellEventActions :> {
          {"MenuCommand", "HandleShiftReturn"} :> savePosition
        , {"MenuCommand", "EvaluateCells"} :> savePosition
        , PassEventsDown -> True
        }
      , CellEpilog :>  If[
          IntegerQ[cv]
        , SelectionMove[c, Before, CellContents]
        ; SelectionMove[nb, Next, Character, cv]
        ; cv = False
        ]
      ]
    ]
  ]
]

However, it made it so that when clicking Shift+Enter to evaluate a cell, nothing happens. This issue only is on the notebook where this code was evaluated.

Unfortunately, refreshing the page, closing/reopening the tab, clicking “Reset to Default” in “Preferences” for “Evaluation”, and clicking “Evaluation” then “Restart Session” and “Quit Kernel” did not fix this issue. These steps usually reset presets for Wolfram Cloud, but not do so for this specific one.

The version is 14.0.0 for Linux x86 (64-bit) (December 13, 2023).

How does one make Wolfram Cloud be able to use Shift+Enter and fix this glitch?

$\endgroup$
3
  • $\begingroup$ Basically, how does one undo the referenced code? $\endgroup$ Commented Mar 22 at 0:31
  • $\begingroup$ The code above can't work in the cloud because FrontEnd`UndocumentedGetSelectionPacket won't work there. And if you have problems with input cells in long notebooks without this code I suggest to contact Wolfram Support. $\endgroup$
    – Kuba
    Commented Mar 22 at 11:47
  • $\begingroup$ Let us continue this discussion in chat. $\endgroup$ Commented Mar 22 at 12:37

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.