1
0
Fork 0

don't remove double entries in the whole history, but only push unique ones

This commit is contained in:
mfranz 2007-11-27 01:40:23 +00:00
parent f4b02d7622
commit 125d9d7f19

View file

@ -67,11 +67,11 @@ var start = func {
var stop = func(save_history = 0) { var stop = func(save_history = 0) {
removelistener(listener); removelistener(listener);
gui.popdown(); gui.popdown();
if (save_history) { if (save_history and (!size(history) or !streq(history[-1], input)))
append(history, input); append(history, input);
history_pos = size(history); history_pos = size(history);
} }
}
var handle_key = func(key, shift) { var handle_key = func(key, shift) {
@ -245,18 +245,6 @@ var complete = func(in, step) {
var set_history = func(step) { var set_history = func(step) {
# eliminate identical subsequent entries
var new_history = [];
var last = "";
foreach (var h; history) {
if (h == last)
history_pos -= 1;
else
append(new_history, h);
last = h;
}
history = new_history;
history_pos += step; history_pos += step;
if (history_pos < 0) { if (history_pos < 0) {
history_pos = 0; history_pos = 0;