New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pushd +NUMBER doesn't work #4091

Closed
wgslr opened this Issue Jun 1, 2017 · 2 comments

Comments

Projects
None yet
3 participants
@wgslr

wgslr commented Jun 1, 2017

Hi
I'm using fish version 2.5.0. The documentation for pushd says

pushd +NUMBER rotates the stack counter-clockwise i.e. from bottom to top
pushd -NUMBER rotates clockwise i.e. top to bottom.

But all I get is

~> dirs
/tmp/c /tmp/b /tmp/a /tmp
~> pushd +1
cd: The directory “+1” does not exist

Steps to reproduce:

  1. Create temporary environment as suggested in the issue creation template: sh -c 'env HOME=$(mktemp -d) fish'
  2. Create subdirectories:
/tmp> mkdir a b c
  1. Create some dirs stack:
/tmp> pushd a
/tmp/a> pushd ../b
/tmp/b> pushd ../c
/tmp/c> dirs
/tmp/c /tmp/b /tmp/a /tmp
  1. Try to use pushd +1:
/tmp/c> pushd +1
cd: The directory “+1” does not exist
/tmp/c> dirs
/tmp/c /tmp/c /tmp/b /tmp/a /tmp

Expected result:

Current directory changed to /tmp/b, dirs stack is /tmp b /tmp/a /tmp /tmp/c

@krader1961 krader1961 self-assigned this Jun 2, 2017

@krader1961 krader1961 added this to the fish 2.7.0 milestone Jun 2, 2017

@krader1961

This comment has been minimized.

Show comment
Hide comment
@krader1961

krader1961 Jun 2, 2017

Contributor

Introduced by commit 3702616, 2016-08-28, which was trying to do the right thing by switching to local variables in the function but introduced them inside a if...end block which means they aren't visible to the rest of the function.

Contributor

krader1961 commented Jun 2, 2017

Introduced by commit 3702616, 2016-08-28, which was trying to do the right thing by switching to local variables in the function but introduced them inside a if...end block which means they aren't visible to the rest of the function.

@faho

This comment has been minimized.

Show comment
Hide comment
@faho

faho Jun 2, 2017

Member

The issue is this:

if count $argv
   set -l rot_l
end

# And now we're using rot_l
Member

faho commented Jun 2, 2017

The issue is this:

if count $argv
   set -l rot_l
end

# And now we're using rot_l
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment