Ticket #3124 (closed defect: fixed)

Opened 10 years ago

Last modified 10 years ago

Really escape zsh history

Reported by: z0rc Owned by: andrew_b
Priority: major Milestone: 4.8.12
Component: mc-core Version: master
Keywords: Cc: gotar@…
Blocked By: Blocking:
Branch state: merged Votes for changeset: committed-master

Description

The [ cd "`printf "%b" ...] stuff doesn't completely escape zsh history. There is one edge case. The use case is following.

  • set shell to zsh and add "setopt HIST_IGNORE_SPACE" to ~/.zshrc
  • mc
  • navigate to any directory
  • ctrl+o
  • hit ↑ (go back in history button)
  • observe that cd "`printf "%b" ... clutter

Here is citation from zsh documentation about HIST_IGNORE_SPACE:

Note that the command lingers in the internal history until the next command is entered before it vanishes, allowing you to briefly reuse or edit the line. If you want to make it vanish right away without entering another command, type a space and press return.

There is no option to change this behaviour. Can mc adopt recommended action to execute " " command after cd?

Attachments

0001-Ticket-3124-really-escape-Zsh-history.patch (1001 bytes) - added by z0rc 10 years ago.

Change History

comment:1 Changed 10 years ago by andrew_b

Related to #3063.

Changed 10 years ago by z0rc

comment:2 follow-up: ↓ 3 Changed 10 years ago by z0rc

  • Keywords review added
  • Milestone changed from Future Releases to 4.8.12

Here is a quick fix for this issue. But I'd like to get a review, as I haven't dig into mc's source code too much and this might be done more effectively or in some other way.

As a side note, I'd really like to see this fix and one from #3125 to get into mc before 4.8.12. So these fixes hopefully will be available in next Ubuntu LTS and Debian stable.

comment:3 in reply to: ↑ 2 Changed 10 years ago by andrew_b

  • Status changed from new to accepted
  • Keywords review removed
  • Votes for changeset set to andrew_b
  • Owner set to andrew_b
  • Branch state changed from no branch to on review

Replying to z0rc:

Here is a quick fix for this issue.

Looks correct. Thanks!

Branch: 3124_zsh_escape_history
changeset:2fd0ec82a310aab76ee1a7044d65d93717e5011c

comment:4 Changed 10 years ago by slavazanko

  • Votes for changeset changed from andrew_b to andrew_b slavazanko
  • Branch state changed from on review to approved

comment:5 Changed 10 years ago by andrew_b

  • Status changed from accepted to testing
  • Votes for changeset changed from andrew_b slavazanko to committed-master
  • Resolution set to fixed
  • Branch state changed from approved to merged

comment:6 Changed 10 years ago by andrew_b

  • Status changed from testing to closed

comment:7 follow-up: ↓ 8 Changed 10 years ago by drookie

I patched 4.8.11 from FreeBSD ports (since no 4.8.12 yet), this works great, except that last cd %b command is still in the shell history (while other aren't, au contraire without the patch).

Do I get this alone ?

comment:8 in reply to: ↑ 7 Changed 10 years ago by andrew_b

Replying to drookie:

I patched 4.8.11 from FreeBSD ports (since no 4.8.12 yet), this works great, except that last cd %b command is still in the shell history

In the zsh shell history?

comment:9 Changed 10 years ago by gotar

  • Cc gotar@… added
Note: See TracTickets for help on using tickets.