mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 01:34:25 +00:00 
			
		
		
		
	fix(messages): no message kind for :undo messages #31590
Problem: cannot handle `:undo` and `:redo` messages in a special way, e.g. replace one by another. Solution: add `undo` kind.
This commit is contained in:
		@@ -805,6 +805,7 @@ must handle.
 | 
				
			|||||||
		"quickfix"	Quickfix navigation message
 | 
							"quickfix"	Quickfix navigation message
 | 
				
			||||||
		"search_cmd"	Entered search command
 | 
							"search_cmd"	Entered search command
 | 
				
			||||||
		"search_count"	Search count message ("S" flag of 'shortmess')
 | 
							"search_count"	Search count message ("S" flag of 'shortmess')
 | 
				
			||||||
 | 
							"undo"		|:undo| and |:redo| message
 | 
				
			||||||
		"wildlist"	'wildmode' "list" message
 | 
							"wildlist"	'wildmode' "list" message
 | 
				
			||||||
		"wmsg"		Warning ("search hit BOTTOM", |W10|, …)
 | 
							"wmsg"		Warning ("search hit BOTTOM", |W10|, …)
 | 
				
			||||||
	    New kinds may be added in the future; clients should treat unknown
 | 
						    New kinds may be added in the future; clients should treat unknown
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1862,6 +1862,7 @@ static void u_doit(int startcount, bool quiet, bool do_buf_event)
 | 
				
			|||||||
    u_oldcount = -1;
 | 
					    u_oldcount = -1;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  msg_ext_set_kind("undo");
 | 
				
			||||||
  int count = startcount;
 | 
					  int count = startcount;
 | 
				
			||||||
  while (count--) {
 | 
					  while (count--) {
 | 
				
			||||||
    // Do the change warning now, so that it triggers FileChangedRO when
 | 
					    // Do the change warning now, so that it triggers FileChangedRO when
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -240,6 +240,36 @@ describe('ui/ext_messages', function()
 | 
				
			|||||||
        },
 | 
					        },
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    -- undo
 | 
				
			||||||
 | 
					    feed('uu')
 | 
				
			||||||
 | 
					    screen:expect({
 | 
				
			||||||
 | 
					      grid = [[
 | 
				
			||||||
 | 
					        ^                         |
 | 
				
			||||||
 | 
					        {1:~                        }|*4
 | 
				
			||||||
 | 
					      ]],
 | 
				
			||||||
 | 
					      messages = {
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					          content = { { 'Already at oldest change' } },
 | 
				
			||||||
 | 
					          kind = 'undo',
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    feed('<C-r><C-r><C-r>')
 | 
				
			||||||
 | 
					    screen:expect({
 | 
				
			||||||
 | 
					      grid = [[
 | 
				
			||||||
 | 
					        line 1                   |
 | 
				
			||||||
 | 
					        line^                     |
 | 
				
			||||||
 | 
					        {1:~                        }|*3
 | 
				
			||||||
 | 
					      ]],
 | 
				
			||||||
 | 
					      messages = {
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					          content = { { 'Already at newest change' } },
 | 
				
			||||||
 | 
					          kind = 'undo',
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
  end)
 | 
					  end)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it(':echoerr', function()
 | 
					  it(':echoerr', function()
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user