View Single Post
Old 10-31-2013, 09:07 AM   #40
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,409
Karma: 27757236
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I decided to go with QPlainTextEdit, frankly, none of the three choices were any good, even the most basic thing -- syntax highlighting -- was inadequate, so I realized I'd have to build my own. Which meant QPlainTextEdit.

Attached is a screenshot of what I have so far. The colors are fully themeable.

Some nice features that were not present in any of the three choices:

1) Line numbers with current line highlighting in the numbers column
2) Themeablity
3) Decent syntax highlighting. Notice in the screenshot how:

- CSS inside HTML <style> tags is highlighted
- Invalid HTML is detected with a red underline and a tooltip telling you what is wrong
- non-breaking spaces are highlighted with a slightly different background
- The contents of title, heading, bold and italics tags are rendered using the appropriate bold/italic fonts
- Namespace prefixes are highlighted

Since I'd never built an editor before, this was a fun learning experience
Attached Thumbnails
Click image for larger version

Name:	editor.png
Views:	494
Size:	88.0 KB
ID:	114346  

Last edited by kovidgoyal; 10-31-2013 at 09:09 AM.
kovidgoyal is offline