##// END OF EJS Templates
%cd: do not add same dir to dhist twice in a row
Ville M. Vainio -
Show More
@@ -2670,6 +2670,7 b' Defaulting color scheme to \'NoColor\'"""'
2670 parameter_s = parameter_s.strip()
2670 parameter_s = parameter_s.strip()
2671 #bkms = self.shell.persist.get("bookmarks",{})
2671 #bkms = self.shell.persist.get("bookmarks",{})
2672
2672
2673 oldcwd = os.getcwd()
2673 numcd = re.match(r'(-)(\d+)$',parameter_s)
2674 numcd = re.match(r'(-)(\d+)$',parameter_s)
2674 # jump in directory history by number
2675 # jump in directory history by number
2675 if numcd:
2676 if numcd:
@@ -2708,7 +2709,7 b' Defaulting color scheme to \'NoColor\'"""'
2708
2709
2709 # at this point ps should point to the target dir
2710 # at this point ps should point to the target dir
2710 if ps:
2711 if ps:
2711 try:
2712 try:
2712 os.chdir(os.path.expanduser(ps))
2713 os.chdir(os.path.expanduser(ps))
2713 if self.shell.rc.term_title:
2714 if self.shell.rc.term_title:
2714 #print 'set term title:',self.shell.rc.term_title # dbg
2715 #print 'set term title:',self.shell.rc.term_title # dbg
@@ -2719,8 +2720,9 b' Defaulting color scheme to \'NoColor\'"""'
2719 else:
2720 else:
2720 cwd = os.getcwd()
2721 cwd = os.getcwd()
2721 dhist = self.shell.user_ns['_dh']
2722 dhist = self.shell.user_ns['_dh']
2722 dhist.append(cwd)
2723 if oldcwd != cwd:
2723 self.db['dhist'] = compress_dhist(dhist)[-100:]
2724 dhist.append(cwd)
2725 self.db['dhist'] = compress_dhist(dhist)[-100:]
2724
2726
2725 else:
2727 else:
2726 os.chdir(self.shell.home_dir)
2728 os.chdir(self.shell.home_dir)
@@ -2728,8 +2730,10 b' Defaulting color scheme to \'NoColor\'"""'
2728 platutils.set_term_title("IPy ~")
2730 platutils.set_term_title("IPy ~")
2729 cwd = os.getcwd()
2731 cwd = os.getcwd()
2730 dhist = self.shell.user_ns['_dh']
2732 dhist = self.shell.user_ns['_dh']
2731 dhist.append(cwd)
2733
2732 self.db['dhist'] = compress_dhist(dhist)[-100:]
2734 if oldcwd != cwd:
2735 dhist.append(cwd)
2736 self.db['dhist'] = compress_dhist(dhist)[-100:]
2733 if not 'q' in opts and self.shell.user_ns['_dh']:
2737 if not 'q' in opts and self.shell.user_ns['_dh']:
2734 print self.shell.user_ns['_dh'][-1]
2738 print self.shell.user_ns['_dh'][-1]
2735
2739
General Comments 0
You need to be logged in to leave comments. Login now