Question Authors' Forum

Editor Issue

Picture of Patrick Wang
Editor Issue
by Patrick Wang - Wednesday, 19 October 2016, 1:54 AM
I have just installed Moodle 3.1 with the latest CodeRunner, I realize the editor has a problem, the cursor and the place where the code is actually entered is different. 

The page below show the cursor is very far away from the semicolon.

After I entered "s", the letter s actually just appeared next to the semicolon. Very strange. Can someone help me out?


Picture of Patrick Wang
Re: Editor Issue
by Patrick Wang - Wednesday, 19 October 2016, 3:32 AM

I have solved the problem already. It is to do with the theme. I used the default theme, and everything is ok.

Picture of Richard Lobb
Re: Editor Issue
by Richard Lobb - Wednesday, 19 October 2016, 10:38 AM

Hi Patrick

Thanks for posting both a problem and a solution. It seems your original theme had somehow resulted in the Ace editor using a proportional font. This doesn't work properly - Ace requires a fixed-width font.

Changing the entire theme to fix the problem seems a bit drastic. You might be able to switch back to your original theme and add the following css somewhere suitable:

.ace_editor,.ace_editor * {
    font-family:Courier,monospace !important;

See here for a brief discussion of font issues with Ace, albeit in a different context.

Another thing you could try if you wanted to use your original theme is to pull the most recent version of CodeRunner (pushed just yesterday) and switch to the Development branch. That branch includes the latest version of the Ace editor which apparently has fixed some font issues like the above. It also fixes an annoying problem with large chunks of code being selected when you first click within the code after a Check. If that solves the problem too, you could either continue to use the Development branch (caveat emptor) or copy the Ace editor (i.e. the entire question/type/coderunner/ace subtree) out of it back into the Master branch.


Picture of Patrick Wang
Re: Editor Issue
by Patrick Wang - Friday, 4 November 2016, 2:38 PM

HI Richard,

That is very helpful. Thanks.