# Highlight cells selected feature : Request?

I always delete more cells than I want to. This is because every time I choose the cells, I am not looking at the corresponding code belonging to that cell bracket (why? because Mathematica doesn't highlight what I am selecting). When you have multiple lines of code (single-celled) and you want to delete some at a stretch, you may accidentally delete one which you dint want to.

Is there an option in v.11 ? Or is this a feature that must be requested. Irrespective of all these, this should be a default feature.

1 Highlights cell brackets, but not cell: 2 Different FONT STYLE with cut+paste on same notebook

• If you select a cell bracket, the correspond code contained within the cell bracket must be highlighted. This will visually help the user to understand what section of code is selected. Jun 14 '17 at 15:05
• See my answer to How to highlight the whole selected cell. All you need to do is to change Background to FontColor, and change colors. Aug 27 '17 at 8:32

So I disagree that this should be a default feature (I think it would interrupt my flow, at least). But it's not so tough to get this in as a default feature.

If you only want it to affect your notebooks going forward, you can make your own stylesheet where you implement this and then set:

CurrentValue[$FrontEndSession, DefaultStyleDefinitions]  to that stylesheet. Alternatively we can take advantage of the fact that FrontEndFindFileOnPath will scan $UserBaseDirectory before the system dirs.

That means we can make a whole-sale copy of "Default.nb" in the $UserBaseDirectory and just muck-about with that: $userBaseStyles =
FileNameJoin@{
$UserBaseDirectory, "SystemFiles", "FrontEnd", "StyleSheets", "Default.nb" }; With[{defStyles = FrontEndExecute@ FrontEndFindFileOnPath["Default.nb", "StyleSheetPath"]}, CopyFile[defStyles,$userBaseStyles]
];
SetOptions[
NotebookOpen[\$userBaseStyles],
{
Editable -> True,
Saveable -> True
}
]


There should then be a way to add in your defintion. Here's a first guess, although it should be possible to do this with things in the FEPrivate context. (when I figure that out I'll post it)

### Update: FEPrivate confusion

by what I know about the FEPrivate context this ought to be working:

FEPrivateIf[
FEPrivateMemberQ[
FrontEndCells[
FrontEndNotebookSelection[FrontEndInputNotebook[]]
],
FrontEndEvaluationCell[]
],
Hue[.6, .05, 1],
Inherited
]


But for reasons I don't understand it is not. Obviously it doesn't work with FEEvaluate, because neither FronEndCells nor FrontEndEvaluationCell work with it, but I thought in the past it had resolved such things fine, anyway.

### Original:

FontColor ->
Dynamic[If[MemberQ[SelectedCells[], EvaluationCell[]], Blue,
Inherited]]
`

To the cell using Command-Shift-E (on Mac) or Cell > Show Expression

Then restart and you have your change.