Conversation
Sort list once and append instead of quadratic inserts. Defer userlist GUI updates during initial names burst (sess->ignore_names && !sess->end_of_names) and mark session for one rebuild at end-of-names. src/fe-gtk4/userlistgui.c:1320 src/fe-gtk4/userlistgui.c:1390 Rebuild the store once when names complete, instead of incremental per-user inserts. src/fe-gtk4/userlistgui.c:749 Replace O(n²) store population (find insert position for every item) with sort-once + append. src/fe-gtk4/userlistgui.c:719 src/fe-gtk4/userlistgui.c:727 src/fe-gtk4/userlistgui.c:783
Refactor xtext_show_session_rendered() into staged helper functions without changing behavior.\n\nChanges:\n- Add xtext_show_empty_view() for invalid/no-session fallback.\n- Add xtext_bind_visible_session() to wire the selected view/buffer and stack child.\n- Add xtext_maybe_render_visible_session() to encapsulate cache/dirty render decisions and first-show scroll behavior.\n- Add xtext_maybe_replay_marklast() to isolate replay marker handling.\n- Keep the existing render/scroll policy and debug logging semantics intact.\n\nThis commit is purely structural and aims to reduce local complexity in the session-switch path while preserving exact runtime behavior.
Refactor fe_gtk4_xtext_append_for_session() into explicit background and visible-session paths while keeping behavior unchanged.\n\nChanges:\n- Add xtext_append_background_session() for off-screen tab updates, including dirty-buffer short-circuiting, incremental tab-metric updates, and append-only rendering.\n- Add xtext_append_visible_session() for active-tab rendering, including sticky-bottom behavior, dirty full-render fallback, incremental tab-stop widening, and metric cache updates.\n- Keep raw log append ordering and existing lazy render policy exactly the same.\n\nThis commit reduces branching density in the public append entry point and makes the two operational modes easier to reason about and maintain.
Refactor duplicated scroll scheduling logic into a shared helper while preserving runtime behavior and debug visibility.\n\nChanges:\n- Add xtext_schedule_scroll_to_end() to encapsulate common scheduling/coalescing checks for both normal and replay-mark scroll flows.\n- Keep xtext_scroll_to_end() and xtext_scroll_to_end_for_replay() as thin wrappers that pass mode-specific debug event labels.\n- Preserve replay-session coalescing semantics (first pending replay session is retained while idle is already scheduled for the same view).\n\nThis commit removes duplicated control flow and keeps scroll behavior identical, including idle cancellation and debug event granularity.
Reduce repeated type-condition chains in pointer interaction code by introducing explicit token eligibility helpers.\n\nChanges:\n- Add xtext_type_is_interactive() for shared hover/interaction eligibility.\n- Add xtext_type_is_context_menu_target() for secondary-click context menu eligibility.\n- Replace duplicated inline checks in secondary-press and motion handlers with helper calls.\n\nBehavior is unchanged; this is a readability/maintainability refactor that makes interaction policy explicit and easier to extend.
Introduce and adopt xtext_session_is_valid() as the single local guard for session-pointer validity checks.\n\nChanges:\n- Add xtext_session_is_valid() helper and use it across interaction handlers, session-state helpers, session display flow, append/clear/marker entry points, and resize-session checks.\n- Remove the redundant session_state_is_valid() helper to avoid duplicate validity idioms.\n- Clean up duplicated/inline condition forms that previously mixed and patterns.\n\nBehavior is unchanged; this commit is focused on consistency and reducing conditional noise.
Refactor xtext init/cleanup into small, focused teardown/setup helpers to improve symmetry and reduce repetition.\n\nChanges:\n- Add helper routines for clearing session maps, tag resources, runtime marks/pending state, runtime sources, and runtime defaults.\n- Replace hand-written cleanup blocks with helper calls and g_clear_* usage where appropriate.\n- Keep teardown order and runtime behavior unchanged.\n\nThis commit is structure-only and makes lifecycle paths easier to audit.
Remove all xtext scroll debug logging infrastructure and its call sites.\n\nChanges:\n- Drop the scroll debug env-flag plumbing, label helpers, and log function.\n- Remove debug event calls across scroll scheduling, session switching, and replay markers.\n- Simplify scroll scheduling helper signature now that it no longer emits debug events.\n\nBehavior is unchanged aside from eliminating debug output.
Separate render-line layout policy from render mechanics to reduce local complexity.\n\nChanges:\n- Add xtext_render_line_columns() to handle column parsing and formatted text insertion for stamp/prefix/body.\n- Add xtext_apply_hanging_tag_for_line() to encapsulate hanging-indent tag application.\n- Keep xtext_render_line() as a thin coordinator for line markers, newline insertion, and helper calls.\n\nBehavior remains identical; this commit clarifies responsibilities without altering rendering semantics.
Split IRC control parsing logic in xtext_render_formatted_stateful() into small, focused helpers.\n\nChanges:\n- Add xtext_style_toggle_control() for bold/italic/underline/reverse/reset toggles.\n- Add xtext_style_parse_color_control() for numeric color parsing and fg/bg updates.\n- Add xtext_style_skip_hex_color_control() to strip rare hex color sequences safely.\n- Restructure control-handling switch to call these helpers and keep segment insertion logic intact.\n\nBehavior remains unchanged; this commit reduces nesting and makes control parsing easier to reason about.
Add a small helper for clearing hover/search state when switching sessions.\n\nChanges:\n- Introduce xtext_reset_interaction_state_for_view_switch() to reset cursor/hover/search marks.\n- Use the helper in xtext_show_session_rendered() to keep the tab-switch path focused.\n\nBehavior is unchanged; this just centralizes the existing reset sequence.
Add a concise invariants comment to the xtext append entry point.\n\nThe note captures the three behavioral invariants that other refactors rely on:\n- raw log append precedes render append\n- dirty buffer triggers full re-render on next show\n- tab metrics cache is authoritative unless a dirty render occurs\n\nThis is documentation only; no runtime behavior changes.
Fold a few single-use or trivial helper functions to reduce indirection and shrink the surface area.\n\nChanges:\n- Inline the view-switch interaction reset sequence back into xtext_show_session_rendered().\n- Drop xtext_should_stick_to_end()/xtext_is_at_end() and call xtext_view_is_at_end() directly at call sites.\n- Remove xtext_type_is_context_menu_target() and use xtext_type_is_interactive() directly for context-menu eligibility.\n\nBehavior is unchanged; this is a small code-size and readability adjustment.
Rename a handful of internal helpers to align with a consistent, shorter verb-object style.\n\nChanges:\n- Rename xtext_style_*_control helpers to xtext_style_* (toggle/parse_color/skip_hex_color).\n- Rename xtext_apply_hanging_tag_for_line() to xtext_apply_line_hanging_tag().\n- Rename xtext_append_*_session helpers to xtext_append_background()/xtext_append_visible().\n\nThis is a naming-only change; behavior is identical.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.