Skip to content
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

confusing indentation #2435

Closed
binford2k opened this issue Aug 30, 2017 · 9 comments
Closed

confusing indentation #2435

binford2k opened this issue Aug 30, 2017 · 9 comments
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented topic/ui Change the appearance of the Gitea UI

Comments

@binford2k
Copy link

binford2k commented Aug 30, 2017

When typing out an indented block of code, the first line is indented with a [tab] character and the rest are indented with spaces. That makes for some really weird looking code. (And totally invalid code, if you're writing Python.)

https://try.gitea.io/nope/foobar/src/master/test.pp

@bkcsoft
Copy link
Member

bkcsoft commented Sep 4, 2017

Where are you typing this?

@binford2k
Copy link
Author

https://try.gitea.io/nope/foobar/src/master/test.pp

Click the edit pencil.

@lunny lunny added the topic/ui Change the appearance of the Gitea UI label Sep 10, 2017
@bkcsoft
Copy link
Member

bkcsoft commented Sep 10, 2017

In the web-editor then.

gitea/public/js/index.js

Lines 964 to 982 in fd85e25

$.getJSON($editFilename.data('ec-url-prefix')+value, function(editorconfig) {
if (editorconfig.indent_style === 'tab') {
codeMirrorEditor.setOption("indentWithTabs", true);
codeMirrorEditor.setOption('extraKeys', {});
} else {
codeMirrorEditor.setOption("indentWithTabs", false);
// required because CodeMirror doesn't seems to use spaces correctly for {"indentWithTabs": false}:
// - https://github.com/codemirror/CodeMirror/issues/988
// - https://codemirror.net/doc/manual.html#keymaps
codeMirrorEditor.setOption('extraKeys', {
Tab: function(cm) {
var spaces = Array(parseInt(cm.getOption("indentUnit")) + 1).join(" ");
cm.replaceSelection(spaces);
}
});
}
codeMirrorEditor.setOption("indentUnit", editorconfig.indent_size || 4);
codeMirrorEditor.setOption("tabSize", editorconfig.tab_width || 4);
});

Looks like the editor config is only loaded when one edits the filename 🤔 And the order of setting it also seems off...

@bkcsoft
Copy link
Member

bkcsoft commented Sep 10, 2017

On a side-note I noticed that the CodeMirror version we ship is very old https://github.com/codemirror/CodeMirror/releases/tag/5.17.0 and we should probably upgrade it to the newest version https://github.com/codemirror/CodeMirror/releases/tag/5.29.0

@stale
Copy link

stale bot commented Feb 12, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale stale bot added the issue/stale label Feb 12, 2019
@techknowlogick
Copy link
Member

techknowlogick commented Feb 12, 2019

We could probably update to this version now: https://github.com/codemirror/CodeMirror/releases/tag/5.43.0

@stale stale bot removed the issue/stale label Feb 12, 2019
@stale
Copy link

stale bot commented Apr 14, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale stale bot added the issue/stale label Apr 14, 2019
@lunny lunny added the issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented label Apr 14, 2019
@stale stale bot removed the issue/stale label Apr 14, 2019
@lafriks
Copy link
Member

lafriks commented Oct 15, 2019

Can you recheck on try.gitea.io if problem has been solved with codemirror update

@lafriks
Copy link
Member

lafriks commented May 14, 2020

Closing as we have replaced CodeMirror with Monaco Editor

@lafriks lafriks closed this as completed May 14, 2020
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented topic/ui Change the appearance of the Gitea UI
Projects
None yet
Development

No branches or pull requests

5 participants