Disable main cursor when cmdline is displayed

This commit is contained in:
daa 2018-02-23 14:16:20 +03:00
parent 467ca0e672
commit 50695ba829

View File

@ -180,9 +180,10 @@ impl State {
} }
pub fn set_font_desc(&mut self, desc: &str) { pub fn set_font_desc(&mut self, desc: &str) {
self.render_state.borrow_mut().font_ctx.update( self.render_state
FontDescription::from_string(desc), .borrow_mut()
); .font_ctx
.update(FontDescription::from_string(desc));
self.model.clear_glyphs(); self.model.clear_glyphs();
self.try_nvim_resize(); self.try_nvim_resize();
self.on_redraw(&RepaintMode::All); self.on_redraw(&RepaintMode::All);
@ -328,8 +329,8 @@ impl State {
let nvim = self.nvim(); let nvim = self.nvim();
if let Some(mut nvim) = nvim { if let Some(mut nvim) = nvim {
let render_state = self.render_state.borrow(); let render_state = self.render_state.borrow();
if render_state.mode.is(&mode::NvimMode::Insert) || if render_state.mode.is(&mode::NvimMode::Insert)
render_state.mode.is(&mode::NvimMode::Normal) || render_state.mode.is(&mode::NvimMode::Normal)
{ {
let paste_code = format!("normal! \"{}P", clipboard); let paste_code = format!("normal! \"{}P", clipboard);
nvim.command_async(&paste_code) nvim.command_async(&paste_code)
@ -1124,30 +1125,33 @@ impl RedrawEvents for State {
indent: u64, indent: u64,
level: u64, level: u64,
) -> RepaintMode { ) -> RepaintMode {
let cursor = self.model.cur_point(); {
let render_state = self.render_state.borrow(); let cursor = self.model.cur_point();
let (x, y, width, height) = cursor.to_area(render_state.font_ctx.cell_metrics()); let render_state = self.render_state.borrow();
let ctx = CmdLineContext { let (x, y, width, height) = cursor.to_area(render_state.font_ctx.cell_metrics());
content, let ctx = CmdLineContext {
pos, content,
firstc, pos,
prompt, firstc,
indent, prompt,
level_idx: level, indent,
x, level_idx: level,
y, x,
width, y,
height, width,
max_width: self.max_popup_width(), height,
}; max_width: self.max_popup_width(),
};
self.cmd_line.show_level(&ctx); self.cmd_line.show_level(&ctx);
RepaintMode::Nothing }
self.on_busy(true)
} }
fn cmdline_hide(&mut self, level: u64) -> RepaintMode { fn cmdline_hide(&mut self, level: u64) -> RepaintMode {
self.cmd_line.hide_level(level); self.cmd_line.hide_level(level);
RepaintMode::Nothing self.on_busy(false)
} }
fn cmdline_block_show( fn cmdline_block_show(
@ -1156,7 +1160,7 @@ impl RedrawEvents for State {
) -> RepaintMode { ) -> RepaintMode {
let max_width = self.max_popup_width(); let max_width = self.max_popup_width();
self.cmd_line.show_block(&content, max_width); self.cmd_line.show_block(&content, max_width);
RepaintMode::Nothing self.on_busy(true)
} }
fn cmdline_block_append( fn cmdline_block_append(
@ -1169,12 +1173,12 @@ impl RedrawEvents for State {
fn cmdline_block_hide(&mut self) -> RepaintMode { fn cmdline_block_hide(&mut self) -> RepaintMode {
self.cmd_line.block_hide(); self.cmd_line.block_hide();
RepaintMode::Nothing self.on_busy(false)
} }
fn cmdline_pos(&mut self, pos: u64, level: u64) -> RepaintMode { fn cmdline_pos(&mut self, pos: u64, level: u64) -> RepaintMode {
let render_state = self.render_state.borrow(); let render_state = self.render_state.borrow();
self.cmd_line.pos(&* render_state, pos, level); self.cmd_line.pos(&*render_state, pos, level);
RepaintMode::Nothing RepaintMode::Nothing
} }
} }