@@ -317,6 +317,35 @@ cell, so the visual line width must equal the terminal column count."
317317 (ghostel--write-input term " \e ]2;My Title\e \\ " )
318318 (should (equal " My Title" (ghostel--get-title term ))))) ; title set via OSC 2
319319
320+ (ert-deftest ghostel-test-title-does-not-overwrite-manual-rename ()
321+ " Test that title updates do not overwrite a manual buffer rename."
322+ (let (buf)
323+ (unwind-protect
324+ (cl-letf (((symbol-function 'ghostel--new )
325+ (lambda (&rest _args ) 'fake-term ))
326+ ((symbol-function 'ghostel--apply-palette )
327+ (lambda (&rest _args ) nil ))
328+ ((symbol-function 'ghostel--start-process )
329+ (lambda () nil )))
330+ (let ((ghostel--buffer-counter 0 ))
331+ (ghostel)
332+ (setq buf (current-buffer )))
333+ (with-current-buffer buf
334+ (should (equal " *ghostel*" (buffer-name )))
335+ (should (equal " *ghostel*" ghostel--managed-buffer-name))
336+ (ghostel--set-title " Title A" )
337+ (should (equal " *ghostel: Title A*" (buffer-name )))
338+ (should (equal " *ghostel: Title A*" ghostel--managed-buffer-name))
339+ (ghostel--set-title " Title A2" )
340+ (should (equal " *ghostel: Title A2*" (buffer-name )))
341+ (should (equal " *ghostel: Title A2*" ghostel--managed-buffer-name))
342+ (rename-buffer " ghostel manual title test" t )
343+ (ghostel--set-title " Title B" )
344+ (should (equal " ghostel manual title test" (buffer-name )))
345+ (should (equal " *ghostel: Title A2*" ghostel--managed-buffer-name))))
346+ (when (buffer-live-p buf)
347+ (kill-buffer buf)))))
348+
320349; ; -----------------------------------------------------------------------
321350; ; Test: CRLF normalization in Zig
322351; ; -----------------------------------------------------------------------
@@ -1511,6 +1540,7 @@ cell, so the visual line width must equal the terminal column count."
15111540 ghostel-test-module-version-match
15121541 ghostel-test-module-version-mismatch
15131542 ghostel-test-module-version-newer-than-minimum
1543+ ghostel-test-title-does-not-overwrite-manual-rename
15141544 ghostel-test-immediate-redraw-triggers-on-small-echo
15151545 ghostel-test-immediate-redraw-skips-large-output
15161546 ghostel-test-immediate-redraw-skips-stale-send
0 commit comments