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

Fix issue 4778: Do not show Active Line Highlight when editor has selection #4878

Merged
merged 3 commits into from
Aug 23, 2013
Merged

Fix issue 4778: Do not show Active Line Highlight when editor has selection #4878

merged 3 commits into from
Aug 23, 2013

Conversation

lkcampbell
Copy link
Contributor

This fix hides the Active Line Highlight when there is a selection in the current editor.

It does not address the general delay with the Shift-Down-Arrow, a different problem that started showing up in the Dev version of Sprint 30. It does, however, remove the really, really slow behavior associated with the having the Highlight Active Line turned on. The delay should now be the same, regardless of the Highlight Active Line setting.

I'm not sure I should be setting the CodeMirror Option on every single call to cursorActivity, but I didn't notice any performance issues by doing so. Let me know if you want me to set a flag or something to avoid excessive setOption calls.

@lkcampbell
Copy link
Contributor Author

This fix addresses Issue #4778 and part of Issue #3191.

@ghost ghost assigned RaymondLim Aug 22, 2013
@peterflynn
Copy link
Member

@lkcampbell In the future, I was wondering if you could use more descriptive pull request titles. It makes it easier to scan our overall list of PRs, which shows very little of the description (or the RepoMan view we sometimes use, which shows none of the description). Similarly, GitHub issue link tooltips and the like only show the title.

@lkcampbell
Copy link
Contributor Author

@peterflynn, I updated the description. Thanks for the input.

@peterflynn
Copy link
Member

Thanks @lkcampbell! (Thanks for the fix here too btw :-)

editor._codeMirror.setOption("styleActiveLine", false);
}
} else {
editor._codeMirror.setOption("styleActiveLine", _styleActiveLine);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm seeing an issue with Highlight Active Line menu item unchecked after making a selection and then pressing left/right arrow to deselect. Even though we still see the active line being highlighted, the menu item is no longer checked. It seems that Editor.setShowActiveLine gets called at (or after) a selection is made and therefore _styleActiveLine becomes false.

Update: My steps above are wrong. You can see the issue with the following steps.

  1. Turn on Highlight Active Line in View menu if it is not enabled.
  2. Double-click on a word in the editor to select it.
  3. Go to View menu and uncheck Highlight Active Line while you still have selection in the editor.
  4. Press Left/Right arrow key to deselect the word in the editor.
  5. Open View menu and look at Highlight Active Line. It will be checked at this point but there is no active line highlight in the editor.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@RaymondLim, I haven't been able to repro the problem using the steps you provided. Is there anything else you can provide me to help me recreate the issue?

Copy link
Contributor

Choose a reason for hiding this comment

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

@lkcampbell
Sorry, my original steps may not be quite clear. I updated steps, especially adding step 1 to make sure that we start it with active line enabled.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@RaymondLim, sorry I still can't repro the issue with your new steps. The test you are using is very basic so it surprises me that it is failing. It's not like you are jumping around between different main and inline editors or anything complex. Is it possible there is something out of sync with my pull request or your patched machine?

I'm going to try loading a fresh build and apply the patch myself and see if I can repro the issue that way. Would it be possible to have someone else try to patch on your end and see if they have the same problem?

Copy link
Contributor

Choose a reason for hiding this comment

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

I strike out the first paragraph that is no longer true with my steps. And actually I should have posted the issue below on line 1570 (which I think is the culprit).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not even looking at the first paragraph and I'm not concerned about the line it was posted on.

What I am saying is I do the following steps (from your message above):

  1. Turn on Highlight Active Line in View menu if it is not enabled.
  2. Double-click on a word in the editor to select it.
  3. Go to View menu and uncheck Highlight Active Line while you still have selection in the editor.
  4. Press Left/Right arrow key to deselect the word in the editor.
  5. Open View menu and look at Highlight Active Line. It will be checked at this point but there is no active line highlight in the editor.

And I can't repro the issue.

First, we need to address the fact that you can repro problem and I can't.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, my mistake. I was copying over your changes in Editor.js, but not your changes in EditorOptionHandlers.js. That's why I was seeing the issue that you can't reproduce.

@RaymondLim
Copy link
Contributor

Done with review.

@lkcampbell
Copy link
Contributor Author

@RaymondLim, pull request updated.

RaymondLim added a commit that referenced this pull request Aug 23, 2013
Fix issue 4778: Do not show Active Line Highlight when editor has selection
@RaymondLim RaymondLim merged commit 5829ef7 into adobe:master Aug 23, 2013
@lkcampbell lkcampbell deleted the fix-issue-4778 branch August 23, 2013 16:29
@RaymondLim
Copy link
Contributor

@lkcampbell
This pull request is failing one of the editor option handlers unit tests. Could you fix it?

should style active line after turning it on
  TypeError: Cannot call method 'hasSelection' of null

@lkcampbell
Copy link
Contributor Author

@RaymondLim, good catch! Sorry about that. I did run unit tests but I was on the Unit tab instead of the All tab and I completely missed it.

I will fix this tonight.

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.

3 participants