 |
 | Help [modified] leosco | 5:05 17 Dec '09 |
|
 |
First of all, this is extremely cool - I appreciate your efforts and this is fantastic for my project!
I have a small problem though - I want to highlight every instances of hexadecimal numbers from 00-FFFFFF (meaning every hex number from 00-FFFFFF which are 2 digit, 4 digit or 6 digit, NOT 1, 3 or 5 digit (like, highlight 01, 0001 and 000001 but NOT 1, 001 or 00001). If I write this manually, it will take be time-consuming, it would reduce the performance of the program too. What would be the best way to do this?
Oh, I forgot to mention. I want #$ to be written before the numbers. Like #$01, not just 01. I tried doing this manually but the # and $ won't get recognised. How can I fix this?
modified on Thursday, December 17, 2009 10:20 AM
|
|
|
|
 |
 | not efficient hsj5280 | 5:13 2 Feb '09 |
|
 |
when parsing a hundreds of lines file is very slow
|
|
|
|
 |
 | Remove pinove call to run under moni, imporve speed AndrusM | 6:24 20 Oct '08 |
|
 |
Code contains one pinvoke call:
[DllImport("user32.dll", SetLastError = true)] public static extern bool PostMessage( IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam );
so it will not run under MONO in Linux. How to fix this so this can be used under MONO also ?
Also, some hunderd lines of code take 5-10 seconds to load at startuo. How to speed it up ?
Andrus
|
|
|
|
 |
|
 |
PostMessage is used to send a message to another window, usually a non-.NET one. However this code window shouldn't need to do that, so it should be possible to fix it so this call isn't needed. You'd have to look at the source code to figure out where this call is used and why, and then you can figure out an alternative.
|
|
|
|
 |
 | Cannot open with Visual Studio 2005 express g.bude | 2:02 17 Sep '08 |
|
 |
Can you provide an alternative solution (.sln) file?
|
|
|
|
 |
|
 |
I would like to see a VS2005 solution file also.....looks like a great piece of code!
Thanks
|
|
|
|
 |
|
 |
I don't have Visual Studio 2005 installed at the moment, but as I can remember there's no .NET 3.0 or .NET 3.5 specific code in the solution. Just create a VS2005 solution, grab the files into, and it should work.
Tamas
|
|
|
|
 |
 | Flashing on paste AndrusM | 7:17 16 Sep '08 |
|
 |
When large block of code is pasted in to box, CodeTextBox blinks long time. How to remove this blikning ?
Andrus
|
|
|
|
 |
|
 |
Hi Andrus,
I know about that issue, but unfortunately haven't found a reasonable solution yet. Maybe it can be solved with some Win32 API invokes (WM_SetRedraw) as I've seen in another solution, but that means, it won't work on Mono...
However, if you have another working solution for this, please le me know!
Regards,
Tamas
|
|
|
|
 |
|
 |
Thank you for reply. Mini-csarplab earlier version highlighter which I currently use pastes without flashing. It uses secondary invisible RichTextBox as buffer for this. This does not require pinvokes. Maybe this method can be used.
I tested it in MONO SVN and found that sometimes MONO crashes with expeption.
Also I found that colors are incorrect in MONO. It may be worth to create simple code to reproduce those issues and post them to MONO buglist to they can be fixed.
I'm also interested to highlight SQL syntax. How to add this ? Manoli highlighter uses class below to define this. How to use this class or some other SQL syntax definition?
#region Copyright © 2001-2003 Jean-Claude Manoli [jc@manoli.net] #endregion
using System; using System.IO; using System.Text; using System.Text.RegularExpressions;
namespace Manoli.Utils.CSharpFormat { class TsqlFormat : CodeFormat { protected override string CommentRegEx { get
{ return @"(?:--\s).*?(?=\r|\n)"; } }
protected override string StringRegEx { get
{ return @"''|'.*?'"; } }
public override bool CaseSensitive { get { return false; } }
protected override string Keywords { get
{ return "absolute action ada add admin after aggregate "
+ "alias all allocate alter and any are array as asc "
+ "assertion at authorization avg backup before begin "
+ "between binary bit bit_length blob boolean both breadth "
+ "break browse bulk by call cascade cascaded case cast "
+ "catalog char char_length character character_length "
+ "check checkpoint class clob close clustered coalesce "
+ "collate collation column commit completion compute "
+ "connect connection constraint constraints constructor "
+ "contains containstable continue convert corresponding "
+ "count create cross cube current current_date current_path "
+ "current_role current_time current_timestamp current_user "
+ "cursor cycle data database date day dbcc deallocate dec "
+ "decimal declare default deferrable deferred delete deny "
+ "depth deref desc describe descriptor destroy destructor "
+ "deterministic diagnostics dictionary disconnect disk "
+ "distinct distributed domain double drop dummy dump "
+ "dynamic each else end end-exec equals errlvl escape "
+ "every except exception exec execute exists exit external "
+ "extract false fetch file fillfactor first float for "
+ "foreign fortran found free freetext freetexttable from "
+ "full function general get global go goto grant group "
+ "grouping having holdlock host hour identity identity_insert "
+ "identitycol if ignore immediate in include index indicator "
+ "initialize initially inner inout input insensitive insert "
+ "int integer intersect interval into is isolation iterate "
+ "join key kill language large last lateral leading left "
+ "less level like limit lineno load local localtime localtimestamp "
+ "locator lower map match max min minute modifies modify "
+ "module month names national natural nchar nclob new next "
+ "no nocheck nonclustered none not null nullif numeric object "
+ "octet_length of off offsets old on only open opendatasource "
+ "openquery openrowset openxml operation option or order "
+ "ordinality out outer output over overlaps pad parameter "
+ "parameters partial pascal path percent plan position "
+ "postfix precision prefix preorder prepare preserve "
+ "primary print prior privileges proc procedure "
+ "public raiserror read reads readtext real reconfigure "
+ "recursive ref references referencing relative replication "
+ "restore restrict result return returns revoke right role "
+ "rollback rollup routine row rowcount rowguidcol rows rule "
+ "save savepoint schema scope scroll search second section "
+ "select sequence session session_user set sets setuser "
+ "shutdown size smallint some space specific specifictype "
+ "sql sqlca sqlcode sqlerror sqlexception sqlstate sqlwarning "
+ "start state statement static statistics structure substring "
+ "sum system_user table temporary terminate textsize than then "
+ "time timestamp timezone_hour timezone_minute to top trailing "
+ "tran transaction translate translation treat trigger trim "
+ "true truncate tsequal under union unique unknown unnest "
+ "update updatetext upper usage use user using value values "
+ "varchar variable varying view waitfor when whenever where "
+ "while with without work write writetext year zone"; } }
protected override string Preprocessors { get { return @"@@CONNECTIONS @@CPU_BUSY @@CURSOR_ROWS @@DATEFIRST "
+ "@@DBTS @@ERROR @@FETCH_STATUS @@IDENTITY @@IDLE "
+ "@@IO_BUSY @@LANGID @@LANGUAGE @@LOCK_TIMEOUT "
+ "@@MAX_CONNECTIONS @@MAX_PRECISION @@NESTLEVEL @@OPTIONS "
+ "@@PACK_RECEIVED @@PACK_SENT @@PACKET_ERRORS @@PROCID "
+ "@@REMSERVER @@ROWCOUNT @@SERVERNAME @@SERVICENAME @@SPID "
+ "@@TEXTSIZE @@TIMETICKS @@TOTAL_ERRORS @@TOTAL_READ "
+ "@@TOTAL_WRITE @@TRANCOUNT @@VERSION"; } } } }
Andrus
|
|
|
|
 |
|
 |
Hi Andrus,
as I see, this class uses a space-separated list of strings for the words to highlight. Splitting that strings for space, and addig the result arrays to the proper List collections of CodeTextbox should work. Unfortunately, this version doesn't support string highlightning, but u can highlight preprocessors with the function list, and u can gain an additional color.
The buffer-richTextbox solution is interesting, but I don't have any idea, how slow it could be because of the duplicate pastes, especially for larger texts...
Regards,
Tamas
|
|
|
|
 |
 | Other solutions RednaxelaFX | 2:23 8 Sep '08 |
|
 |
SharpDevelop is LGPL'd open source. It's worth taking a look at.
Quite a few WinForm apps use #develop (SharpDevelop)'s TextEditor, which should give you pretty much of what you need as a syntax highlight editor. It not designed to work with the WinForm designer, though, but using it with just code isn't all that hard. Other parts of SharpDevelop can be used to implement your own IntelliSense-like functionality.
|
|
|
|
 |
|
 |
I'll also add that you can drop in your own kind of highlighting by implementing your own version of IHighlightingStrategy and plugging it in. If you have a parser you've created with some other parser generation tool, for example, gold parser builder, you can plug it in to the system by wrapping it in an IHighlightingStrategy class.
|
|
|
|
 |
|
 |
charpdevelop TextEditor uses p/invokes. So it will not work under MONO.
This is the only control available which works well with MONO.
Andrus
|
|
|
|
 |