mirror of https://github.com/stella-emu/stella.git
allow quick select for directories starting with non-letter chars (fixes #891)
This commit is contained in:
parent
1a20e6deb4
commit
73ffb66b3d
|
@ -349,7 +349,7 @@ class EventHandler
|
|||
/**
|
||||
Check for QWERTZ keyboard layout
|
||||
*/
|
||||
bool isQwertz() { return myQwertz; }
|
||||
bool isQwertz() const { return myQwertz; }
|
||||
|
||||
/**
|
||||
Clipboard methods.
|
||||
|
|
|
@ -304,7 +304,9 @@ bool FileListWidget::handleKeyDown(StellaKey key, StellaMod mod)
|
|||
if(StellaModTest::isAlt(mod))
|
||||
{
|
||||
handled = true;
|
||||
#ifdef DEBUG_BUILD
|
||||
cerr << " " << mod << ", " << key << endl;
|
||||
#endif
|
||||
switch(key)
|
||||
{
|
||||
case KBDK_HOME:
|
||||
|
@ -332,6 +334,11 @@ bool FileListWidget::handleKeyDown(StellaKey key, StellaMod mod)
|
|||
break;
|
||||
}
|
||||
}
|
||||
// Handle shift input for quick directory selection
|
||||
_lastKey = key; _lastMod = mod;
|
||||
if(_quickSelectTime < TimerManager::getTicks() / 1000)
|
||||
_firstMod = mod;
|
||||
|
||||
return handled;
|
||||
}
|
||||
|
||||
|
@ -342,6 +349,10 @@ bool FileListWidget::handleText(char text)
|
|||
// (or a substring accumulated from the last couple key presses).
|
||||
// Only works in a useful fashion if the list entries are sorted.
|
||||
const uInt64 time = TimerManager::getTicks() / 1000;
|
||||
const bool firstShift = StellaModTest::isShift(_firstMod);
|
||||
|
||||
if(StellaModTest::isShift(_lastMod))
|
||||
text = *StellaKeyName::forKey(_lastKey);
|
||||
|
||||
if(_quickSelectTime < time)
|
||||
_quickSelectStr = text;
|
||||
|
@ -354,7 +365,7 @@ bool FileListWidget::handleText(char text)
|
|||
{
|
||||
if(BSPF::startsWithIgnoreCase(i, _quickSelectStr))
|
||||
// Select directories when the first character is uppercase
|
||||
if((std::isupper(_quickSelectStr[0]) != 0) ==
|
||||
if(firstShift ==
|
||||
(_iconTypeList[selectedItem] == IconType::directory
|
||||
|| _iconTypeList[selectedItem] == IconType::userdir
|
||||
|| _iconTypeList[selectedItem] == IconType::recentdir
|
||||
|
|
|
@ -182,6 +182,10 @@ class FileListWidget : public StringListWidget
|
|||
|
||||
uInt32 _selected{0};
|
||||
|
||||
// Allow quick select for "uppercase", non-letter input
|
||||
StellaKey _lastKey{StellaKey::KBDK_UNKNOWN};
|
||||
StellaMod _lastMod{StellaMod::KBDM_NONE};
|
||||
StellaMod _firstMod{StellaMod::KBDM_NONE};
|
||||
string _quickSelectStr;
|
||||
uInt64 _quickSelectTime{0};
|
||||
static uInt64 _QUICK_SELECT_DELAY;
|
||||
|
|
Loading…
Reference in New Issue