mirror of
https://github.com/alacritty/alacritty.git
synced 2024-11-25 14:05:41 -05:00
Address feedback
The config documentation has been changed to make it clear which part of the documentation is related to which setting. The faux scrollback part of the `scroll_terminal` method has been cleaned up by making use of the fact that the `codepoint + 1` can be used in the escape sequence which is used for scrolling.
This commit is contained in:
parent
9797bd72bc
commit
b01dc062c7
3 changed files with 37 additions and 36 deletions
|
@ -197,20 +197,23 @@ background_opacity: 1.0
|
||||||
mouse_bindings:
|
mouse_bindings:
|
||||||
- { mouse: Middle, action: PasteSelection }
|
- { mouse: Middle, action: PasteSelection }
|
||||||
|
|
||||||
# Mouse settings
|
|
||||||
#
|
|
||||||
# The `faux_scrollback_lines` setting controls the number
|
|
||||||
# of lines the terminal should scroll when the alternate
|
|
||||||
# screen buffer is active. This is used to allow mouse
|
|
||||||
# scrolling for applications like `man`.
|
|
||||||
# To disable this completely, set `faux_scrollback_lines` to 0.
|
|
||||||
#
|
|
||||||
# The `double_click` and `triple_click` settings control the time
|
|
||||||
# alacritty should wait for accepting multiple clicks as one double
|
|
||||||
# or triple click.
|
|
||||||
mouse:
|
mouse:
|
||||||
|
# Click settings
|
||||||
|
#
|
||||||
|
# The `double_click` and `triple_click` settings control the time
|
||||||
|
# alacritty should wait for accepting multiple clicks as one double
|
||||||
|
# or triple click.
|
||||||
double_click: { threshold: 300 }
|
double_click: { threshold: 300 }
|
||||||
triple_click: { threshold: 300 }
|
triple_click: { threshold: 300 }
|
||||||
|
|
||||||
|
# Faux Scrollback
|
||||||
|
#
|
||||||
|
# The `faux_scrollback_lines` setting controls the number
|
||||||
|
# of lines the terminal should scroll when the alternate
|
||||||
|
# screen buffer is active. This is used to allow mouse
|
||||||
|
# scrolling for applications like `man`.
|
||||||
|
#
|
||||||
|
# To disable this completely, set `faux_scrollback_lines` to 0.
|
||||||
faux_scrollback_lines: 1
|
faux_scrollback_lines: 1
|
||||||
|
|
||||||
selection:
|
selection:
|
||||||
|
|
|
@ -178,20 +178,23 @@ background_opacity: 1.0
|
||||||
mouse_bindings:
|
mouse_bindings:
|
||||||
- { mouse: Middle, action: PasteSelection }
|
- { mouse: Middle, action: PasteSelection }
|
||||||
|
|
||||||
# Mouse settings
|
|
||||||
#
|
|
||||||
# The `faux_scrollback_lines` setting controls the number
|
|
||||||
# of lines the terminal should scroll when the alternate
|
|
||||||
# screen buffer is active. This is used to allow mouse
|
|
||||||
# scrolling for applications like `man`.
|
|
||||||
# To disable this completely, set `faux_scrollback_lines` to 0.
|
|
||||||
#
|
|
||||||
# The `double_click` and `triple_click` settings control the time
|
|
||||||
# alacritty should wait for accepting multiple clicks as one double
|
|
||||||
# or triple click.
|
|
||||||
mouse:
|
mouse:
|
||||||
|
# Click settings
|
||||||
|
#
|
||||||
|
# The `double_click` and `triple_click` settings control the time
|
||||||
|
# alacritty should wait for accepting multiple clicks as one double
|
||||||
|
# or triple click.
|
||||||
double_click: { threshold: 300 }
|
double_click: { threshold: 300 }
|
||||||
triple_click: { threshold: 300 }
|
triple_click: { threshold: 300 }
|
||||||
|
|
||||||
|
# Faux Scrollback
|
||||||
|
#
|
||||||
|
# The `faux_scrollback_lines` setting controls the number
|
||||||
|
# of lines the terminal should scroll when the alternate
|
||||||
|
# screen buffer is active. This is used to allow mouse
|
||||||
|
# scrolling for applications like `man`.
|
||||||
|
#
|
||||||
|
# To disable this completely, set `faux_scrollback_lines` to 0.
|
||||||
faux_scrollback_lines: 1
|
faux_scrollback_lines: 1
|
||||||
|
|
||||||
selection:
|
selection:
|
||||||
|
|
23
src/input.rs
23
src/input.rs
|
@ -424,26 +424,21 @@ impl<'a, A: ActionContext + 'a> Processor<'a, A> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn scroll_terminal(&mut self, mouse_modes: TermMode, code: u8) {
|
fn scroll_terminal(&mut self, mouse_modes: TermMode, code: u8) {
|
||||||
|
debug_assert!(code == 64 || code == 65);
|
||||||
|
|
||||||
let faux_scrollback_lines = self.mouse_config.faux_scrollback_lines;
|
let faux_scrollback_lines = self.mouse_config.faux_scrollback_lines;
|
||||||
if self.ctx.terminal_mode().intersects(mouse_modes) {
|
if self.ctx.terminal_mode().intersects(mouse_modes) {
|
||||||
self.normal_mouse_report(code);
|
self.normal_mouse_report(code);
|
||||||
} else if faux_scrollback_lines > 0 {
|
} else if faux_scrollback_lines > 0 {
|
||||||
// Faux scrolling
|
// Faux scrolling
|
||||||
if code == 64 {
|
let cmd = code + 1; // 64 + 1 = A, 65 + 1 = B
|
||||||
// Scroll up by `faux_scrollback_lines`
|
let mut content = Vec::with_capacity(faux_scrollback_lines * 3);
|
||||||
let mut content = String::with_capacity(faux_scrollback_lines * 3);
|
for _ in 0..faux_scrollback_lines {
|
||||||
for _ in 0..faux_scrollback_lines {
|
content.push(0x1b);
|
||||||
content = content + "\x1bOA";
|
content.push('O' as u8);
|
||||||
}
|
content.push(cmd);
|
||||||
self.ctx.write_to_pty(content.into_bytes());
|
|
||||||
} else {
|
|
||||||
// Scroll down by `faux_scrollback_lines`
|
|
||||||
let mut content = String::with_capacity(faux_scrollback_lines * 3);
|
|
||||||
for _ in 0..faux_scrollback_lines {
|
|
||||||
content = content + "\x1bOB";
|
|
||||||
}
|
|
||||||
self.ctx.write_to_pty(content.into_bytes());
|
|
||||||
}
|
}
|
||||||
|
self.ctx.write_to_pty(content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue