ci_edit icon indicating copy to clipboard operation
ci_edit copied to clipboard

Color code uppercase words

Open aaxu opened this issue 7 years ago • 7 comments

Seems like a good feature, both for coding and note taking., since I use caps for some headers and terms. Maybe a nice blue? Although I think I said before, but this could make the message line at the bottom of the screen ("Save changes? (yes, no, or cancel):") less noticeable when it appears. I don't think we've used green, brown, magenta, or yellow yet, so maybe one of these basic colors? We could also play around with maybe the background rather than the foreground color, though I don't think that would be very aesthetically pleasing. Maybe we could have a highlighting feature though or custom text colors that allow for overriding these defaults.

aaxu avatar Nov 27 '17 18:11 aaxu

For note taking, maybe the 'text' grammar could be augmented? Here's what that looks like now.

    'text': {
      'indent': '  ',
      'special': [__sha_1,],
      'contains': ['quoted_string1', 'quoted_string2'],
    },

So quoted strings have color and so to sha1 sequences.

Maybe add a keywords line

      'keywords': ['[A-Z]{2,}',],

Or add to 'special'

      'special': [__sha_1,  '\b[A-Z]{2,}\b',],

(Don't put it in both keywords and special because one will take precedence anyway).

Keywords are a different color from a 'special'. Also, keywords automatically have \b added to the beginning and end. So if you'd like to get the caps in FOObar a 'special' (without \b) will be needed (because 'keywords' will only match whole words due to the \b at the beginning and end).

dschuyler avatar Nov 28 '17 18:11 dschuyler

I personally would prefer the entire word being highlighted, as it might irk me if only half of it is highlighted as in FOObar. Also, what is the 'special' field and how is it different from the 'keywords' aside from the \b appending? Is the comment underneath 'grammar': up to date with this 'special' field?

aaxu avatar Nov 28 '17 18:11 aaxu

Is the comment underneath 'grammar': up to date with this 'special' field?

Nope! Fixed.

I also just added another highlighting set for 'error'. It's very similar to 'special' except that it draws the text in reverse, bold, red.

Mainly the differences between them are choosing whether you'd like them drawn in blue, or brown, or reverse-bold-red. (Other than keywords being whole-word matches).*

*of course, this may vary depending on what the color palette is set to.

dschuyler avatar Nov 28 '17 18:11 dschuyler

Oh okay! Cool, I'll probably play around with this a bit more and note down some possible improvements as I try to finish some projects. Is there a way you can set the document (grammar) type, or is that automatically detected via the file name's extension?

aaxu avatar Nov 28 '17 19:11 aaxu

Do we currently have something that displays the palette? If I remember correctly, it was set to be F4 before, but it wasn't working.

aaxu avatar Dec 08 '17 18:12 aaxu

There is, but it's buggy so I often disable it. Search for #KEY_F4: self.changeToPaletteWindow, in ci_edit/app/cu_editor.py and uncomment it.

dschuyler avatar Dec 08 '17 19:12 dschuyler

This should be resolved via #138. Still don't know how to tell which file mode is active (.txt, .py, .c) and how to change it dynamically in the program (unless this isn't implemented yet)

aaxu avatar Jan 11 '18 18:01 aaxu