mirror of https://github.com/buggins/dlangui.git
commit
34ab593528
|
@ -1402,7 +1402,12 @@ class ListWidget : WidgetGroup, OnScrollHandler, OnAdapterChangeHandler {
|
|||
|
||||
class StringListWidget : ListWidget {
|
||||
import std.conv : to;
|
||||
import std.datetime.stopwatch : StopWatch;
|
||||
// Will be errored after other compilers will overtake phobos version 2.076
|
||||
version(DigitalMars) {
|
||||
import std.datetime.stopwatch : StopWatch;
|
||||
} else {
|
||||
import std.datetime : dto = to, StopWatch;
|
||||
}
|
||||
import core.time : dur;
|
||||
private dstring _searchString;
|
||||
private StopWatch _stopWatch;
|
||||
|
@ -1480,10 +1485,15 @@ class StringListWidget : ListWidget {
|
|||
if (event.action == KeyAction.Text) {
|
||||
if ( !_stopWatch.running) { _stopWatch.start; }
|
||||
|
||||
auto timePassed = _stopWatch.peek; //.to!("seconds", float)(); // dtop is std.datetime.to
|
||||
version(DigitalMars) {
|
||||
auto timePassed = _stopWatch.peek; //.to!("seconds", float)(); // dtop is std.datetime.to
|
||||
|
||||
if (timePassed > dur!"msecs"(500))
|
||||
_searchString = ""d;
|
||||
if (timePassed > dur!"msecs"(500)) _searchString = ""d;
|
||||
} else {
|
||||
auto timePassed = _stopWatch.peek.dto!("seconds", float)(); // dtop is std.datetime.to
|
||||
|
||||
if (timePassed > 0.5) _searchString = ""d;
|
||||
}
|
||||
_searchString ~= to!dchar(event.text.toUTF8);
|
||||
_stopWatch.reset;
|
||||
|
||||
|
|
Loading…
Reference in New Issue