Sponsored Content
The Lounge What is on Your Mind? New Code Tags (Syntax Highlighting) Post 303019458 by Corona688 on Friday 29th of June 2018 01:11:45 PM
Old 06-29-2018
I may be in the minority here, but I'm not sure I like it - yet. It's a good idea, and the line numbering is especially helpful, but the feature needs to be thought through.

This disrupts our habitual use of [color=red] to highlight important changes, for one thing. Either it needs to be opt-in a la [code=bash] or the syntax highlighting colors should be more subdued.

And unless it's done very well, syntax highlighting can be misleading. The one thing which really needs to work perfectly here, the detection of lines and strings, has done a hash job. It looks great, until you think about it -- it's highlighting "shell code" inside quoted and unquoted string literals! It's finding strings inside strings! I really don't want to explain to new programmers why I'm right and the website is wrong.

Last edited by Corona688; 06-29-2018 at 02:58 PM..
This User Gave Thanks to Corona688 For This Post:
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Emacs color syntax highlighting

So... i cant get it to work. I had already posted this but it got deleted. Details: Im running SSH shell on Windows XP, connecting to a server whose term is vt100 (someone asked me that last time) Im trying to get the syntax highlighting in cc mode to work in color, but its black and... (0 Replies)
Discussion started by: viejid
0 Replies

2. UNIX for Dummies Questions & Answers

color highlighting with 'more','grep' and 'vi'

Hi all, i would to find out how can i turn on color hightlighting with the 'more' command. When i view a big file, i tend to use the 'more' command and i would search for a interested string with the '/' command. Something the search returns more than 1 line found on the screen, how can i... (0 Replies)
Discussion started by: new2ss
0 Replies

3. Programming

Vim highlighting annoyance

I was using vim about an hour ago doing abit of python (i only just started using vim). And I think i typed something wrong, and all of a sudden the letter i is always highlighted. Turning syntax off and on didn't work. and i couldent find the solution online. Thanks in advanced. (1 Reply)
Discussion started by: vimhelp
1 Replies

4. UNIX and Linux Applications

gedit/gtksourceview: Updating types for syntax highlighting?

I wrote a new .lang file for syntax highlighting a language I use frequently. It works fine, except that it doesn't glob onto the files automatically. Is there a utility I need to run to update a gtksourceview database? Here's the relevant portion of the code. <language id="pari"... (0 Replies)
Discussion started by: CRGreathouse
0 Replies

5. Shell Programming and Scripting

How to stop Vim from highlighting lines 73+

I am slowly developing my .vimrc and would like to know how to turn off the highlighting (black text on orange background) which starts at line 73. This doesn't seem to be controlled by any selected/customized colorscheme. I do CFD, and some older codes I use are written in F77, for which this... (2 Replies)
Discussion started by: drbones
2 Replies

6. AIX

[Vim] Question about syntax highlighting

Hi all, my sysadmin installed Vim packages (vim-enhanced-6.3-1 & vim-common-6.3-1) on an Aix system (7.1.0.0). I log in using Putty (vs 0.54) and got an annoying underline issue. All strings and var names are underlined as you can see on the attached file Is it possible to get rid of that... (4 Replies)
Discussion started by: Fundix
4 Replies

7. UNIX for Dummies Questions & Answers

Reapplying syntax highlighting in vim

I had a bash script (ma_report.sh) that I was editing when my VPN connection died. So, when I reconnected, I recovered my changes and reopened the file. Everything looks fine except that there is no longer any syntax highlighting. Using ':syntax on' does not work. Other bash scripts in vim do... (1 Reply)
Discussion started by: treesloth
1 Replies

8. Shell Programming and Scripting

Highlighting duplicate string on a line

Hi all I have a grep written to pull out values; below (in the code snip-it) is an example of the output. What I'm struggling to do, and looking for assistance on, is identifying the lines that have duplicate strings. For example 74859915K74859915K in the below is 74859915K repeated twice but... (8 Replies)
Discussion started by: brighty
8 Replies
QSyntaxHighlighter(3qt) 												   QSyntaxHighlighter(3qt)

NAME
QSyntaxHighlighter - Base class for implementing QTextEdit syntax highlighters SYNOPSIS
#include <qsyntaxhighlighter.h> Inherits Qt. Public Members QSyntaxHighlighter ( QTextEdit * textEdit ) virtual ~QSyntaxHighlighter () virtual int highlightParagraph ( const QString & text, int endStateOfLastPara ) = 0 void setFormat ( int start, int count, const QFont & font, const QColor & color ) void setFormat ( int start, int count, const QColor & color ) void setFormat ( int start, int count, const QFont & font ) QTextEdit * textEdit () const void rehighlight () DESCRIPTION
The QSyntaxHighlighter class is a base class for implementing QTextEdit syntax highlighters. A syntax highligher automatically highlights parts of the text in a QTextEdit. Syntax highlighters are often used when the user is entering text in a specific format (for example, source code) and help the user to read the text and identify syntax errors. To provide your own syntax highlighting for QTextEdit, you must subclass QSyntaxHighlighter and reimplement highlightParagraph(). When you create an instance of your QSyntaxHighlighter subclass, pass it the QTextEdit that you want the syntax highlighting to be applied to. After this your highlightParagraph() function will be called automatically whenever necessary. Use your highlightParagraph() function to apply formatting (e.g. setting the font and color) to the text that is passed to it. See also Basic Widgets and Text Related Classes. MEMBER FUNCTION DOCUMENTATION
QSyntaxHighlighter::QSyntaxHighlighter ( QTextEdit * textEdit ) Constructs the QSyntaxHighlighter and installs it on textEdit. Ownership of the QSyntaxHighlighter is transferred to the textEdit QSyntaxHighlighter::~QSyntaxHighlighter () [virtual] Destructor. Uninstalls this syntax highlighter from the textEdit() int QSyntaxHighlighter::highlightParagraph ( const QString & text, int endStateOfLastPara ) [pure virtual] This function is called when necessary by the rich text engine, i.e. on paragraphs which have changed. In your reimplementation you should parse the paragraph's text and call setFormat() as often as necessary to apply any font and color changes that you require. Your function must return a value which indicates the paragraph's end state: see below. Some syntaxes can have constructs that span paragraphs. For example, a C++ syntax highlighter should be able to cope with /*...*/ comments that span paragraphs. To deal with these cases it is necessary to know the end state of the previous paragraph (e.g. "in comment"). If your syntax does not have paragraph spanning constructs, simply ignore the endStateOfLastPara parameter and always return 0. Whenever highlightParagraph() is called it is passed a value for endStateOfLastPara. For the very first paragraph this value is always -2. For any other paragraph the value is the value returned by the most recent highlightParagraph() call that applied to the preceding paragraph. The value you return is up to you. We recommend only returning 0 (to signify that this paragraph's syntax highlighting does not affect the following paragraph), or a positive integer (to signify that this paragraph has ended in the middle of a paragraph spanning construct). For example, if you're writing a simple C++ syntax highlighter, you might designate 1 to signify "in comment". For a paragraph that ended in the middle of a comment you'd return 1, and for other paragraphs you'd return 0. In your parsing code if endStateOfLastPara was 1, you would highlight the text as a C++ comment until you reached the closing */. void QSyntaxHighlighter::rehighlight () Redoes the highlighting of the whole document. void QSyntaxHighlighter::setFormat ( int start, int count, const QFont & font, const QColor & color ) This function is applied to the syntax highlighter's current paragraph (the text of which is passed to the highlightParagraph() function). The specified font and color are applied to the text from position start for count characters. (If count is 0, nothing is done.) void QSyntaxHighlighter::setFormat ( int start, int count, const QColor & color ) This is an overloaded member function, provided for convenience. It behaves essentially like the above function. void QSyntaxHighlighter::setFormat ( int start, int count, const QFont & font ) This is an overloaded member function, provided for convenience. It behaves essentially like the above function. QTextEdit * QSyntaxHighlighter::textEdit () const Returns the QTextEdit on which this syntax highlighter is installed SEE ALSO
http://doc.trolltech.com/qsyntaxhighlighter.html http://www.trolltech.com/faq/tech.html COPYRIGHT
Copyright 1992-2001 Trolltech AS, http://www.trolltech.com. See the license file included in the distribution for a complete license statement. AUTHOR
Generated automatically from the source code. BUGS
If you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. Good bug reports help us to help you. Thank you. The definitive Qt documentation is provided in HTML format; it is located at $QTDIR/doc/html and can be read using Qt Assistant or with a web browser. This man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech. If you find errors in this manual page, please report them to qt-bugs@trolltech.com. Please include the name of the manual page (qsyntaxhighlighter.3qt) and the Qt version (3.1.1). Trolltech AS 9 December 2002 QSyntaxHighlighter(3qt)
All times are GMT -4. The time now is 02:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy