cycle tabcompletion, patch from Mathias Gumz
This commit is contained in:
parent
08f170c3ef
commit
25957274a4
1 changed files with 7 additions and 3 deletions
|
@ -19,7 +19,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// $Id: FbRun.cc,v 1.23 2003/12/31 01:34:33 fluxgen Exp $
|
// $Id: FbRun.cc,v 1.24 2004/02/25 18:37:47 fluxgen Exp $
|
||||||
|
|
||||||
#include "FbRun.hh"
|
#include "FbRun.hh"
|
||||||
|
|
||||||
|
@ -208,6 +208,7 @@ void FbRun::keyPressEvent(XKeyEvent &ke) {
|
||||||
// strip numlock, capslock and scrolllock mask
|
// strip numlock, capslock and scrolllock mask
|
||||||
ke.state = FbTk::KeyUtil::instance().cleanMods(ke.state);
|
ke.state = FbTk::KeyUtil::instance().cleanMods(ke.state);
|
||||||
|
|
||||||
|
int cp= cursorPosition();
|
||||||
FbTk::TextBox::keyPressEvent(ke);
|
FbTk::TextBox::keyPressEvent(ke);
|
||||||
KeySym ks;
|
KeySym ks;
|
||||||
char keychar[1];
|
char keychar[1];
|
||||||
|
@ -253,6 +254,7 @@ void FbRun::keyPressEvent(XKeyEvent &ke) {
|
||||||
break;
|
break;
|
||||||
case XK_Tab:
|
case XK_Tab:
|
||||||
tabCompleteHistory();
|
tabCompleteHistory();
|
||||||
|
setCursorPosition(cp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -317,7 +319,9 @@ void FbRun::tabCompleteHistory() {
|
||||||
} else {
|
} else {
|
||||||
int history_item = m_current_history_item - 1;
|
int history_item = m_current_history_item - 1;
|
||||||
string prefix = text().substr(0, cursorPosition());
|
string prefix = text().substr(0, cursorPosition());
|
||||||
while (history_item > - 1) {
|
while (history_item != m_current_history_item ) {
|
||||||
|
if (history_item == -1 )
|
||||||
|
history_item+= m_history.size();
|
||||||
if (m_history[history_item].find(prefix) == 0) {
|
if (m_history[history_item].find(prefix) == 0) {
|
||||||
m_current_history_item = history_item;
|
m_current_history_item = history_item;
|
||||||
setText(m_history[m_current_history_item]);
|
setText(m_history[m_current_history_item]);
|
||||||
|
@ -325,7 +329,7 @@ void FbRun::tabCompleteHistory() {
|
||||||
}
|
}
|
||||||
history_item--;
|
history_item--;
|
||||||
}
|
}
|
||||||
if (history_item == -1) XBell(m_display, 0);
|
if (history_item == m_current_history_item) XBell(m_display, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue