Skip to content

[205_2009] Fix inconsistent document rendering when closing tabs#2915

Closed
Utkal059 wants to merge 1 commit intoMoganLab:mainfrom
Utkal059:fix/205-2009-inconsistent-rendering
Closed

[205_2009] Fix inconsistent document rendering when closing tabs#2915
Utkal059 wants to merge 1 commit intoMoganLab:mainfrom
Utkal059:fix/205-2009-inconsistent-rendering

Conversation

@Utkal059
Copy link

@Utkal059 Utkal059 commented Mar 3, 2026

Problem

Fixes #2009

When using "Documents in separate windows" mode with the Tab bar enabled,
closing a newly created tab causes the original document's rendering to
become inconsistent — the same text appears with different font metrics
and spacing than before.

Root Cause

In kill_window() inside src/Texmacs/Data/new_window.cpp, when the
last tab in a window is closed, set_current_view() switches to the
surviving window's view. But set_current_view() only updates the view
pointer — it never calls resume() on the editor.

Without resume(), notify_change(THE_FOCUS + THE_EXTENTS) is never
triggered, so the font environment and page layout are not recalculated.
This leaves the editor in a stale state, producing the visual mismatch.

There was already a FIXME comment at this location noting that GUI focus
was not properly transferred.

Fix

Added resume() and send_keyboard_focus() after set_current_view()
in kill_window(), matching the pattern already used by
var_focus_on_buffer() in new_view.cpp.

Developer Doc

See devel/205_2009.md

When closing the last tab in a window (kill_tabpage -> kill_window),
the surviving window's editor was not properly resumed. set_current_view
only updates the active view pointer without triggering rendering
recalculation. Adding resume() ensures notify_change(THE_FOCUS +
THE_EXTENTS) is called, which forces proper font environment and
layout recalculation.

Fixes MoganLab#2009
@MoonL79
Copy link
Contributor

MoonL79 commented Mar 6, 2026

Have you reproduced this issue on your device? I am unable to reproduce it on mine.
This issue is quite old, and many changes have occurred in the current version. If you can reproduce the problem, please provide a video.

@MoonL79
Copy link
Contributor

MoonL79 commented Mar 6, 2026

Sorry, it's my fault. This issue is too old and seems to have become invalid, so I have closed it.

@MoonL79 MoonL79 closed this Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent document rendering

2 participants