[rkward-cvs] rkward/rkward rkconsole.cpp, 1.28, 1.29 rkconsole.h, 1.19, 1.20
Thomas Friedrichsmeier
tfry at users.sourceforge.net
Mon Sep 11 09:52:42 UTC 2006
Update of /cvsroot/rkward/rkward/rkward
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv22455
Modified Files:
rkconsole.cpp rkconsole.h
Log Message:
Initialize command history position correctly
Do not add empty lines to history
Keep a temporary copy of the already edited line when going up in the command list
Index: rkconsole.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rkconsole.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** rkconsole.cpp 11 Sep 2006 00:48:55 -0000 1.28
--- rkconsole.cpp 11 Sep 2006 09:52:40 -0000 1.29
***************
*** 133,137 ****
commands_history = RKSettingsModuleConsole::loadCommandHistory ();
! commands_history_position = commands_history.constBegin ();
current_command = 0;
--- 133,137 ----
commands_history = RKSettingsModuleConsole::loadCommandHistory ();
! commands_history_position = commands_history.constEnd ();
current_command = 0;
***************
*** 322,328 ****
void RKConsole::commandsListUp () {
RK_TRACE (APP);
! if (commands_history.constBegin () == commands_history_position) { // already at topmost item
! return;
! }
--commands_history_position;
--- 322,327 ----
void RKConsole::commandsListUp () {
RK_TRACE (APP);
! if (commands_history.constBegin () == commands_history_position) return; // already at topmost item
! if (commands_history.constEnd () == commands_history_position) history_editing_line = currentCommand ();
--commands_history_position;
***************
*** 332,342 ****
void RKConsole::commandsListDown () {
RK_TRACE (APP);
! if (commands_history.constEnd () == commands_history_position) { // already at bottommost item
! setCurrentCommand (QString::null);
! return;
! }
++commands_history_position;
!
! setCurrentCommand (*commands_history_position);
}
--- 331,338 ----
void RKConsole::commandsListDown () {
RK_TRACE (APP);
! if (commands_history.constEnd () == commands_history_position) return; // already at bottommost item
++commands_history_position;
! if (commands_history.constEnd () == commands_history_position) setCurrentCommand (history_editing_line);
! else setCurrentCommand (*commands_history_position);
}
***************
*** 444,450 ****
void RKConsole::addCommandToHistory (const QString &command) {
RK_TRACE (APP);
! // if (command.isEmpty ()) return; // don't add empty lines // WHOA! does not work that way!
commands_history_position = commands_history.append (command);
if (RKSettingsModuleConsole::maxHistoryLength ()) {
--- 440,447 ----
void RKConsole::addCommandToHistory (const QString &command) {
RK_TRACE (APP);
! if (command.isEmpty ()) return; // don't add empty lines
commands_history_position = commands_history.append (command);
+ history_editing_line = QString::null;
if (RKSettingsModuleConsole::maxHistoryLength ()) {
Index: rkconsole.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rkconsole.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** rkconsole.h 11 Sep 2006 00:48:55 -0000 1.19
--- rkconsole.h 11 Sep 2006 09:52:40 -0000 1.20
***************
*** 88,92 ****
--- 88,95 ----
/** A list to store previous commands */
QStringList commands_history;
+ /** current position in the commands history */
QStringList::const_iterator commands_history_position;
+ /** The last line in the history is special, in that it is stored before it is submitted, but not permanently so */
+ QString history_editing_line;
/** A list to store a commands batch that will be executed one line at a time */
QStringList commands_batch;
More information about the rkward-tracker
mailing list