git_ui: Only register conflict addon for full mode editors (#30049)
Noticed this whilst working on #26893 This PR prevents that single line and auto height editors have a conflict addon attached (and are observed for any excerpt changes). From how I understand it, it does not really make sense to register the conflict addon for single line or auto height editors. These editors will never show a conflict nor will they be used to resolve one. Furthermore, neither of these ever have a project attached upon creation:00c5f57575/crates/editor/src/editor.rs (L1385)
00c5f57575/crates/editor/src/editor.rs (L1403)
00c5f57575/crates/editor/src/editor.rs (L1415)
so their buffers will never be added here:00c5f57575/crates/git_ui/src/conflict_view.rs (L116-L120)
Thus, we could potentially even extend the check with an additional `|| editor.project.is_none()`. Yet, as I am not entirely sure how all of this exactly works, I left this out for now, but I can definitely add this if wanted. Release Notes: - N/A
This commit is contained in:
parent
3c128ef83f
commit
902931fdfc
1 changed files with 3 additions and 2 deletions
|
@ -46,8 +46,9 @@ impl editor::Addon for ConflictAddon {
|
||||||
|
|
||||||
pub fn register_editor(editor: &mut Editor, buffer: Entity<MultiBuffer>, cx: &mut Context<Editor>) {
|
pub fn register_editor(editor: &mut Editor, buffer: Entity<MultiBuffer>, cx: &mut Context<Editor>) {
|
||||||
// Only show conflict UI for singletons and in the project diff.
|
// Only show conflict UI for singletons and in the project diff.
|
||||||
if !editor.buffer().read(cx).is_singleton()
|
if !editor.mode().is_full()
|
||||||
&& !editor.buffer().read(cx).all_diff_hunks_expanded()
|
|| (!editor.buffer().read(cx).is_singleton()
|
||||||
|
&& !editor.buffer().read(cx).all_diff_hunks_expanded())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue