mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 01:34:25 +00:00 
			
		
		
		
	terminal: trim CWD slash #11762
Trailing CWD slash in term:// buffer name breaks the BufReadCmd
handler.
Before:
    term://~///25232:/bin/bash
After:
    term://~//25232:/bin/bash
ref c6ff23d7a0
ref #11289
			
			
This commit is contained in:
		@@ -18386,7 +18386,12 @@ static void f_termopen(typval_T *argvars, typval_T *rettv, FunPtr fptr)
 | 
			
		||||
  // "./…" => "/home/foo/…"
 | 
			
		||||
  vim_FullName(cwd, (char *)NameBuff, sizeof(NameBuff), false);
 | 
			
		||||
  // "/home/foo/…" => "~/…"
 | 
			
		||||
  home_replace(NULL, NameBuff, IObuff, sizeof(IObuff), true);
 | 
			
		||||
  size_t len = home_replace(NULL, NameBuff, IObuff, sizeof(IObuff), true);
 | 
			
		||||
  // Trim slash.
 | 
			
		||||
  if (IObuff[len - 1] == '\\' || IObuff[len - 1] == '/') {
 | 
			
		||||
    IObuff[len - 1] = '\0';
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Terminal URI: "term://$CWD//$PID:$CMD"
 | 
			
		||||
  snprintf((char *)NameBuff, sizeof(NameBuff), "term://%s//%d:%s",
 | 
			
		||||
           (char *)IObuff, pid, cmd);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user