warpdotdev / Warp

Warp is a modern, Rust-based terminal with AI built in so you and your team can build great software, faster.
https://warp.dev
Other
21.55k stars 379 forks source link

Comand history is the same for all tabs #4728

Open tommybernaciak opened 7 months ago

tommybernaciak commented 7 months ago

Discord username (optional)

No response

Describe the bug

In the past each tab had its own history of commands. When I went to the first tab and clicked the arrow up I got the last command I typed in this particular tab, when I switched to the second tab, the command history would be for the second tab. Now, after a recent update the history of commands is global. When I open a new tab, do some work, and want to go back to the previous task, I go back to the previous tab and try to run the latest command (for example to start a server) but it shows me the commands I typed before switching tabs.

To reproduce

  1. Type a command in one tab, npm run start or whatever
  2. Add new tab
  3. Type any command, lets say git status
  4. Go back to tab 1 and click arrow up to see history

Expected behavior

Expected - latest command from this particular tab, npm run start as in the example Actual - latest command typed anywhere - git status as in the example

Screenshots

No response

Operating system

Linux

Operating system and version

22.04

Shell Version

GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)

Current Warp version

v0.2024.04.02.08.02.stable_01

Regression

Yes, this bug started recently or with an X Warp version

Recent working Warp date

No response

Additional context

No response

Does this block you from using Warp daily?

No

Is this a Warp specific issue? (i.e. does it happen in Terminal, iTerm, Kitty, etc.)

Yes, this I confirmed this only happens in Warp, not other terminals.

Warp Internal (ignore): linear-label:b9d78064-c89e-4973-b153-5178a31ee54e

None

dannyneira commented 7 months ago

Hi @tommybernaciak This is a known behavior, once you close/reopen Warp (after updates or just normally quitting the App), the app scans your ~/.*history file and applies that to the UP arrow history.

Then only way to avoid this is to keep Warp open and never quit or close to update, but less than ideal. This consolidation of history is consistent with other terminals like iTerm.

SilentGlasses commented 6 months ago

Unless something changed in code recently, this is not a Warp issue. This has to do with ZSH itself.

Please post the section of your zshrc file that handles your history, I bet you set it to share your history across sessions...

Here are my settings, I want to have my history shared... Prior to setting this, my history was not shared across tabs or terminals. Both Mac and Linux.

# Better History
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
HISTFILE="$HOME/.zsh_history"
HISTSIZE=10000000
SAVEHIST=10000000
setopt APPEND_HISTORY             # Write to history
setopt HIST_EXPIRE_DUPS_FIRST     # Expire duplicate entries first when trimming history.
setopt HIST_FIND_NO_DUPS          # Do not display a line previously found.
setopt HIST_IGNORE_ALL_DUPS       # Delete old recorded entry if new entry is a duplicate.
setopt HIST_IGNORE_DUPS           # Don't record an entry that was just recorded again.
setopt HIST_IGNORE_SPACE          # Don't record an entry starting with a space.
setopt HIST_NO_STORE              # Don't store history commands
setopt HIST_REDUCE_BLANKS         # Remove superfluous blanks before recording entry.
setopt HIST_SAVE_NO_DUPS          # Older duplicates are omitted.
setopt INC_APPEND_HISTORY         # Write to the history file immediately, not when the shell exits.
setopt SHARE_HISTORY              # Share history between all sessions.
SHELL_SESSION_HISTORY=0           # Disable pert-terminal-session
joihn commented 4 months ago

I want shared history across tabs/panel but I can't get it :/

warp v0.2024.06.25.08.02.stable_01 zsh with this:

HISTFILE=$HOME/.zsh_history
HISTSIZE=50000
SAVEHIST=50000

setopt INC_APPEND_HISTORY     # Immediately append to history file.
setopt EXTENDED_HISTORY       # Record timestamp in history.
setopt HIST_EXPIRE_DUPS_FIRST # Expire duplicate entries first when trimming history.
setopt HIST_IGNORE_DUPS       # Dont record an entry that was just recorded again.
setopt HIST_IGNORE_ALL_DUPS   # Delete old recorded entry if new entry is a duplicate.
setopt HIST_FIND_NO_DUPS      # Do not display a line previously found.
setopt HIST_IGNORE_SPACE      # Dont record an entry starting with a space.
setopt HIST_SAVE_NO_DUPS      # Dont write duplicate entries in the history file.
setopt SHARE_HISTORY          # Share history between all sessions.
unsetopt HIST_VERIFY          # Execute commands using history (e.g.: using !$) immediately
setopt APPEND_HISTORY             # Write to history
SHELL_SESSION_HISTORY=0