Coder Social home page Coder Social logo

bindkey '^r' _histdb-isearch about zsh-histdb HOT 5 OPEN

larkery avatar larkery commented on May 19, 2024
bindkey '^r' _histdb-isearch

from zsh-histdb.

Comments (5)

larkery avatar larkery commented on May 19, 2024

I don't fully understand your question; to make clear, are you saying:

  1. At some point in the past, you ran vi dir_colors
  2. Then you press ^r and enter vi
  3. This shows something like this:
$ vi dir_colors
→ in /home/you                              
→ on 2020-07-22 10:39:15
histdb 0 h: vi 

in which the word vi after the $ is underlined.
4. You press return
5. You see something like this

$ vi dir_colors dir_colors
  1. If you press return, the shell invokes vi dir_colors dir_colors (presumably you can ask vi what its arguments were somehow; I am not a vi user so dunno).

To make clear the expected behaviour:

  1. You press ^r
  2. The isearch starts, initialized with whatever you have already in the buffer (the input you are typing)
  3. Before the buffer and after the prompt is displayed the match; most recent matching history entry will be shown, and the matching region underlined
  4. Press return
  5. The match information goes away; the buffer content is replaced with the match from history; the cursor moves to the end of where the underline was.

If this is what's happening, it's not a bug. If at point 5 the buffer doesn't contain the match, something has gone wrong somewhere. In histdb-interactive.zsh on L160 you will see where I set the buffer after doing the history search. If your buffer ends up containing something other than the history text, I think something else in your zsh config is modifying BUFFER after _histdb-isearch has completed. You could check this by doing something like echo "HELLO BUFFER IS ${BUFFER}" after that line to see what's happening.

Or you can do functions -t _histdb-isearch to get a trace of what happens when you press ^r. That will show you what it is setting BUFFER to when it finishes (and also fill your screen with junk).

I'm afraid I am not going to debug this further for you, but if you can work out what is happening and find that it's something I need to fix I will be happy to fix it.

from zsh-histdb.

Beastie71 avatar Beastie71 commented on May 19, 2024

I've got a very short screen recording to show what I mean.

I actually start before typing anything with ^r, and then vi to find all vi commands. And then cycle back by continuously hitting ^r.

I'll try out what you suggest, but wanted to show you what I meant, hopefully more clearly.

Screen Recording 2020-07-22 at 8.23.17 AM.mov.gz

from zsh-histdb.

larkery avatar larkery commented on May 19, 2024

I think what's happening here might just be some redraw crud caused by your fancy prompt or terminal or other feature.

In your video, I notice that after you exit vi (which triggers a screen redraw) the prompt contents for the last command you ran are displayed as I would expect, without json on the end. One thing this could be is if something in your zsh is setting the value of POSTDISPLAY, as that variable is dumped after BUFFER but is just presentation rather than input.

You could check this by amending _histdb-isearch definition to do something like POSTDISPLAY="" before the zle recursive-edit call.

from zsh-histdb.

Beastie71 avatar Beastie71 commented on May 19, 2024

Thank you, I started digging in yesterday after my video trying to figure out where that was coming from. I appreciate the assistance!

from zsh-histdb.

Beastie71 avatar Beastie71 commented on May 19, 2024

Bingo! Its POSTDISPLAY holding that, now just to figure out why, I could just clear it out I guess, but like to know why. Thank you very much for your insight!

from zsh-histdb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.