mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-25 02:46:17 +04:00
Skip rendering gutters when gutter width exceeds view width (#7821)
This commit is contained in:
parent
7cda5b8592
commit
c7e9e94f00
@ -163,6 +163,8 @@ pub fn render_view(
|
|||||||
Box::new(highlights)
|
Box::new(highlights)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let gutter_overflow = view.gutter_offset(doc) == 0;
|
||||||
|
if !gutter_overflow {
|
||||||
Self::render_gutter(
|
Self::render_gutter(
|
||||||
editor,
|
editor,
|
||||||
doc,
|
doc,
|
||||||
@ -172,6 +174,7 @@ pub fn render_view(
|
|||||||
is_focused,
|
is_focused,
|
||||||
&mut line_decorations,
|
&mut line_decorations,
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if is_focused {
|
if is_focused {
|
||||||
let cursor = doc
|
let cursor = doc
|
||||||
|
@ -187,11 +187,17 @@ pub fn gutters(&self) -> &[GutterType] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn gutter_offset(&self, doc: &Document) -> u16 {
|
pub fn gutter_offset(&self, doc: &Document) -> u16 {
|
||||||
self.gutters
|
let total_width = self
|
||||||
|
.gutters
|
||||||
.layout
|
.layout
|
||||||
.iter()
|
.iter()
|
||||||
.map(|gutter| gutter.width(self, doc) as u16)
|
.map(|gutter| gutter.width(self, doc) as u16)
|
||||||
.sum()
|
.sum();
|
||||||
|
if total_width < self.area.width {
|
||||||
|
total_width
|
||||||
|
} else {
|
||||||
|
0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user