Subject: bug#78263: [PATCH 1/3] Ignore OSC sequences in term instead of printing them

From: Eli Zaretskii <[email-masked]>
Date: Thu, 12 Jun 2025 10:10:09 +0300

> Date: Mon, 09 Jun 2025 20:59:02 -0700
> From: Jared Finder <[email-masked]>
> Cc: Eli Zaretskii <[email-masked]>, Per Bothner <[email-masked]>,
>  [email-masked]
> 
> On 2025-06-06 01:28, Stéphane Zermatten wrote:
> > I just got confirmation that the copyright assignent paperwork is 
> > complete.
> > 
> > Here’s an updated version of the patch, with:
> >  - 2 sentence formatting fixes
> >  - term-osc-handlers just a defvar instead of a defcustom
> 
> This patch looks good to me.

Thanks, I've now installed it on the master branch.  I needed a
followup change, though: the definition of term--osc-max-bytes was
missing from the patch.  In addition, the new test  term-handle-osc
fails:

  Test term-handle-osc backtrace:
    signal(ert-test-failed (((should (equal '(("2" . "Î±Î²")) captured))
    ert-fail(((should (equal '(("2" . "Î±Î²")) captured)) :form (equal (
    (if (unwind-protect (setq value-279 (apply fn-277 args-278)) (setq f
    (let (form-description-281) (if (unwind-protect (setq value-279 (app
    (let ((value-279 'ert-form-evaluation-aborted-280)) (let (form-descr
    (let* ((fn-277 #'equal) (args-278 (condition-case err (list '(("2" .
    (let ((locale-coding-system 'utf-8-unix)) (setq captured nil) (let*
    (let* ((captured nil) (handler #'(lambda (code text) (setq captured
    #f(lambda () [term-width term-height t] (let* ((captured nil) (handl
    #f(compiled-function () #<bytecode -0x180335fbec92162c>)()
    handler-bind-1(#f(compiled-function () #<bytecode -0x180335fbec92162
    ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
    ert-run-test(#s(ert-test :name term-handle-osc :documentation nil :b
    ert-run-or-rerun-test(#s(ert--stats :selector ... :tests ... :test-m
    ert-run-tests((not (or (tag :unstable) (tag :nativecomp))) #f(compil
    ert-run-tests-batch((not (or (tag :unstable) (tag :nativecomp))))
    ert-run-tests-batch-and-exit((not (or (tag :unstable) (tag :nativeco
    eval((ert-run-tests-batch-and-exit '(not (or (tag :unstable) (tag :n
    command-line-1(("-L" ":." "-l" "ert" "--eval" "(setq treesit-extra-l
    command-line()
    normal-top-level()
  Test term-handle-osc condition:
      (ert-test-failed
       ((should (equal '(...) captured)) :form
	(equal (("2" . "Î±Î²")) (("2" . "αβ"))) :value nil :explanation
	(list-elt 0
		  (cdr
		   (arrays-of-different-length 4 2 "Î±Î²" "αβ"
					       first-mismatch-at 0)))))
     FAILED   7/16  term-handle-osc (0.003910 sec) at lisp/term-tests.el:453

Stéphane, could you please look at the test failure and tell how to
fix it?  Or maybe I goofed when I installed your changes (as indicated
by the problem with term--osc-max-bytes)?