Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Fix Issue #7283: Padding with line numbers turned off is broken #7641

Merged
merged 9 commits into from
Apr 28, 2014
Merged

Fix Issue #7283: Padding with line numbers turned off is broken #7641

merged 9 commits into from
Apr 28, 2014

Conversation

lkcampbell
Copy link
Contributor

Fix Issue #7283: Padding with line numbers turned off is broken.

@lkcampbell
Copy link
Contributor Author

@TomMalbran, hold up I added too much padding with the line numbers. Working on it now.

@TomMalbran
Copy link
Contributor

Yep. I noticed. The class should only be applied if the line numbers are hidden, probably only once after the html is ready from the EditorOptionHandlers

@lkcampbell
Copy link
Contributor Author

@TomMalbran, okay, ready now.

@@ -91,6 +91,10 @@ define(function (require, exports, module) {
_.each(_optionMapping, function (commandName, prefName) {
CommandManager.get(commandName).setChecked(PreferencesManager.get(prefName));
});

if (!PreferencesManager.get(SHOW_LINE_NUMBERS)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use Editor.getShowLineNumbers() here

@TomMalbran
Copy link
Contributor

One final thing. Does the padding seems enough for you, with show line numbers off? It seems to me that a bit larger might look better. cc @larz0 in case you want to take a look.

I guess I should assign this PR to myself. jeje

@TomMalbran TomMalbran self-assigned this Apr 25, 2014
@lkcampbell
Copy link
Contributor Author

@TomMalbran, if we go strictly off of the original bug, any padding that keeps the selected file arrow head from overlapping on the editor text is sufficient. If I go off of my own needs, any padding allows me to print my ruler's zero tick mark in full is sufficient. By both of these criteria, the padding is large enough.

But yeah, let's see what @larz0 has to say as well.

@TomMalbran
Copy link
Contributor

For usability is large enough, but from a design point of view it looks too close to the border or to the arrow. But it might also be just me used to have the line numbers to create extra spacing.

@lkcampbell
Copy link
Contributor Author

@TomMalbran, code review changes committed. It's up to you if you want to merge now or wait on input from @larz0 on the padding width.

@TomMalbran
Copy link
Contributor

The code looks great, and actually we are using the same padding as before it was broken, so I think that it is fine.

The is one other issue I just realized. Issue #7283 came after fixing #5293 by using a darker color for the line numbers. With this fix, that issue would be broken in the case of no line numbers, but this could be solved using a box-shadow:

.show-line-padding .CodeMirror-activeline-background {
    box-shadow: inset @code-padding 0 0 0 @activeline-number-bgcolor;
}

That code is working nice for me.

@lkcampbell
Copy link
Contributor Author

@TomMalbran if we take into account inline editors though, it seems like we need more changes than this. There is the color for active main editor, inactive main editor, active inline editor, and inactive inline editor.

@TomMalbran
Copy link
Contributor

You are right. But we might be able to do all of that in just CSS. The alternative would be to just have an empty gutter and not need to deal with any CSS. I am not sure which one is easier at this point.

@lkcampbell
Copy link
Contributor Author

Sublime Text behaves the way you are suggesting as well. I will play around with it some more. I will make sure that the color of the padding is consistent with the line numbers shown or hidden.

@lkcampbell
Copy link
Contributor Author

@TomMalbran, code review changes committed.

@lkcampbell
Copy link
Contributor Author

Hold on, one more fix I have to do.

@lkcampbell
Copy link
Contributor Author

@TomMalbran, okay, that covers all of the permutations. I'm not sure it's the best way to do the styles, the inline editor style classes are a bit confusing to me. Let me know if you think there is a cleaner way to do this since you have some experience with these styles.

@@ -247,6 +258,14 @@
.CodeMirror-matchingtag { background: @matching-bracket; }
}

.show-line-padding .inline-text-editor .CodeMirror-activeline-background {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is working great, but we never used .inline-text-editor, so just to be more consistent with the other classes, we could move this new 2 styles to line 258 and change them to:

    .show-line-padding & .CodeMirror .CodeMirror-activeline-background {
        box-shadow: none;
    }
    .show-line-padding & .CodeMirror-focused .CodeMirror-activeline-background {
        box-shadow: inset @code-padding 0 0 0 @tc-gray-panel-top-bar;
    }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TomMalbran, I agree that for consistency sake, your suggestion is correct. I will update soon.

Just to express my opinion, though, I think using .inline-text-editor in the rules is much easier to read and understand than the nested, double .CodeMirror hack we are currently using.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't knew about that class until now. It seems nice but we need to be sure that everything works fine after using it. Maybe you can open a new issue for that, or discuss it in the forums.

@lkcampbell
Copy link
Contributor Author

@TomMalbran, Code Review changes committed.

@TomMalbran
Copy link
Contributor

This looks great. This wasn't as easy as expected, jeje
Merging :)

TomMalbran added a commit that referenced this pull request Apr 28, 2014
Fix Issue #7283: Padding with line numbers turned off is broken
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants