paveltorgashov / fastcoloredtextbox Goto Github PK
View Code? Open in Web Editor NEWFast Colored TextBox for Syntax Highlighting. The text editor component for .NET.
License: Other
Fast Colored TextBox for Syntax Highlighting. The text editor component for .NET.
License: Other
Function "private void DoSelectedVisible()":
In line "var y = FocussedItemIndex * itemHeight - VerticalScroll.Value;"
VerticalScroll.Value is not always actual.
I think you need add "some magic" before this line.
Like this:
" AutoScrollMinSize -= new Size(1, 0);
AutoScrollMinSize += new Size(1, 0);
var y = FocussedItemIndex * itemHeight - VerticalScroll.Value;"
I saw this problem with very big popup menu. Every odd times VerticalScroll.Value is zero as a result.
This line in function "internal void DoAutocomplete(bool forced)":
"VerticalScroll.Value = 0;" isn't really update this value but this value are using in "DoSelectedVisible".
See this video report http://www.youtube.com/watch?v=qyCLwvvy4Uw
Here's a sample code where coloring is wrong:
A comment block is "invented" between /*"Completion
and EndsWith("*/"
.
(snip)
catch (Exception ex) {
ErrorManager.ShowError(/*"Completion error",*/ ex);
}
(snip)
if (!ASContext.CommonSettings.DisableCodeReformat && !txt.EndsWith("*/"))
ReformatLine(Sci, Sci.PositionFromLine(line) - 1);
(snip)
Core problem: StyleIndex.None = 0. This is valid index in Styles array, but invalid flag to set/reset. Style0 = 1 but it is not the first index int the array.
So, the first call to
var styleIndex = fctb.AddStyle(style) returns 0th index. It's correct as array index, but not as StyleIndex and as style flag
Now the call to
fctbClearStyle(styleIndex) doesn't work, since it tries to reset with a mask with all 0s.
Suggestion:
Hi,
I'm interested to provide my own dialogs for replace and find.
Could you make them virtual to allow it?
Thx
Hello, i have Window with FastColoredTextBox docked in dockingPanel. I dont know, but when its docked, the Ctrl + V dont work, CTRL + B (bookmark), CTRL + F etc.. works, but Copy, paste dont. When i grab it outside dockingpanel to Float, Ctrl + V works.
I tryied to change documentstyle to others but anyway its dont work. Any ideas to fix?
Thanks
The title has it all. The program crashes/terminates after few seconds after opening the Macro Sample.
In the examples, a diff tool implementation is shown at http://www.codeproject.com/KB/edit/FastColoredTextBox_/diffMerge.png
it would be nice if the diff tool was extended with a small bar showing the heat map of changes in the files. Preferably, also allowing mouse clicks in the bar to jump the view to that location - similar to http://www.diffutils.com/wp-content/uploads/2006/10/araxis.jpg where a small bar is shown to the outermost left and right.
I guess this can be implemented completely outside of FastColeredTextBox, but it would be nice if it was standard a part of the package.
Hi, i have suggestion, the AutoIdent, if user starting writing a function, automatically show AutoComplete(Like as Visual Studio)... I created custom show, but is verry laggly. Thanx :)
Hello Pavel,
Great component with excellent features; I found a trivial bug with the Target property definition.
Here is my corrected version:
[Description("Target FastColoredTextBox")]
public FastColoredTextBox Target
{
get { return target; }
set
{
if (target != null)
UnSubscribe(target);
target = value;
if (value != null)
{
Subscribe(target);
}
OnTargetChanged();
}
}
I have used a very big vbscript file to test if auto Indenting works well but no luck.
the issues is its keeps on moving at the right side and does not come back to the left side.
e.g.
Function fn1()
If something then
SomeCode
SomeCode
End If
End Function
Function fn2()
................
..............
................
another suggestion would be rather then using "space chr" for indenting can we have Tab char
Please I need the Implementation or the source code for php and html on the same page.
Thganks
First of all, Thanks for such a great job...
This is not an issue, but it is more like a feature request.
In VS you can scroll by holding CTRL and up-down arrows, it's good to sea the same feature in your control.
UndoableCommands contain only symbols and don't contain StyleIndex. Also I have a same problem with Copy-Paste operation: it does not support StyleIndex too.
Is there any way to fix this situation?
When I switch ON wide caret, letter under cursor become invisible - instead of proper caret I see just hardcoded white rectangle, changed to black one.
I noticed that you have not accepted the pull requests. I was thinking about contributing with some changes regarding code folding.
But before I begin I would like to know if you will accept pull requests?
There are multiple calls to windows dll's, I have added some hacks around these dllimports in my fork, autocomplete and autoindent should mostly work if you incorperate my changes in FastColoredTextBox.cs.
However, there is an issue with autocomplete, the box will always have the size of a few pixels.
After debugging some i noticed that "Size" in CalcSize() will always be set to 4*26, there appears to happen some kind of bounding there.
I have spend quite a few hours trying to fix this, setting random size-related vars, nothing seems to influence the size except for setting autocomplete.Items.Minimumsize outside of the library, but that won't fix the issue.
Issue also happens in your example code.
http://i.imgur.com/hNvxxta.png
(upper: Mono, lower: .net)
Hi Pavel, thank you for this control. I've found a bug probably. When setting the .ReadOnly property of the control, or setting up some readonly blocks, the text can be modified by selecting the portion of readonly text and pressing backspace. For other actions (delete, insertion, ...) it's working correctly. Is this a bug?
I would like to be able to assign a hotkey to a method of class of my choice. In this case I;d like to have the selected area passed to the called function.
for example, I am trying to use this control as a SQL scripting environment. I select a statement and hit ALT+X. the selected statement should be passed to method Execute in class SqlEngine.
Hi Pavel, first of all thank you for sharing this component, it is amazing. Fast and full of interesting features.
Now, I would like to report a bug that I have found (or could be that I have done something wrong).
I am trying to scroll into view manually to a certain string inside a loaded text file, using the property SelectionStart.
It seems to work properly and the right part of text is shown, but if I click then on FastColoredTextBox component and scroll with the mouse wheel or even move with the keyboard arrows, it starts moving from the beginning of the file and not from the place I have set.
Do you have any idea if it is a bug and if there is a workaround?
Thank you in advance
First of all, thanks for this great component
But I've one other issue besides RTL support #67 , i need to display invisible characters like WhiteSpace, TAB, CR, LF, WordWrap.
This is a show-stopper for my application, Is that available ?
I'm trying to implement a custom Style formatted language. I have set some folding markers, when i noticed the folded range went to the end of the TextBox Text. I've looked up the "range" class and noticed that in void SetFoldingMarkers, the finishFoldingPattern is set as FoldingEndMarker, so the folding doesn't seem to work as intended.
As the title says, I cannot change the font used for rendering, neither from the properties window, nor programmatically. It's always Courier New.
Apart from that, it works beautifully. Thank you.
Hi,
Is there a way to make 2 FCTB sync between each other pls ? I mean sync on the base of the lines..
I am wondering if it would be possible to add native support for breakpoints similar to those in Visual Studio. I saw that you did something like this in your MarkerToolSample, but I would much prefer something that can be customized from the designer and has a method of retrieving a collection of line numbers on which breakpoints have been placed. As I am currently writing a debugger for an IDE I am working on, this would be an extremely helpful feature to me. Is this an idea you would be willing to consider implementing?
The current help file has good table of contents and index but there does not seem to be any actual information articles (i.e. no pages when you click on the title). Is the file broken?
Hi,
Firstly thanks for your nice work!
I have a Retina Macbook Pro, and I just tried your library, but the words inside the textbox seemed a bit blurry because the library does not support retina MBP's HiDPI screen, and then I tried to add dpiAware to app.manifest in both my app and your library, but it still blurry. So, what should I do to solve this problem?
Regards,
Jackson Ming Hu
This XML code:
<!-- Attributes are highlighted correctly -->
<childNode attr=a>value</childNodes>
<childNode attr='a'>value</childNodes>
<childNode attr="a">value</childNodes>
<!-- The values are incorrectly highlighted as attribute=value -->
<childNode>attr=a</childNodes>
<childNode>attr='a'</childNodes>
<childNode>attr="a"</childNodes>
I tried to solve this by using a lookahead, but it's not yet working. Do you maybe have some suggestion?
Hi,
In FileTextSource, the List (List sourceFileLinePositions = new List();) limit the number of lines that can be handled.
You can use List instead.
Thx
Any way to get this onto nuget?
Current Navigate code:
if (iLine >= LinesCount) return;
lastNavigatedDateTime = lines[iLine].LastVisit;
Selection.Start = new Place(0, iLine);
DoSelectionVisible();
Why LastVisit don't update? NavigateBackward don't work after calling Navigate.
I inserted
lastNavigatedDateTime = lines[iLine].LastVisit;
before assignment lastNavigatedDateTime = lines[iLine].LastVisit
And bug was fixed.
Hello,
thank you for the wonderful tool, but I have some notes
When I try to write some comments on the codes I use my native language and that starts from right to left (Arabia) and which unfortunately the editor does not support it is presenting as letters intermittent and already reflected as in the pictures attached, so I hope that there is support for languages that start from right to left.
When I copy the Arabic text that appears in reverse from your editor and I do pasted into Notepad program it appears correctly.
This Arabic text you can try (بسم الله الرحمن الرحيم)
Is there a way to use more then 16 styles?
Hello Pavel,
i noticed that your software is licensed under: GNU Lesser General Public License (LGPLv3).
As far as i got it from the net, a software licensed with LGPL can be included in a proprietary software.
However i couldn't find explicit note about v3 of LGPL. Thus i'd like to ask about your intention and opinion. Do you reveal the source code of Fast Colored TextBox for use in proprietary software?
Thanks in advance :) ,
Kamen
SyntaxHighlighter.cs has an unimplemented method:
private void RememberBrackets()
{
throw new NotImplementedException();
}
When you type " or '
the quotes will result after the space.
However, if you type "d or 'd
the d will be behind the quote.
HTML export is not adding '\n' characters when not using 'br' tag.
In ExportToHTML.cs: bool property "UseBR" (line 31-34) documentation states:
/// Use 'br' tag instead of '\n'
In ExportToHTML.cs: inside GetHtml function (line 92) the statement which accesses this bool is:
tempSB.Append(UseBr ? "<br>" : "");
It seems like the intended behavior of line 92 should be:
tempSB.Append(UseBr ? "<br>" : "\n");
Making this change makes my text export correctly, whereas without it there are no new lines present in the HTML file.
I have developed a XML validation application and for viewing I have used your control. So currently I'm having issue with locating correct position of the xml. So is there any way to handle hidden characters?
Thanks in advance.
I am working on custom REGEX highlighter and I was wondering if it is possible to use "\n" instead of "\r\n" for new line character (when user hits ENTER in fct) and "\t" instead of 4 spaces (when user hits TAB in fct)?
I tried replacing newline with \n, but I get an empty line and the text jumps into 1 line.
Thanks for the answer.
I am making an "IDE" for a functional language very similar to haskell (you can consider it a subset).
Your textbox rocks, however it has some limitations when needing to do more precise autoindenting than remove/insert a new tab, namely indenting to an exact location.
My issue: after a user has entered ", if ..." and goes to a new line, it should indent to the exact x-location as the previous line's first encounter of the char '=', indentation plays a key role in the language btw.
(silly) Example:
isTrue = "I always get returned", if True
...........= "I'm of no use whatsoever :(", if False
...........^indent to here
Suggestion:
PS:
This is my first issue =)
Hi Pavel,
fantastic job on this control, I love it.
I'm having one issue though where I close a file and it doesn't get properly released - i.e. the next time I try and open it in my app it says the file is in use - but if I close the app and reopen the file has been released.
What is the proper way to close an open file please?
I open it as a FileTextSource and try and close like this:
if (lines is FileTextSource)
{
var ftsa = lines as FileTextSource;
CloseFTS(ftsa);
}
But by that stage lines is a TextSource.
Many versions have been updated, and there is still no highlight for C/C++. I really need this.
Developers can specifically for the development of syntax highlighting module. Can later do more expansion. I believe that there will be a great future.
In the view of the grouping of XML files, we do not take into account the namespace.
It appears no grouping.
Example:
sh:StandardBusinessDocumentHeader
sh:HeaderVersion1.0/sh:HeaderVersion
sh:Sender
<sh:Identifier Authority="EAN.UCC">4002174000011/sh:Identifier
/sh:Sender
sh:Receiver
<sh:Identifier Authority="EAN.UCC">4049111100014/sh:Identifier
/sh:Receiver
sh:DocumentIdentification
sh:StandardEAN.UCC/sh:Standard
sh:TypeVersion2.8/sh:TypeVersion
sh:InstanceIdentifierBC77F9BF-35D8-47A0-8A62-2D1980DA16FA/sh:InstanceIdentifier
sh:TypecatalogueItemNotification/sh:Type
sh:MultipleTypefalse/sh:MultipleType
sh:CreationDateAndTime2001-12-17T10:30:47/sh:CreationDateAndTime
/sh:DocumentIdentification
/sh:StandardBusinessDocumentHeader
FastColoredTextBox always uses the space instead of tab characters as default. I'm not sure the reason is you dont want to or anything else... So can I share my modification of FastColoredTextBox to handle the real tab indent \t here? Just hope it's useful for someone else.
Hi
I use your textbox for a console software, with which I can color some parts of the text.
Unfortunatly I have a little problem. I add a text with a Fore- and Backgroundcolor. This works fine so far. Then I add another text with another Fore- and Backgroundcolor. And so on. Sometimes it happens that when I add a text with a style which I already used before is not found with the function
public int GetStyleIndex(Style style)
(returns -1, although when I look for myself through the array I can find the style), which causes that it is added again. Because of that I reach the maximum of 32 styles very fast. (Fontstyle stays always the same)
I add text with the following function:
MyBase.AppendText(text)
MyBase.SelectionStart = MyBase.Text.Length - Len(text)
MyBase.SelectionLength = Len(text)
MyBase.Selection.SetStyle(Me.activeTextStyle)
I generate the style with the following code:
activeTextStyle = New TextStyle(New SolidBrush(ForeGroundCol), New SolidBrush(BackGroundCol), FontStyle.Regular)
Is it because I generate the Style always new (with the code above)? Is there a possibility to find an already added style via it's foregroundcolor, backgroundcolor and textstyle?
Kind regards
Lukas Leuenberger
When searching for a string in a document that is found multiple times, the editor tels "not found" when end is reached. The next search starts over from the beginning, but sometimes a second "not found" is shown. This is easily reproduced searching in a 10-20 lines document for a string existing 3 times.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.