Comments (14)
Sounds great. Would be very helpful for intellisense.
from scintillanet.
Can you explain it again... I'm not sure I get it. j/k
That's an interesting request. As a proof of concept you can try placing the following code in your Form (and Form_Load) event:
private System.Windows.Forms.Timer idleTimer;
public event EventHandler TextChangedDelayed;
private void form_Load(object sender, EventArgs e)
{
// Wire the new event
TextChangedDelayed += scintilla_TextChangedDelayed;
idleTimer = new Timer() { Enabled = true, Interval = 1000 }; // 1 sec
idleTimer.Tick += (s, ea) =>
{
// Stop tracking idle time
idleTimer.Stop();
// No text has changed in the last 1 sec; i.e. the user stopped
// typing 1 sec ago. Fire the event.
var handler = TextChangedDelayed;
if (handler != null)
handler(scintilla, EventArgs.Empty);
};
scintilla.TextChanged += (s, ea) =>
{
// Restart the timer each time the text changes so that the timer
// tick event only fires when idle for 1 sec.
idleTimer.Stop();
idleTimer.Start();
};
}
private void scintilla_TextChangedDelayed(object sender, EventArgs e)
{
Debug.WriteLine("Time for a break...");
}
Are we sure we need this feature for all users? or is this more of a situation that is specific to you?
from scintillanet.
Yes, That should work.
Thanks for the hint.. I can just apply it in my IDE :P
And about the Are we sure we need this feature for all users? or is this more of a situation that is specific to you?
Well, I can't answer that :/
Its your choice.. But as I can see, This is a needed thing for any editor.
from scintillanet.
Did some tests and googles and found that .Stop fires the tick event when its called so its not very accurate... Because the counting is running on another thread.
Details: https://msdn.microsoft.com/en-us/library/system.timers.timer.stop%28v=vs.110%29.aspx
Will try and find a solution.
from scintillanet.
Okay.. Found a solution.
Since .Stop
makes .Enabled
to False
, Just add this under .Tick
event:
if (idleTimer.Enabled == false) return;
from scintillanet.
I'm confused, did you find a problem with the sample? If you chose to use the System.Timers.Timer
be very careful because it executes on the ThreadPool and you might accidentally attempt to execute a UI call on a non-UI thread. I chose the System.Windows.Forms.Timer
specifically because it will execute on the UI thread.
from scintillanet.
Yes.,. But actually I used System.Timers accidentally :P
Didn't know there is a difference.
I use VB.NET, that's why I didn't copy your example.
But I wrote my own code using the same idea.
Thanks though :)
from scintillanet.
I would strongly recommend against usingSystem.Timers.Timer
for this purpose. The System.Windows.Forms.Timer
is created specifically for doing what you want and will be thread-safe.
from scintillanet.
Actually I was already using Windows.Forms.Timer. :P
http://gyazo.com/ece676d72e5e9c12d2dd3aee438b5384
You can see the tooltip.
And same problem...
Maybe you mean vice versa ?
from scintillanet.
I'm still a little unclear on what your issue is... but if the issues is that the Tick
event fires when you call Stop
or that calling Stop
will set the Enabled
property to false
, that is not what happens in my tests. When I use the System.Windows.Forms.Timer
, calling Stop
does NOT cause the Tick
event to fire or the Enable
property to change.
Regardless, if you found a solution for your problem that's great.
from scintillanet.
Okay.. It worked.
I am stupid, I was doing something wrong.. First time I had System.Timers imported.. thats why it bugged :P
Thanks for your help.
Hope it gets implemented though.
OffTopic:
Also, I need you to help me in a problem.. Are you free ?
Its not related to ScintillaNET.
from scintillanet.
You may contact me at "jslusser [dot] mobile [at] gmail [dot] com" if you would like to send me a personal message.
from scintillanet.
Can I know how lexers work ?
Does it store the code parts internally ?.. if yes can't you make that lists accessible ?
It would be a lot better then parsing the code twice :P
from scintillanet.
Internally character data and style data are stored in the same array. Each character is assigned a numeric value corresponding to a style index. For example, if you wanted to style "Hello"
with style index 1
and "World"
with style index 2
, the internal representation would look like:
H1e1l1l1o1 0W2o2r2l2d2
That's a long way of saying, no, there isn't an easy way to split out the individual tokens. :)
from scintillanet.
Related Issues (20)
- Changing EOL type crashes Scintilla HOT 4
- Help!!! How to setting color of default text HOT 2
- Avalonia UI support HOT 1
- Help! Cannot find a mask that works for RgbaImage marker symvol HOT 1
- How do i remove this corner? HOT 1
- How does line indentation work? HOT 1
- Question Regarding Combined Characters and Regex
- Failed to create component 'Scintilla' HOT 4
- sign project
- How can I remove the background color of the focused line? HOT 2
- Is there any way to highlight BETWEEN characters?
- Scrollbar don't work
- Scintilla Control causes caret in other controls to jump/bug HOT 1
- STOP drag drop on windows
- Lexer.Html does not support code folding
- Error on HEREDOC php HOT 3
- Cant drag ScintillaNET control into the form.
- Undo and Redo HOT 1
- .Lines[intIndex].Position always returns 0. - Latest version, not 3.6 release.
- Find in files feature
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scintillanet.