Compare commits

...

1 Commits

Author SHA1 Message Date
Mikayla Maki
4453fc4c49 Disable soft wrap in the commit modal, start to enable scrollbars in
commit modal
2025-03-12 17:52:40 -07:00
3 changed files with 25 additions and 9 deletions

View File

@@ -1358,7 +1358,10 @@ impl Editor {
project,
blink_manager: blink_manager.clone(),
show_local_selections: true,
show_scrollbars: true,
show_scrollbars: match mode {
EditorMode::AutoHeight { .. } | EditorMode::SingleLine { .. } => false,
EditorMode::Full => true,
},
mode,
show_breadcrumbs: EditorSettings::get_global(cx).toolbar.breadcrumbs,
show_gutter: mode == EditorMode::Full,
@@ -16776,7 +16779,8 @@ fn wrap_with_prefix(
is_whitespace,
} in tokenizer
{
if current_line_len + grapheme_len > wrap_column && current_line_len != line_prefix_len {
if (current_line_len + grapheme_len) > wrap_column && (current_line_len != line_prefix_len)
{
wrapped_text.push_str(current_line.trim_end());
wrapped_text.push('\n');
current_line.truncate(line_prefix.len());

View File

@@ -45,7 +45,7 @@ use inline_completion::Direction;
use itertools::Itertools;
use language::{
language_settings::{
IndentGuideBackgroundColoring, IndentGuideColoring, IndentGuideSettings,
self, IndentGuideBackgroundColoring, IndentGuideColoring, IndentGuideSettings,
ShowWhitespaceSetting,
},
ChunkRendererContext,
@@ -1308,7 +1308,8 @@ impl EditorElement {
);
let scrollbar_settings = EditorSettings::get_global(cx).scrollbar;
let show_scrollbars = self.editor.read(cx).show_scrollbars
let editor_show_scrollbars = self.editor.read(cx).show_scrollbars;
let show_scrollbars = editor_show_scrollbars
&& match scrollbar_settings.show {
ShowScrollbar::Auto => {
let editor = self.editor.read(cx);
@@ -1338,10 +1339,11 @@ impl EditorElement {
ShowScrollbar::Always => true,
ShowScrollbar::Never => false,
};
let axes: AxisPair<bool> = scrollbar_settings.axes.into();
if snapshot.mode != EditorMode::Full {
if snapshot.mode == EditorMode::Full
|| matches!(snapshot.mode, EditorMode::AutoHeight { .. }) && editor_show_scrollbars
{
return axis_pair(None, None);
}
@@ -7701,7 +7703,7 @@ struct ColoredRange<T> {
color: Hsla,
}
#[derive(Clone)]
#[derive(Clone, Debug)]
struct ScrollbarLayout {
hitbox: Hitbox,
visible_range: Range<f32>,
@@ -8276,8 +8278,15 @@ fn compute_auto_height_layout(
let overscroll = size(em_width, px(0.));
let editor_width = text_width - gutter_dimensions.margin - overscroll.width - em_width;
if editor.set_wrap_width(Some(editor_width), cx) {
snapshot = editor.snapshot(window, cx);
let soft_wrap_disabled = editor
.soft_wrap_mode_override
.is_some_and(|soft_wrap| matches!(soft_wrap, language_settings::SoftWrap::None));
if !soft_wrap_disabled {
if editor.set_wrap_width(Some(editor_width), cx) {
snapshot = editor.snapshot(window, cx);
}
}
let scroll_height = Pixels::from(snapshot.max_point().row().next_row().0) * line_height;

View File

@@ -35,6 +35,7 @@ use gpui::{
Transformation, UniformListScrollHandle, WeakEntity,
};
use itertools::Itertools;
use language::language_settings::SoftWrap;
use language::{Buffer, File};
use language_model::{
LanguageModel, LanguageModelRegistry, LanguageModelRequest, LanguageModelRequestMessage, Role,
@@ -368,6 +369,8 @@ pub(crate) fn commit_message_editor(
commit_editor.set_show_wrap_guides(false, cx);
commit_editor.set_show_indent_guides(false, cx);
commit_editor.set_hard_wrap(Some(72), cx);
commit_editor.set_soft_wrap_mode(SoftWrap::None, cx);
commit_editor.set_show_scrollbars(true, cx);
let placeholder = placeholder.unwrap_or("Enter commit message");
commit_editor.set_placeholder_text(placeholder, cx);
commit_editor