Clip the command name cells
@@ -263,6 +263,13 @@ fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceTabData, _env: &Env) {
if i < commands_with_keymap_len {
let keymap = &commands_with_keymap[i];
if let Some(cmd) = data.keypress.commands.get(&keymap.command) {
+ ctx.with_save(|ctx| {
+ ctx.clip(Rect::new(
+ 0.0,
+ i as f64 * self.line_height,
+ size.width / 2.0 - keypress_width,
+ (i + 1) as f64 * self.line_height,
+ ));
let text_layout = ctx
.text()
.new_text_layout(
@@ -271,7 +278,9 @@ fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceTabData, _env: &Env) {
.font(FontFamily::SYSTEM_UI, 13.0)
.text_color(
data.config
- .get_color_unchecked(LapceTheme::EDITOR_FOREGROUND)
+ .get_color_unchecked(
+ LapceTheme::EDITOR_FOREGROUND,
+ )
.clone(),
)
.build()
@@ -285,6 +294,7 @@ fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceTabData, _env: &Env) {
+ (self.line_height - text_size.height) / 2.0,
),
);
+ });
}
let origin = Point::new(
@@ -351,6 +361,13 @@ fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceTabData, _env: &Env) {
} else {
let j = i - commands_with_keymap_len;
if let Some(command) = commands_without_keymap.get(j) {
+ ctx.with_save(|ctx| {
+ ctx.clip(Rect::new(
+ 0.0,
+ i as f64 * self.line_height,
+ size.width / 2.0 - keypress_width,
+ (i + 1) as f64 * self.line_height,
+ ));
let text_layout = ctx
.text()
.new_text_layout(
@@ -362,7 +379,9 @@ fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceTabData, _env: &Env) {
.font(FontFamily::SYSTEM_UI, 13.0)
.text_color(
data.config
- .get_color_unchecked(LapceTheme::EDITOR_FOREGROUND)
+ .get_color_unchecked(
+ LapceTheme::EDITOR_FOREGROUND,
+ )
.clone(),
)
.build()
@@ -375,7 +394,8 @@ fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceTabData, _env: &Env) {
i as f64 * self.line_height
+ (self.line_height - text_size.height) / 2.0,
),
- )
+ );
+ });
}
}
}
@@ -628,7 +648,7 @@ fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceTabData, _env: &Env) {
let text_layout = ctx
.text()
- .new_text_layout("Keybinding")
+ .new_text_layout("Key Binding")
.font(FontFamily::SYSTEM_UI, 14.0)
.default_attribute(TextAttribute::Weight(FontWeight::BOLD))
.text_color(
