cycling forward and backward in ex mode history is broken

Bug #640118 reported by Stefan Bethge
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ViGedit
Fix Committed
Undecided
Unassigned

Bug Description

I sometimes get this Tb

  File "(...)/.gnome2/gedit/plugins/ViGedit/bindings/ex.py", line 59, in cyleHistoryForward
    act.vibase.stack = list(options.history[options.index])
IndexError: list index out of range

It seems the index is not reset when pressing escape

Revision history for this message
Stephen Moore (delfick) wrote :

Hello,

The history for ex was just plain broken. I never use it much beyond :w and :wq, so it never got much attention.

I believe it is fixed now :)

http://bazaar.launchpad.net/~delfick/vigedit/vigedit-additions/revision/79

Changed in vigedit:
status: New → Fix Released
status: Fix Released → Fix Committed
Revision history for this message
Stefan Bethge (kjyv) wrote :

It is much better but not fixed yet :)

If I open a file and enter :5 to go to line 5 and then again :10 to go to line 10 as an example.
Then doing : and pressing up should first display 10 then 5, as in bash.
Now it actually has three elements, first 10 then 5 and then again 10.
Pressing esc when at one of those commands also does not reset the counter to the end of the list :)

Revision history for this message
Stephen Moore (delfick) wrote :

http://bazaar.launchpad.net/~delfick/vigedit/vigedit-additions/revision/81
http://bazaar.launchpad.net/~delfick/vigedit/vigedit-additions/revision/82

It doesn't go to the end when you press esc, because it adds each command to the stack at the location your currently at, rather than always at the end.

However, I've made it so that if you haven't typed anything yet (or deleted everything at the prompt), then pressing up will display the item you're at (if you just pressed colon, then this will be the last thing you did)

It will also 'remember' when you modify a command and start cycling. So say we have the history of ['blah', 'meh', 'thing'] and I cycle through to 'meh' and change it to 'mehandstuff', then cycle either forward or backward, then it will go to the next command in that direction and insert mehandstuff after meh, so history becomes ['blah', 'meh', 'mehandstuff', 'thing']

Which I believe is very different from what is "normal", but I like it.

I've also added keybindings for Page Up and Page Down to go to the start and end of the history :D

Revision history for this message
Stefan Bethge (kjyv) wrote :

I think its really nice now except for the way esc works. Sure, new commands are added at the current position, but cycling through the list to see what you did should not rember the position as it does now. Esc is a cancelling key, so I think it should cancel the state that was reached by cycling and go back to where you were when going into ex mode and hitting up. Especially there should be no down when you switch to ex mode again, I think its too confusing to remember where in the history you have stopped last. Starting at the end is very standard in a lot of programs like terminals, browsers or run dialogs. Basically the history is an ordered list sorted by time backwards. Starting at point zero makes things that you used longer ago be more key presses away because they are probably less relevant.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.