mirror of https://github.com/stella-emu/stella.git
Fixed blank-line buglet in completion.
Also, minimum length command line to attempt label completion is now 2. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@560 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
e607410e1f
commit
4e065da8ed
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: PromptWidget.cxx,v 1.16 2005-06-25 01:13:00 urchlay Exp $
|
// $Id: PromptWidget.cxx,v 1.17 2005-06-25 01:25:13 urchlay Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -200,7 +200,7 @@ bool PromptWidget::handleKeyDown(int ascii, int keycode, int modifiers)
|
||||||
|
|
||||||
scrollToCurrent();
|
scrollToCurrent();
|
||||||
int len = _promptEndPos - _promptStartPos;
|
int len = _promptEndPos - _promptStartPos;
|
||||||
if(len <= 3)
|
if(len < 2) // minimum length for a command + a space is 2
|
||||||
break;
|
break;
|
||||||
|
|
||||||
int lastSpace = -1;
|
int lastSpace = -1;
|
||||||
|
@ -212,20 +212,19 @@ bool PromptWidget::handleKeyDown(int ascii, int keycode, int modifiers)
|
||||||
}
|
}
|
||||||
str[len] = '\0';
|
str[len] = '\0';
|
||||||
|
|
||||||
if(lastSpace < 2) {
|
if(lastSpace < 0) {
|
||||||
delete[] str;
|
delete[] str;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
int possibilities = instance()->debugger().equates()->countCompletions(str + lastSpace + 1);
|
EquateList *equates = instance()->debugger().equates();
|
||||||
|
int possibilities = equates->countCompletions(str + lastSpace + 1);
|
||||||
if(possibilities < 1) {
|
if(possibilities < 1) {
|
||||||
delete[] str;
|
delete[] str;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
nextLine();
|
const char *got = equates->getCompletions();
|
||||||
|
|
||||||
const char *got = instance()->debugger().equates()->getCompletions();
|
|
||||||
|
|
||||||
if(possibilities == 1) {
|
if(possibilities == 1) {
|
||||||
// add to buffer as though user typed it (plus a space)
|
// add to buffer as though user typed it (plus a space)
|
||||||
|
@ -236,6 +235,7 @@ bool PromptWidget::handleKeyDown(int ascii, int keycode, int modifiers)
|
||||||
putcharIntern(' ');
|
putcharIntern(' ');
|
||||||
_promptEndPos = _currentPos;
|
_promptEndPos = _currentPos;
|
||||||
} else {
|
} else {
|
||||||
|
nextLine();
|
||||||
// add to buffer as-is, then add PROMPT plus whatever we have so far
|
// add to buffer as-is, then add PROMPT plus whatever we have so far
|
||||||
_currentPos = _promptStartPos + lastSpace + 1;
|
_currentPos = _promptStartPos + lastSpace + 1;
|
||||||
|
|
||||||
|
@ -250,10 +250,11 @@ bool PromptWidget::handleKeyDown(int ascii, int keycode, int modifiers)
|
||||||
putcharIntern(str[i]);
|
putcharIntern(str[i]);
|
||||||
|
|
||||||
putcharIntern(' ');
|
putcharIntern(' ');
|
||||||
print( instance()->debugger().equates()->getCompletionPrefix() );
|
print( equates->getCompletionPrefix() );
|
||||||
_promptEndPos = _currentPos;
|
_promptEndPos = _currentPos;
|
||||||
}
|
}
|
||||||
draw();
|
draw();
|
||||||
|
instance()->frameBuffer().refreshOverlay();
|
||||||
delete[] str;
|
delete[] str;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue